@@ -4,31 +4,31 @@ A microservice for handling user authentication and authorization in the NestJS
44
55## 🚀 Features
66
7- - ** User Authentication** : JWT-based authentication with access and refresh tokens
8- - ** User Management** : CRUD operations for user accounts
9- - ** Role-based Authorization** : Support for ADMIN and USER roles
10- - ** gRPC Microservice** : Inter-service communication via gRPC
11- - ** REST API** : HTTP endpoints for authentication operations
12- - ** Database Integration** : PostgreSQL with Prisma ORM
13- - ** Caching** : Redis-based caching for performance
14- - ** Internationalization** : Multi-language support with nestjs-i18n
15- - ** API Documentation** : Swagger/OpenAPI documentation
16- - ** Health Checks** : Built-in health monitoring
17- - ** Security** : Helmet security headers, CORS configuration
7+ - ** User Authentication** : JWT-based authentication with access and refresh tokens
8+ - ** User Management** : CRUD operations for user accounts
9+ - ** Role-based Authorization** : Support for ADMIN and USER roles
10+ - ** gRPC Microservice** : Inter-service communication via gRPC
11+ - ** REST API** : HTTP endpoints for authentication operations
12+ - ** Database Integration** : PostgreSQL with Prisma ORM
13+ - ** Caching** : Redis-based caching for performance
14+ - ** Internationalization** : Multi-language support with nestjs-i18n
15+ - ** API Documentation** : Swagger/OpenAPI documentation
16+ - ** Health Checks** : Built-in health monitoring
17+ - ** Security** : Helmet security headers, CORS configuration
1818
1919## 🏗️ Architecture
2020
2121### Technology Stack
2222
23- - ** Framework** : NestJS 10.x
24- - ** Language** : TypeScript 5.x
25- - ** Database** : PostgreSQL with Prisma ORM
26- - ** Cache** : Redis with cache-manager
27- - ** Authentication** : JWT with Passport.js
28- - ** API Documentation** : Swagger/OpenAPI
29- - ** Microservice** : gRPC communication
30- - ** Validation** : class-validator and class-transformer
31- - ** Testing** : Jest
23+ - ** Framework** : NestJS 10.x
24+ - ** Language** : TypeScript 5.x
25+ - ** Database** : PostgreSQL with Prisma ORM
26+ - ** Cache** : Redis with cache-manager
27+ - ** Authentication** : JWT with Passport.js
28+ - ** API Documentation** : Swagger/OpenAPI
29+ - ** Microservice** : gRPC communication
30+ - ** Validation** : class-validator and class-transformer
31+ - ** Testing** : Jest
3232
3333### Service Structure
3434
5757
5858## 📋 Prerequisites
5959
60- - Node.js >= 18.0.0
61- - npm >= 9.0.0
62- - PostgreSQL
63- - Redis
60+ - Node.js >= 18.0.0
61+ - npm >= 9.0.0
62+ - PostgreSQL
63+ - Redis
6464
6565## 🛠️ Installation
6666
@@ -159,82 +159,76 @@ docker run -p 9001:9001 auth-service
159159
160160# ### Public Endpoints
161161
162- - ` POST /auth/login` - User login
163- - ` POST /auth/signup` - User registration
164- - ` GET /auth/refresh` - Refresh access token
162+ - ` POST /auth/login` - User login
163+ - ` POST /auth/signup` - User registration
164+ - ` GET /auth/refresh` - Refresh access token
165165
166166# ### Protected Endpoints
167167
168- - ` GET /user/profile` - Get user profile
169- - ` PUT /user/profile` - Update user profile
168+ - ` GET /user/profile` - Get user profile
169+ - ` PUT /user/profile` - Update user profile
170170
171171# ## User Management Endpoints
172172
173173# ### Admin Only
174174
175- - ` GET /admin/user` - List all users (paginated)
176- - ` DELETE /admin/user/:id` - Delete user
175+ - ` GET /admin/user` - List all users (paginated)
176+ - ` DELETE /admin/user/:id` - Delete user
177177
178178# ## Health Check
179179
180- - ` GET /health` - Service health status
181- - ` GET /` - Service information
180+ - ` GET /health` - Service health status
181+ - ` GET /` - Service information
182182
183183# # 🔌 gRPC Services
184184
185185# ## AuthService
186186
187- - ` ValidateToken` - Validate JWT tokens and return user information
187+ - ` ValidateToken` - Validate JWT tokens and return user information
188188
189189# # 🔧 Configuration
190190
191191The service uses a modular configuration system with environment-specific settings:
192192
193193# ## App Configuration
194194
195- - ** Name** : Service name and display information
196- - ** Environment** : Development, staging, production
197- - ** Debug** : Debug mode settings
198- - ** CORS** : Cross-origin resource sharing settings
195+ - ** Name** : Service name and display information
196+ - ** Environment** : Development, staging, production
197+ - ** Debug** : Debug mode settings
198+ - ** CORS** : Cross-origin resource sharing settings
199199
200200# ## HTTP Configuration
201201
202- - ** Port** : HTTP server port (default: 9001)
203- - ** Host** : HTTP server host
204- - ** Versioning** : API versioning settings
202+ - ** Port** : HTTP server port (default: 9001)
203+ - ** Host** : HTTP server host
204+ - ** Versioning** : API versioning settings
205205
206206# ## JWT Configuration
207207
208- - ** Access Token** : Secret key and expiration time
209- - ** Refresh Token** : Secret key and expiration time
208+ - ** Access Token** : Secret key and expiration time
209+ - ** Refresh Token** : Secret key and expiration time
210210
211211# ## Database Configuration
212212
213- - ** URL** : PostgreSQL connection string
214- - ** Migrations** : Database migration settings
213+ - ** URL** : PostgreSQL connection string
214+ - ** Migrations** : Database migration settings
215215
216216# ## Redis Configuration
217217
218- - ** URL** : Redis connection string
219- - ** Key Prefix** : Cache key prefix
220- - ** TTL** : Cache time-to-live
218+ - ** URL** : Redis connection string
219+ - ** Key Prefix** : Cache key prefix
220+ - ** TTL** : Cache time-to-live
221221
222222# ## gRPC Configuration
223223
224- - ** URL** : gRPC server address
225- - ** Package** : Protocol buffer package name
224+ - ** URL** : gRPC server address
225+ - ** Package** : Protocol buffer package name
226226
227227# # 🧪 Testing
228228
229229` ` ` bash
230230# Run all tests
231231npm test
232-
233- # Run tests in watch mode
234- npm run test:watch
235-
236- # Run tests with coverage
237- npm run test:cov
238232` ` `
239233
240234# # 📚 API Documentation
@@ -247,20 +241,20 @@ http://localhost:9001/docs
247241
248242## 🔒 Security Features
249243
250- - **JWT Authentication**: Secure token-based authentication
251- - **Password Hashing**: bcrypt password hashing
252- - **Role-based Access Control**: ADMIN and USER roles
253- - **Helmet Security**: Security headers
254- - **CORS Protection**: Cross-origin request protection
255- - **Input Validation**: Request validation with class-validator
256- - **Rate Limiting**: Built-in rate limiting (configurable)
244+ - **JWT Authentication**: Secure token-based authentication
245+ - **Password Hashing**: bcrypt password hashing
246+ - **Role-based Access Control**: ADMIN and USER roles
247+ - **Helmet Security**: Security headers
248+ - **CORS Protection**: Cross-origin request protection
249+ - **Input Validation**: Request validation with class-validator
250+ - **Rate Limiting**: Built-in rate limiting (configurable)
257251
258252## 📊 Monitoring
259253
260- - **Health Checks**: Built-in health monitoring endpoints
261- - **Sentry Integration**: Error tracking and monitoring
262- - **Logging**: Structured logging with Winston
263- - **Metrics**: Performance metrics collection
254+ - **Health Checks**: Built-in health monitoring endpoints
255+ - **Sentry Integration**: Error tracking and monitoring
256+ - **Logging**: Structured logging with Winston
257+ - **Metrics**: Performance metrics collection
264258
265259## 🚀 Deployment
266260
0 commit comments