app-server

Template for web application based on Angular for the frontend an Nest for the backend. It includes: user authentication and management via JWT and device detection; authorization management via CASL; GraphQL for query endpoints; Mongoose for connecting wiht MongoDB and filtering, sorting and pagination structures. This is the back-end.

MIT License

Stars
2
Committers
1

App 2024

On this project we had the backend code.

It's a Nest project that serves the app-client via Express. It uses GraphQL for query the application endpoints, JWT for authentication via token, with device-detector-js for secure sessions, CASL for authorization management, TypeORM for database schema and queries, and class-validator for specific attributes validations. By default it's conneted to a PostgreSQL datasource, but it can be used with most databases (including MySQL, MongoDB, SQLServer, MariaDB, etc).

Setup

  1. Install Node.js
  2. Install the DBMS you want, by default install PostgreSQL
  3. From project root folder install all the dependencies: npm install
  4. For serve app-client, it must be located at sibling folder of this project, as shown:
app
└─ app-client
└─ app-server
   └─ uploads (this is where server saves users uploaded files)

Run

Development

Run npm start: execute nest start that compiles and runs the server and put it listening at localhost:3000

Run npm run start:dev: execute nest start --watch that compiles and runs the server and put it listening at localhost:3000 and any change automatically re-compiles and restart server.

Production

Run npm run build: execute nest build that generates dist folder at the project root folder for been used with node command.

Run npm run start:prod: execute node command over dist/main folder to start server listening at localhost:3000.