❯ Template developed by Artur Schincariol Rossi
❯ Base backend template for building application with the Fastify framework.
- Code formatters && Linters (Eslint + Prettier)
- API Documentation (w/ Swagger)
- Database on container (Docker)
- Rate Limit
- Security Headers
- Authentication System w/ Bcrypt and JWT Token (using HTTP Only Cookies)
- Unit Tests w/ Vitest
-
Task 1
: Implement a password recovery system using nodemailer for sending emails
└── template-backend-nodejs/
├── LICENSE
├── README.md
├── docker-compose.yml
├── misc
│ └── Insomnia.json
├── package-lock.json
├── package.json
├── prisma
│ ├── migrations
│ ├── schema.prisma
│ └── seed.ts
├── src
│ ├── @types
│ ├── config
│ ├── controllers
│ ├── error-handler.ts
│ ├── libs
│ ├── middlewares
│ ├── mocks
│ ├── schemas
│ └── server.ts
├── tsconfig.json
└── vitest.config.ts
- NodeJS
- Fastify
- Typescript
- PostgreSQL
- Docker
- Prisma ORM
- Bcrypt
- JsonWebToken
- Swagger
- Zod
- Prettier && Eslint
Before getting started with template-backend-nodejs, ensure your runtime environment meets the following requirements:
- Version Control System: Git
- Javascript Runtime: NodeJS
- Package Manager: Npm (Installed with NodeJS)
- Container Runtime: Docker
- Clone the template-backend-nodejs repository:
❯ git clone https://github.com/Artursrossi/template-backend-nodejs
- Navigate to the project directory:
❯ cd template-backend-nodejs
❯ npm install
❯ docker-compose up -d
Set the environment variables by creating a .env file using .env.example
Generate a random string for the JWT_SECRET variable by the following command:
Using nodejs
❯ node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
Configure Database Schema:
❯ npx prisma generate
❯ npx prisma db push
❯ npm run seed
Run template-backend-nodejs using one of the following methods:
Development environment:
❯ npm run dev
Production environment:
❯ npm run build
❯ npm run start
Run the test suite using the following command:
Using npm
❯ npm test