jeyofdev / starter-graphql-apollo-prisma-ts

Setting up a project fullstack with Node, Typescript, Graphql, Apollo, Codegen and Prisma.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Starter Graphql Apollo Prisma

Setting up a project fullstack with Node, Typescript, Graphql, Apollo, Codegen and Prisma.

Tools

  • 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.

Getting starting

Creates the .env file in the root directory of the project, which is used for defining environment variables

Prerequisites

  • Recommended node
  • npm

Dependencies

Install all dependencies :

cd starter-graphql-apollo-prisma-ts && npm install

Environment variables

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"

Database

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

Start the server

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.

About

Setting up a project fullstack with Node, Typescript, Graphql, Apollo, Codegen and Prisma.


Languages

Language:TypeScript 80.7%Language:JavaScript 18.2%Language:Shell 1.1%