https://github.com/giuliano-marinelli/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.
https://github.com/giuliano-marinelli/app-server
casl device-detector-js graphql jwt nest postgres typeorm
Last synced: 4 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/giuliano-marinelli/app-server
- Owner: giuliano-marinelli
- License: mit
- Created: 2024-01-26T19:54:50.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-13T14:07:03.000Z (about 1 year ago)
- Last Synced: 2025-01-12T07:09:07.497Z (5 months ago)
- Topics: casl, device-detector-js, graphql, jwt, nest, postgres, typeorm
- Language: TypeScript
- Homepage:
- Size: 922 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# App _2024_
_On this project we had the **backend** code._
It's a [Nest](https://nestjs.com/) project that serves the [app-client](https://github.com/giuliano-marinelli/app-client) via [Express](https://expressjs.com). It uses [GraphQL]() for query the application endpoints, [JWT](https://jwt.io/) for authentication via token, with [device-detector-js](https://github.com/etienne-martin/device-detector-js) for secure sessions, [CASL](https://casl.js.org/) for authorization management, [TypeORM](https://typeorm.io/) for database schema and queries, and [class-validator](https://github.com/typestack/class-validator) for specific attributes validations. By default it's conneted to a [PostgreSQL](https://www.postgresql.org/) datasource, but it can be used with most databases (including [MySQL](https://www.mysql.com/), [MongoDB](https://www.mongodb.com/), [SQLServer](https://www.microsoft.com/es-es/sql-server), [MariaDB](https://mariadb.org/), etc).
## Setup
1. Install [Node.js](https://nodejs.org)
2. Install the DBMS you want, by default install [PostgreSQL](https://www.postgresql.org/)
3. From project root folder install all the dependencies: `npm install`
4. For serve [app-client](https://github.com/giuliano-marinelli/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](https://docs.nestjs.com/cli/usages#nest-start) that compiles and runs the server and put it listening at [localhost:3000](http://localhost:3000)
Run `npm run start:dev`: execute [nest start --watch](https://docs.nestjs.com/cli/usages#nest-start) that compiles and runs the server and put it listening at [localhost:3000](http://localhost:3000) and any change automatically re-compiles and restart server.
### Production
Run `npm run build`: execute [nest build](https://docs.nestjs.com/cli/usages#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](http://localhost:3000).