Skip to content
This repository has been archived by the owner on May 18, 2022. It is now read-only.

Latest commit

 

History

History
70 lines (49 loc) · 1.56 KB

README.md

File metadata and controls

70 lines (49 loc) · 1.56 KB

This is a Next.js project bootstrapped with create-next-app, using Apollo as GraphQL client to fetch data from a Hasura API.

Getting Started

1. Clone the project

git clone https://github.com/hubiwan/next-apollo-hasura.git

# remove .git and re-initialize
rm -rf .git
git init

2. Install project dependencies

yarn
# or
npm install

3. Set environment variables

Set development environment variables:

cp .env.local.example .env.local

Set production environment variables (used for Hasura metadata and migration deployment):

cp .env.production.local.example .env.production.local

Don't forget to set other necessary production environment variables directly on respective platforms when deploying (e.g. on Vercel or Hasura)

4. Apply metadata and migration files (e.g. User schema for authentication)

# Apply metadata
hasura metadata apply --envfile ../.env.local

# Apply migration
hasura migrate apply --database-name default --envfile ../.env.local

# Reload metadata
hasura metadata reload --envfile ../.env.local

5. Launch dev mode

# Hasura GraphQL dev mode
cd hasura && docker-compose --env-file ../.env.local up -d && hasura console --envfile ../.env.local
# Next.js app dev mode
yarn dev
# or
npm run dev

6. Stop dev mode (and commit changes)

cd hasura && docker-compose --env-file ../.env.local down