- Next.js
- Prisma
- Nexus
- GraphQL Codegen
- Urql
- Apollo-server-micro
- Eslint + Prettier
- Lint-staged + Simple-git-hooks
- Copy
.env.example
to.env
and fill out the.env
file with your environment variables:
cp .env.example .env
-
Install Docker by following their installation instructions for your OS. Docker is used to start the local development database.
-
Install the dependencies with
npm
:
npm install
- Start the local development database with
docker-compose
:
docker-compose up
- Migrate your local development database to the base schema:
npx prisma migrate dev
- Start the development database with:
docker-compose up
- Start the development process, which also runs all the necessary code generators:
npm run dev
Now you should have project running locally and should be able to visit http://localhost:3000 🎉
The three most important commands you'll run frequently during development:
-
npm run generate
: Generates the Prisma client (docs), which Nexus uses and generates the GraphQL schema (docs), which GraphQL Codegen uses and generates the urql hooks (docs). Run this whenever you change the database schema, GraphQL schema or GraphQL queries. -
npm run prisma:migrate
: Creates migration files from your Prisma schema changes and runs those migrations on your local dev db (docs). Run this whenever you change your database schema. -
npm run prisma:studio
: Starts Prisma Studio onlocalhost:5555
where you can inspect your local development database.