Giter Site home page Giter Site logo

checkbox-be's Introduction

Checkbox Service

This is a sample Checkbox Service built using NestJS and GraphQL with a PostgreSQL database, and utilizing Prisma ORM for database queries.

This is a project built with NestJS and PostgreSQL, using Prisma ORM and GraphQL with a code-first approach.

Note: please go to this link for detailed improvements

Tech Stack

  • NestJS: A progressive Node.js framework for building efficient and scalable web applications.
  • PostgreSQL: A powerful, open source object-relational database system.
  • Prisma: A modern ORM for TypeScript and Node.js that lets you access databases with a type-safe API.
  • GraphQL: A query language for APIs that provides a more efficient, powerful, and flexible alternative to REST.

Requirements

  • Node >= 14 <= 15
  • Docker
  • Docker compose
  • Postgres

Getting Started

Local

  1. Clone this repository to your local machine

  2. Install the dependencies by running npm install

  3. Run your Postgres database server.

  4. Create a .env file at the root of projects and set the following variable

POSTGRES_USERNAME=root
POSTGRES_PASSWORD=123
POSTGRES_DB=nestjs
POSTGRES_PATH=localhost

DATABASE_URL="postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_PATH}:5432/${POSTGRES_DB}?schema=public"
  1. Run npm run setup for first time application, this will generate necessary schema, do migration and seeding the database

  2. Run npm run start:dev to start the service in development mode

  3. Open http://localhost:3001/graphql in your web browser to access the GraphQL playground and explore the API.

  4. Run npx prisma studio to run the graphical UI prisma, and open http://localhost:5555

Docker

The easiest way to run the application locally is using docker

  1. Clone this repository to your local machine

  2. Create a .env file at the root of projects and set the following variable

POSTGRES_USERNAME=root
POSTGRES_PASSWORD=123
POSTGRES_DB=nestjs
POSTGRES_PATH=postgres

DATABASE_URL="postgresql://${POSTGRES_USERNAME}:${POSTGRES_PASSWORD}@${POSTGRES_PATH}:5432/${POSTGRES_DB}?schema=public"
  1. Run docker-compose up -f docker-compose-prod.yml --build

  2. Run inside your docker container docker exec -it <container_id> /bin/sh once inside the container run npm run seed. To seed database (Note: make sure your database is empty first you can run npx prisma migrate reset to clear database).

Docker already handle everything for you

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.