An open API service indexing awesome lists of open source software.

https://github.com/francislagares/node-code-assessment

This is a Node.js REST API assessment to evaluate tech skills.
https://github.com/francislagares/node-code-assessment

express mongodb nodejs oop prisma redis-cache rest-api typescript

Last synced: 2 months ago
JSON representation

This is a Node.js REST API assessment to evaluate tech skills.

Awesome Lists containing this project

README

          

![node-typescript-express-starter](https://res.cloudinary.com/chatty-app/image/upload/v1683311364/node-typescript_qngr0k.webp)

# Node TypeScript Express Boilerplate

Starter Node.js project with TypeScript, MongoDB, Prisma ORM, ESlint, Prettier and Husky.

Features
--------
- **OOP**
- **Typescript**
- **MongoDB**
- **Prisma ORM**
- **Redis in-memory cache**
- **Swagger documentation**
- **class-validator** for validating controller json input
- **ES6 next features**

Prerequisites
-------------

- [Node.js 20 or higher](http://nodejs.org)
- [NPM 9.5.6 or higher](https://www.npmjs.com/)
- [MongoDB](https://www.mongodb.org/downloads)
- [Docker](https://docs.docker.com/desktop/install/linux-install/)
- [Docker Compose](https://docs.docker.com/compose/install/)

# Docker

- First create MongoDB database

```bash
$ docker compose -f docker-compose-mongodb.yaml up -d
```

- Right after create a Redis instance

```bash
$ docker compose -f docker-compose-redis.yaml up -d
```

## Run the Project
----------------

- Install the dependencies by running the following command.

```bash
yarn install
```

- Start the development server:

```bash
yarn start:dev
```

- Start the test suites:

```bash
yarn test
```

## Run the Project with PM2
----------------------------

PM2 is a Node.js process manager that comes with a built-in load balancer. It helps facilitate production deployments and enables you to keep running applications alive indefinitely.

These are the commands to run the application with PM2:

- Start development environment:

```bash
yarn deploy:dev
```

- Start production environment:

```bash
yarn deploy:prod
```
A logs folder will automatically be created at root level for all your running applications.

You can check the logs by with the following command:

```bash
npx pm2 logs
```
For a more detailed information check the docs -- [PM2](https://pm2.keymetrics.io/)
## API Docs
------------

You can check all API endpoints auto-generated by Swagger docs:
[http://localhost:4000/api-docs](http://localhost:4000/api-docs)

# Author

Created by [@francislagares](https://www.linkedin.com/in/francislagares/) - feel free to contact me!
*