intent: id: auth-system title: User Authentication System description: | Enable users to create accounts, log in securely, and manage their sessions. status: in_progress priority: high created: 2024-01-15T10:00:00Z
Intents are documented in .specs-fire/intents/{id}/brief.md:
# User Authentication System## ObjectiveEnable users to create accounts, log in securely, and manage sessions.## Context- New greenfield project- Expected 10k users at launch- Must support social login in future (not MVP)## Success Criteria- Users can register with email/password- Users can log in and receive session token- Sessions expire after 24 hours- Password reset via email works
Work items are documented in .specs-fire/intents/{intent-id}/work-items/{id}.md:
# Create User Database Schema## Definition of Done- [ ] Migration file created- [ ] User model with typed fields- [ ] Indexes on email field- [ ] Tests for model validation## Technical Notes- Use UUID for primary key- Add soft delete support- Email must be unique and indexed## DependenciesNone - first work item
# Run run-fabriqa-2026-001: user-schema## SummaryCreated user database schema with email/password authentication fields.## Files Changed### Created- `migrations/20240115_create_users.sql` - Users table with id, email, password_hash, created_at, updated_at - Unique index on email - Soft delete with deleted_at column- `src/models/user.ts` - User model class with TypeORM decorators - Password hashing on save - Email validation### Modified- `src/models/index.ts` - Added User export## Key Decisions- Used UUID for user IDs (portable across databases)- Added soft delete for GDPR compliance- bcrypt with cost factor 12 for password hashing## Verification Steps1. Run `npm run migrate` to apply schema2. Verify table: `SELECT * FROM information_schema.tables WHERE table_name = 'users'`3. Run tests: `npm test -- --grep "User model"`## Test Coverage- `tests/models/user.test.ts` - 4 tests added - Creates user with valid email - Rejects duplicate email - Hashes password on save - Supports soft delete