woaru
Version:
Universal Project Setup Autopilot - Analyze and automatically configure development tools for ANY programming language
105 lines (92 loc) • 3.51 kB
YAML
woaru_context:
file_purpose: "Core service class that manages user authentication and session handling"
file_type: "service_class"
complexity_level: "medium"
main_responsibilities:
- "User login/logout workflow management"
- "JWT token generation and validation"
- "Session persistence and cleanup"
- "Password hashing and verification"
tech_stack:
language: "typescript"
framework: "express"
database: "postgresql"
auth_system: "jwt"
testing: "jest"
key_dependencies:
external:
- "bcrypt: Password hashing"
- "jsonwebtoken: JWT handling"
- "express-session: Session management"
internal:
- "src/models/User.ts: User data model"
- "src/utils/crypto.ts: Encryption utilities"
- "src/config/database.ts: DB connection"
architectural_role: "authentication_layer"
design_patterns:
- "Singleton (for UserService instance)"
- "Factory (for token generation)"
- "Strategy (for different auth methods)"
related_files:
controllers:
- "src/controllers/AuthController.ts: Uses this service for auth endpoints"
middleware:
- "src/middleware/authMiddleware.ts: Validates tokens generated here"
tests:
- "tests/services/UserService.test.ts: Comprehensive test suite"
config:
- "src/config/auth.config.ts: Authentication configuration"
business_impact: "critical"
user_facing: true
data_sensitivity: "high"
security_critical: true
modification_frequency: "medium"
testing_coverage: "90%"
performance_critical: true
public_interface:
methods:
- "login(email, password): Promise<AuthResult>"
- "logout(userId): Promise<void>"
- "validateToken(token): Promise<User | null>"
- "refreshToken(refreshToken): Promise<TokenPair>"
events:
- "user:login"
- "user:logout"
- "token:expired"
data_flow:
inputs:
- "User credentials from AuthController"
- "Session data from middleware"
outputs:
- "JWT tokens to client"
- "User session data to cache"
side_effects:
- "Database writes for login logs"
- "Cache updates for session data"
environment_variables:
- "JWT_SECRET: Token signing key"
- "SESSION_TIMEOUT: Session duration"
- "BCRYPT_ROUNDS: Password hashing strength"
known_issues:
- "Race condition in concurrent login attempts (Issue #123)"
- "Memory leak in session cleanup (scheduled for v2.1)"
generated_by: "woaru docu ai"
generated_at: "2025-07-14T21:45:00Z"
schema_version: "1.0"
last_updated: "2025-07-14T21:45:00Z"