Coder Social home page Coder Social logo

slicknode / starter-nextjs-blog Goto Github PK

View Code? Open in Web Editor NEW
9.0 4.0 2.0 550 KB

NextJS + Slicknode Headless GraphQL CMS blog starter kit

Home Page: https://slicknode.com

License: MIT License

JavaScript 82.89% SCSS 15.38% Shell 1.72%
graphql nextjs nextjs-example headless-cms cms headless serverless

starter-nextjs-blog's Introduction

Slicknode NextJS Blog Starter

This is a simple blog site to get you started with NextJS and Slicknode. It has a very minimal setup that you can easily customize and extend.

Installation

Clone the repository and install all dependencies:

npm install

Then run the setup script:

npm run setup

This will create a new Slicknode project with, GraphQL API and the GraphQL endpoint will be added to your local configuration. Just follow the instructions on the screen.

Start the local development server and start hacking:

npm run dev

For more information how to build NextJS applications, check out the official NextJS docs.

Customizing Data Model

Install the Slicknode CLI globally if you don't already have it installed on your computer:

npm install -g slicknode@latest

The Slicknode modules with the data model are located in modules/. To change and extend the data model, open the schema file of the blog module modules/blog/schema.graphql, add your changes and redeploy your project to the Slicknode cloud:

slicknode deploy

Check out the Slicknode documentation for more information on how to model your data, create your own modules, etc.

Preview Mode

To load content in preview mode, visit the URL /api/preview in your browser. This will set a cookie and enable the preview mode for the duration of the browser session. The Slicknode API will then return all content from the preview stage.

Securing Preview Mode:

To secure the preview mode, set a secret via the env variable PREVIEW_SECRET_TOKEN in the process that runs the server. (See the next.js docs)

With the PREVIEW_SECRET_TOKEN set, you have to pass the secret to the preview URL to enable the preview mode. For example: /api/preview?secret=xyz123.

Static Site Export

To generate a static site export of your site to deploy to the web via S3, Netlify etc:

npm run export

This will generate a static version of your site in the folder out/.

Run Production Server

If you need server-side rendering instead of static site export (for example for automatic rebuild of pages), first create a build and then start the server:

npm run build

Start web server:

npm start

starter-nextjs-blog's People

Contributors

ivome avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.