7676 ```
7777
78783 . ** Environment Configuration**
79- Create ` .env ` and ` .env.docker ` files with the following variables:
79+ The service includes a pre-configured ` .env.docker ` file with the following variables:
8080 ``` env
8181 # App Configuration
82- NODE_ENV=development
83- APP_NAME=NestJS Auth Service
84- APP_DEBUG=false
85- APP_CORS_ORIGINS=http://localhost:3000
82+ NODE_ENV="local"
83+ APP_NAME="@backendworks/auth"
84+ APP_CORS_ORIGINS="*"
85+ APP_DEBUG=true
8686
8787 # HTTP Configuration
8888 HTTP_ENABLE=true
89- HTTP_HOST=0.0.0.0
89+ HTTP_HOST=" 0.0.0.0"
9090 HTTP_PORT=9001
91- HTTP_VERSIONING_ENABLE=false
91+ HTTP_VERSIONING_ENABLE=true
9292 HTTP_VERSION=1
9393
9494 # Database Configuration
95- DATABASE_URL=postgresql://username:password @localhost:5432/auth_db
95+ DATABASE_URL=" postgresql://admin:master123 @localhost:5432/postgres?schema=public"
9696
9797 # JWT Configuration
98- ACCESS_TOKEN_SECRET_KEY=your-access-token-secret-key-min-32-chars
99- ACCESS_TOKEN_EXPIRED=15m
100- REFRESH_TOKEN_SECRET_KEY=your-refresh-token-secret-key-min-32-chars
101- REFRESH_TOKEN_EXPIRED=7d
98+ ACCESS_TOKEN_SECRET_KEY="EAJYjNJUnRGJ6uq1YfGw4NG1pd1z102J"
99+ ACCESS_TOKEN_EXPIRED="1d"
100+ REFRESH_TOKEN_SECRET_KEY="LcnlpiuHIJ6eS51u1mcOdk0P49r2Crwu"
101+ REFRESH_TOKEN_EXPIRED="7d"
102102
103103 # Redis Configuration
104- REDIS_URL=redis://localhost:6379
105- REDIS_KEY_PREFIX=auth:
104+ REDIS_URL=" redis://localhost:6379"
105+ REDIS_KEY_PREFIX=" auth:"
106106 REDIS_TTL=3600
107107
108108 # gRPC Configuration
109- GRPC_URL=0.0.0.0:50051
110- GRPC_PACKAGE=auth
111-
112- # Monitoring (Optional)
113- SENTRY_DSN=your-sentry-dsn
109+ GRPC_URL="0.0.0.0:50051"
110+ GRPC_PACKAGE="auth"
114111 ```
115112
1161134 . ** Database Setup**
@@ -154,22 +151,19 @@ docker run -p 9001:9001 auth-service
154151### Authentication Endpoints
155152
156153#### Public Endpoints
157- - ` POST /auth/signup ` - User registration
158154- ` POST /auth/login ` - User login
159- - ` POST /auth/refresh ` - Refresh access token
155+ - ` POST /auth/signup ` - User registration
156+ - ` GET /auth/refresh ` - Refresh access token
160157
161158#### Protected Endpoints
162- - ` GET /auth/profile ` - Get user profile
163- - ` PUT /auth/profile ` - Update user profile
164- - ` POST /auth/logout ` - User logout
159+ - ` GET /user/profile ` - Get user profile
160+ - ` PUT /user/profile ` - Update user profile
165161
166162### User Management Endpoints
167163
168164#### Admin Only
169- - ` GET /admin/users ` - List all users (paginated)
170- - ` GET /admin/users/:id ` - Get user by ID
171- - ` PUT /admin/users/:id ` - Update user
172- - ` DELETE /admin/users/:id ` - Delete user
165+ - ` GET /admin/user ` - List all users (paginated)
166+ - ` DELETE /admin/user/:id ` - Delete user
173167
174168### Health Check
175169- ` GET /health ` - Service health status
@@ -180,31 +174,6 @@ docker run -p 9001:9001 auth-service
180174### AuthService
181175- ` ValidateToken ` - Validate JWT tokens and return user information
182176
183- ## 🗄️ Database Schema
184-
185- ### User Model
186- ``` sql
187- CREATE TABLE users (
188- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
189- email VARCHAR UNIQUE NOT NULL ,
190- password VARCHAR ,
191- first_name VARCHAR ,
192- last_name VARCHAR ,
193- avatar VARCHAR ,
194- is_verified BOOLEAN DEFAULT false,
195- phone_number VARCHAR ,
196- role Role NOT NULL ,
197- created_at TIMESTAMP DEFAULT NOW(),
198- updated_at TIMESTAMP DEFAULT NOW(),
199- deleted_at TIMESTAMP
200- );
201- ```
202-
203- ### Role Enum
204- ``` sql
205- CREATE TYPE Role AS ENUM (' ADMIN' , ' USER' );
206- ```
207-
208177## 🔧 Configuration
209178
210179The service uses a modular configuration system with environment-specific settings:
0 commit comments