A simple, yet powerful, NextJS to show how Nhost and NextJS can work together.
- Select public data (ads) using
getStaticProps
. - Authentication
- Protect Dashboard route
- Select, Insert, Update and Delete data as a logged in user
- With correct permissions
Basically, create a Nhost project, edit two config files, apply Hasura migrations/metadata to your Nhost project and you are good to go!
- Create a new Nhost project.
git clone git@github.com:nhost/nhost-nextjs-example-app.git
to clone this repo.- Update
lib/config.js
with Backend and GraphQL endpoints from your Nhost Project. - Update
hasura/config.yaml
with GraphQL endpoint and Admin Secret from your Nhost project. - Make sure you have the Hasura CLI installed.
cd hasura
,hasura migrate apply
,hasura metadata apply
to apply Hasura migrations and metadata.yarn install
to install dependencies.yarn dev
to start NextJS.