Coder Social home page Coder Social logo

kelley-sharp / node-prisma-graphql-backend-boilerplate Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 154 KB

Boilerplate for a Node, Prisma, and GraphQL backend using a Todo example entity

TypeScript 100.00%
express graphql node pothos prisma yoga-graphql docker

node-prisma-graphql-backend-boilerplate's Introduction

node-prisma-graphql-backend-boilerplate

Boilerplate for a Node, Prisma, and GraphQL backend using Todo as an example entity.

License & Purpose

MIT License. This is something I've used in production before with success that I found useful for quickly bootstrapping GraphQL APIs. You can fork and clone this without giving me any credit for anything.

If you like it, you can star the repo ⭐️ or follow me on GitHub.

Feel free to make an issue or PR if you want to suggest ideas / fixes.

About

This configuration is a backend GraphQL API boilerplate with the following pieces:

  • Docker as the container service to run your postgres server without installing postgres
  • Node.js (Long-Term-Support Version) as the run-time environment to run JavaScript
  • Express.js as the server framework / controller layer
  • GraphQL as the query language for your API, and a server-side runtime for running queries
  • Yoga as a lightweight GraphQL server
  • Prisma as an ORM that works well with Node.js and Typescript
  • Pothos a plugin based GraphQL schema builder for Typescript
  • ESLint a linter for your code editor
  • Prettier an opinionated code formatter

Getting Started

  1. Download and install Docker Desktop or Linux equivalent
  2. Clone/fork the repo, navigate to it in your terminal and run pnpm install
  3. Define POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD and DATABASE_URL in an .env file within the root directory. Read more about these variables here
  //example .env file contents
  POSTGRES_DB="todolistapp"
  POSTGRES_USER="username"
  POSTGRES_PASSWORD="password"
  DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@localhost:5432/${POSTGRES_DB}?schema=public"
  1. Run docker-compose up to start the container for your postgres server
  2. Server is accessible at http://localhost:8000. You can change the PORT in server.ts
  3. In a new tab, run pnpm prisma generate which uses the contents of schema.prisma to generate your Prisma Client
  4. Prisma comes with Prisma Studio, a GUI to read and manipulate data in your database from the browser. Run pnpm prisma studio to open

node-prisma-graphql-backend-boilerplate's People

Contributors

kelley-sharp avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.