Skip to content

This boilerplate follows clean architecture with SOLID principles. This sample define a simple user schema and handle two endpoints that allows users to create new accounts and login by them. There is also a middleware to validate JWT tokens that are provided by clients with `Bearer` authorization header.

Notifications You must be signed in to change notification settings

mattnix4/express-prisma-postgresql-boilerplate

 
 

Repository files navigation

Boilerplate for express, postgresql, prisma and typescript

This boilerplate follows clean architecture with SOLID principles. This sample define a simple user schema and handle two endpoints that allows users to create new accounts and login by them. There is also a middleware to validate JWT tokens that are provided by clients with Bearer authorization header.

Technologies

  • Environment: Nodejs
  • Language: Typescript
  • Framework: Expressjs
  • ORM: Prisma
  • Database: Postgresql
  • Authentication: Basic, JWT
  • Inversion Of Control (D in SOLID): Awillix
  • Password hash library: bcryptjs

Prequisite

  • Create the .env file by copying the .env.example file
  • Database:
    • The easy way to have a Postgresql server is using docker or you can use Postgreql cloud
    • Once you have the database connection URL, replace the sample one in the .env file by yours
  • Install dependencies
npm install
  • Initialize database schema
npx prisma migrate dev --name "init" --preview-feature

Docker build

docker build -t app-name .

NPM scripts

  1. Run dev
npm run dev
  1. Linting
npm run lint
  1. Build
npm run build
  1. Run production
npm run start

About

This boilerplate follows clean architecture with SOLID principles. This sample define a simple user schema and handle two endpoints that allows users to create new accounts and login by them. There is also a middleware to validate JWT tokens that are provided by clients with `Bearer` authorization header.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 94.4%
  • Dockerfile 2.7%
  • JavaScript 2.4%
  • Shell 0.5%