Skip to content

marshall8526/user-auth-service

Repository files navigation

User Auth Service

NestJS authentication service with PostgreSQL, Redis and Drizzle ORM.

Quick Start

1. Run Docker Compose

docker-compose up -d

2. Install dependencies

npm install

3. Setup environment variables

Create .env file:

DATABASE_URL=postgresql://service:servicepwd@localhost:5432/auth
JWT_SECRET=strong-secret

4. Run Drizzle migrations

npx drizzle-kit push

5. Start the project

# Development
npm run start:dev

# Production
npm run start:prod

Testing

Unit Tests

npm run test

E2E Tests

npm run test:e2e

API Endpoints

POST /auth/register

Register new user

  • Body: { username: string, email: string, password: string, fullName: string }
  • Response: UserResponseDto

POST /auth/login

User login

  • Body: { email: string, password: string }
  • Response: LoginResponseDto (with JWT token)

GET /auth/profile

Get user profile (requires JWT token)

  • Headers: Authorization: Bearer <token>
  • Response: UserResponseDto

About

test assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors