- Graphql A query language for your API.
- Apollo-server Spec-compliant GraphQL server that's compatible with any GraphQL client.
- Prisma Next-generation Node.js and TypeScript ORM.
- Postgres The Open Source Relational Database.
- Typescript JavaScript with syntax for types.
- Codegen Generate code from GraphQL schema.
- Prettier Code formatter.
- ESLint Find and fix problems in JavaScript and typescript code.
- Prettier Code formatter.
- husky Husky improves your commits.
Creates the .env file in the root directory of the project, which is used for defining environment variables
- Recommended
node
npm
Install all dependencies :
cd starter-graphql-apollo-prisma-ts && npm install
Creates the .env file in the root directory of the project :
$ touch .env
In the .env, set your postgres database url :
PORT=4500
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public"
To map your data model to the database schema, you need to use the first prisma migrate :
$ npx prisma migrate dev --name init
When the migration is executed, add the 1st data :
$ npx prisma db seed
Run your GraphQL server with this command :
npm run dev
Navigate to http://localhost:4000 in your browser to explore the API with the Apollo Playground.