Skip to content

Latest commit

 

History

History
138 lines (93 loc) · 2.3 KB

README.md

File metadata and controls

138 lines (93 loc) · 2.3 KB

Miconomy API

Here you can find the backend api. Built with Nodejs, GraphQL and Prisma ORM.

Features

  • Apollo server: A GraphQL server library.
  • Nexus: Code-first library to generate schema for GraphQL servers
  • Prisma: Next generation of ORM to work with DB
  • Postgres: Database provider
  • Railway: Platform as a Service to deploy
  • Typescript: Programming language with typings
  • Jest: Test runner
  • Git hooks with Husky and Linted staged: To help checking test and formatters before a commit
  • ESLint: Validate the Typescript code style with best practices
  • Prettier: Formatter files with configured options

Used libraries

  • Sendgrid: Manage email sending
  • Bcrypt: Password hashing
  • JWT: JWT token

Prerequisites

  • Yarn
  • Latest NodeJS LTS version

Installation

  • Clone this repo
  • Run on terminal yarn to install dependencies
  • Copy the content from .env.example and update the corresponding values
  • Run on terminal yarn dev and start building

Available commands

Run development server

yarn dev

Generate production server

yarn build

Run a production server

yarn start

Run a GUI app to manage database models

yarn studio

Sync migrations for development server

yarn migrate:dev

Note: You should ensure to have the right credentials for the database on .env file.

Create migrations for development server

yarn migrate:dev --name NAME_OF_MIGRATION

Note: You should ensure to have the right credentials for the database on .env file.

Sync migrations for production/staging server

In this case, before run this command we should un/comment on the .env the right DB provider env

yarn migrate

Sync and generate prisma client from schema.prisma file

yarn generate:prisma

Sync and generate nexus typings from schema.ts file

yarn generate:nexus

Sync and generate prisma client and nexus typings code

yarn generate

Clean production folder

yarn clean

Run tests

yarn test

Run watching tests

yarn test:watch

Run linter on js and ts files

yarn lint

Run formatter on src folder

yarn fmt

Run formatter and linter

yarn pretty