The User Management API is designed to provide robust user authentication and management functionalities. This API enables users to perform essential operations such as registration, login, password recovery, etc. Additionally, it includes an admin-only CRUD for managing user accounts.
The primary goal of this project was to enhance backend development skills by implementing a comprehensive user management system. This includes sophisticated authentication mechanisms and administrative capabilities to manage users effectively. The combination of NestJS, Docker, Prisma and PostgreSQL ensures a modern, scalable, and maintainable solution.
Also there is a branch using TypeORM and MySQL instead Prisma and PostgreSQL, just for learning purposes. you can check it out here.
- NestJS
- NodeJS
- TypeScript
- JWT
- bcrypt
- class-validator
- class-transformer
- zod
- NestJS Mailer
- pug
- Jest
- Supertest
- dotenv-cli
- Prisma
- PostgreSQL
- Docker
- Eslint
- Prettier
- Husky
- Commitlint
User Authentication
- Registration
- Login
- Avatar Upload
- Update Completely
- Update Partially
- Password Recovery
Admin CRUD
- Register User
- Read All Users
- Read User
- Update User Completely
- Update User Partially
- Delete User
Make sure you have Docker installed on your machine.
# Run database container
docker compose -f docker-compose.dev.yml up -d
# Install dependencies
pnpm install
# Apply migration and generate prisma client
pnpm p-mg
# Start the development server
pnpm dev
API will be running on http://localhost:3000
βββ .husky
βββ .vscode
βββ prisma
βββ src
βββ auth
βββ common
βββ decorators
βββ env
βββ file
βββ guards
βββ interceptors
βββ prisma
βββ system
βββ templates
βββ test
βββ user
Folder | Description |
---|---|
.husky | Git hooks managed by Husky. |
.vscode | VSCode settings . |
prisma | Prisma config such as schema, migrations and seed. |
auth | Auth related files to manage user authentication. |
common | Reusable utilities and constants. |
decorators | Custom decorators. |
env | Env related files to manage environment variables. |
file | File related files to manage file operations. |
guards | Custom guards. |
interceptors | Custom interceptors. |
prisma | Prisma service to interact with the database. |
system | System related files to manage system operations. |
templates | Email templates. |
test | Test related files. |
user | User related files to manage user operations. |
# Run all tests
pnpm test:all
# Run prisma generate
pnpm p-gen
# Run prisma migrate
pnpm p-mg
# Run prisma migrate reset
pnpm p-mg-reset
# Run prisma seed
pnpm p-seed
# Set environment to production
pnpm env:prod
# Set environment to development
pnpm env:dev
# Set environment to test
pnpm env:test
# Run prisma migrate in production environment
pnpm p-mg:prod
# Run prisma migrate in development environment
pnpm p-mg:dev
# Run prisma migrate in test environment
pnpm p-mg:test
# Run prisma migrate reset in development environment
pnpm p-mg-reset:dev
# Run prisma migrate reset in test environment
pnpm p-mg-reset:test
# Run prisma seed in production environment
pnpm p-seed:prod
# Run prisma seed in development environment
pnpm p-seed:dev
# Run prisma seed in test environment
pnpm p-seed:test
# Commit staged changes
pnpm commit
Made with π€ by Arthur