Skip to content

paperbook-official/api.nestjs.paperbook

Repository files navigation


Icon

Description

The project consists of an online platform for buying and selling books and stationery. Written with Typescript the backend provides the necessary data for the application frontend.


Getting started

First you must to clone the repository using:

$ git clone 'https://github.com/paperbook-official/api.nestjs.paperbook.git'

After that install all the needed dependencies with:

$ npm install -g @nestjs/cli

$ npm install

This project uses husky's commit-msg hook and commitlint. For using them run the following commands:

$ npx husky install

$ npx husky add .husky/commit-msg 'npx --no-install commitlint --edit $1'

Running the app

# development
$ nest start

# watch mode
$ nest start --watch

# production mode
$ nest start --prod

Docker

The application uses Docker and it can be runned using the follwing:

$ sudo docker-compose -up

Databases

SQLite

To test this application, SQlite database can be used, it is added in dependencies by default. To use simply run any of the application startup commands shown above.

obs: You must not forget of setting up the .env file

Postgres

The PostgreSQL is used for production environments.


Migrations

For creating a new migration run the command:

$ npm run typeorm:migrate MIGRATION_NAME

And for executing all the migrations run:

$ npm run typeorm:run

Structure

Always, when creating a new entity, create a folder in 'src/modules' with the entity name (Ex: 'src/modules/product' ). Inside the folder, it must have the following structure:

  • product
    • controllers (All the controllers related with products)
      • product.controller.ts
    • services (All the services related with products)
      • service.controller.ts
    • entities (All the entities related with products)
      • product.entity.ts
    • models (All the models related with products)
      • create-product.dto.ts
      • product.dto.ts
      • update-product.dto.ts
    • product.module.ts

Authentication

This project has only one authentication method, the local. Basically login to the application can be done using the user's email and password.


Swagger

The backend is integrated with Swagger API, allowing the developer to view and test the API routes.

To use this put in browser url the following:

API_ENDPOINT/swagger

Sentry

The application is also integrated with Sentry this way it allows tracking exceptions and storing them.


License

Paperbook API is MIT licensed.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages