Skip to content

gabrielcolson/prisma-graphql

Repository files navigation

Prisma-GraphQL

Boilerplate for GraphQL API made for the utopia boilerplate generator

Usage

This boilerplate is meant to be used with utopia:

go get github.com/gabrielcolson/utopia
utopia https://github.com/gabrielcolson/prisma-graphql.git

Quick start

First, you will need to setup your environment. You can use direnv:

cp .envrc.example .envrc
direnv allow

You will also need a PostgreSQL database. Here is how you can setup one using docker:

docker run                          \
    --name db                       \
    -e POSTGRES_PASSWORD=postgres   \
    -e POSTGRES_USER=postgres       \
    -p 5432:5432                    \
    -d                              \
    postgres

Then, create a new model in schema.prisma. Here is an example:

# prisma/schema.prisma
# ...

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
}

Save and apply the migration to your database:

npm install
npm run db:migrate:save
npm run db:migrate:up

Launch the tests:

npm test

Run the development server:

npm run dev

Now, you are good to go! Your local GraphQL Playground should be up. Enjoy!

About

Boilerplate for TypeScript GraphQL API using Prisma

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published