Aqtoni / NestCRUD

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NestJS Prisma PostgreSQL TypeORM Docker

A Backend application based on NestJS, where PostgreSQL acts as a database, to control the base used Prisma. Also Using passport.js, and json web tokens (JWT). There is also e2e tests in the tests folder. You can running Database from Docker 🐬 And you can run a second database for tests. In file package.json there is a command for this.

NestJS
NestJS
PostgresSQL
PostgresSQL
Docker
Docker
Prisma
Prisma

Key Features

  • Authentication and Authorization
    • Sign Up
    • Login
  • Bookmarks
    • User can create a bookmarks
    • Create bookmarks, get, update, delete.
  • User
    • Create user, update and change password.

API Usage

Check Bookmarks API Documentation for more info.📗 In postman create a global variable jwt for token, and in test write this code: In the authorization section, select the type of token "Bearer Token" and write a variable {{jwt}}. It will automatically refresh the token.

const token = pm.response.json().tokens.access;
pm.globals.set("jwt", token);

Installation and launch method

Stars the Prisma

To start the Prisma run this command

$ npx prisma generate

You can also run Prisma Studio, by default Prisma run on localhost:5555

$ npx prisma studio

In file .env enter your environment variables

Using Docker

Follow the command:

docker-compose up
# -d - For launch in the background
# --build - for build containers

Without Docker

  • Install postgreSQL with an official site
  • Create a server copy and database, add the user and password as indicated in the .env file
  • Make sure PostgreSQL is launched and works
  • Install dependencies

Shell command

# yarn package manager
yarn install
yarn start

# npm package manager
npm install
npm run start

About


Languages

Language:TypeScript 97.0%Language:JavaScript 3.0%