2.1.1 • Published 6 years ago
graphql-boilerplate v2.1.1
A GraphQL-Prisma Boilerplate
npm i -g graphql-boilerplate
graphql-boilerplate .
# Generate boilerplate in current directory.
graphql-boilerplate <DIRNAME>
# make that directory Generate boilerplate in it.
Quick Start
First make sure you have Heroku-CLI and Docker and PG Admin installed
Setup a postgres server on the cloud we can use heroku postgres addon as it's have free tier to get started with postgressql. After setting up postgres on cloud change the database default in docker-compose.yml file with yours.
npm install -g prisma@1.13.4
# Install prisma-cli globally
cd prisma
docker-compose up -d
# executing this command will fire up a docker container using your docker-compose file.
prisma deploy -e ../config/dev.env
# Before executing this command it's recommended to change config files PRISMA_ENDPOINT to your <Application Name>/Environment by default it's set service/dev you can change it to <Application Name>/dev so we can differentiate easily later on using PG Admin after executing this command it will start a prisma server at http://localhost:4466/service/dev
prisma deploy -e ../config/test.env
# deploying for test environment
npm install
npm run get-schema
# make sure to change .graphqlconfig file endpoint with your respective development endpoint so It can get new schema when deploy changes from prisma/datamodel.graphql
npm run test
# To check if all things are working correctly
npm run dev
# This will start a node server at PORT:4000 which talk to your prisma-graphql server which give us a great layer of abstraction to ease our development
Production Deployment
To deploy the application in production first we need to setup prisma server on cloud we can use Prisma Cloud just to do it's provide a great layer of abstraction to setup prisma server on the cloud within few click and it's come with free tier to get you started.
After deploying prisma server on cloud it change config/prod.env PRISMA_ENDPOINT with your URL
prisma deploy -e ../config/prod.env
# It deploys your prisma server on the cloud
heroku login
# login into heroku with credentials
heroku create
# create a new heroku app
git push heroku
# this will deploy your node application on heroku servers.