GithubHelp home page GithubHelp logo

mahdipakravan-dev / mahdipakravan-website_backend Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 165 KB

backend of mahdipakravan website , developed by nest.js and pg

License: MIT License

JavaScript 9.95% Dockerfile 0.33% Shell 1.59% TypeScript 88.13%

mahdipakravan-website_backend's Introduction

NestJS Boilerplate Nest Logo

Description

NestJS Boilerplate made with ❤️ by 💡VivifyIdeas💡.

Start Guide

Outside Docker containers

  • Create .env file cp .env.example .env and replace existing env variables (mysql/mariadb connection params)
  • Install dependencies yarn
  • Start the app yarn start (app will be exposed through the port 3000)

Inside Docker containers

Just run already prepared bash script:

$ ./init

It will setup the project for you (starting docker-compose stack, running migrations). The NestJS app running in dev mode will be exposed on http://localhost (port 80)

For IDE autocompletion to work, run yarn on the host machine.

TypeORM integrated

TypeORM gives you possibility to use next db types: mysql, postgres, mariadb, sqlite, etc. Please look at docs for more details. The docker-compose template uses mariadb.

Migrations

If you don't work on a production-ready project you can always change DB_SYNC env variable to true so you can play with NestJS without the need to write actual migrations.

synchronize: true shouldn't be used in production - otherwise, you can lose production data.

Create Migration

Creating new migration is relatively easy and you can use typeorm CLI for that. You can run this command to create new migration:

$ docker exec -it nest yarn migration:create -n {CreateTableUsers}

Migration file will be placed under src/migrations. For more details check the existing 1611484925515-CreateUsersTable.ts

Run Migrations

$ docker exec -it nest yarn migration:run

Revert Migrations

$ docker exec -it nest yarn migration:revert

Test

# unit tests
$ docker exec -it nest yarn test

# e2e tests
$ docker exec -it nest yarn test:e2e

# test coverage
$ docker exec -it nest yarn test:cov

Environment Configuration

Integrated Configuration Module so you can just inject ConfigService and read all environment variables from .env file, which is created automatically by the init script from .env.example.

Swagger

RESTful APIs you can describe with already integrated Swagger. To see all available endpoints visit http://localhost/api/docs

Authentication - JWT

Already preconfigured JWT authentication. It's suggested to change current password hashing to something more secure. You can start use already working implementation of Login and Registration endpoints, just take a look at http://localhost/api/docs.

mahdipakravan-website_backend's People

Contributors

mahdipakravan-dev avatar

Stargazers

 avatar

Watchers

 avatar

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.