mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
## Major Accomplishments ### ✅ Authentication System (ARC-003) - COMPLETED - **Full NestJS Auth Module**: Complete authentication system with JWT, OAuth, and RBAC - **Type-Safe API Responses**: Comprehensive DTO system with Swagger documentation - **Web Integration**: Successfully integrated web frontend with NestJS API endpoints - **Security Hardening**: Fixed authentication vulnerabilities and implemented proper patterns ### ✅ Database Integration (ARC-003B) - COMPLETED - **Entity Mapping**: Complete TypeORM entities for User, Profile, Personalization, Roles - **Migration System**: Hybrid approach using existing Postgrator system - **Schema Compatibility**: Both Express and NestJS APIs access same database ### ✅ Development Environment Optimization - **Performance Boost**: 25-50x faster cold starts (30-60s → 1.2s) - **Turbopack Integration**: Next.js 13.5+ experimental bundler enabled - **Sentry Disabled**: Clean development logs and faster builds - **Docker Optimization**: Streamlined development workflow ## Technical Details ### Authentication Features Implemented - JWT token generation and validation - Email/password login and registration - OAuth structure (Google, Apple) - ready for testing - Role-based access control (RBAC) - Comprehensive error handling with typed responses - CORS configuration for web frontend ### Web Frontend Integration - Updated API endpoints to /api/v2 prefix - Fixed authentication flow with proper JSON responses - Eliminated backend redirects (anti-pattern) - Client-side navigation based on API responses - CORS and CSP optimizations ### Performance Improvements - Turbopack bundler: 20-40x faster cold starts - SWC minification: Rust-based compilation - Filesystem caching: Persistent across restarts - Smart code splitting: Vendor, Radix UI, Phosphor icons - Import optimization: Tree-shaking for icon libraries ## Testing Status - ✅ Email/password login: Working - ✅ User registration: Working - ⏳ Google OAuth: Ready for testing - ⏳ Apple OAuth: Ready for testing - ⏳ Email verification: Pending email service integration ## Next Phase Recommendations 1. **Vite Migration**: Consider migrating from Next.js to Vite for 50-100x performance gains 2. **GraphQL Setup**: Begin ARC-004 for GraphQL module implementation 3. **OAuth Testing**: Complete Google/Apple authentication testing 4. **Email Service**: Integrate email verification system ## Files Changed - Complete NestJS authentication system (100+ files) - Web frontend integration and optimization - Docker development environment - Performance optimizations and Sentry configuration - Comprehensive documentation and migration tracking This commit represents a major milestone in the Express-to-NestJS migration, establishing a solid foundation for continued development.
3 KiB
3 KiB
C4 Level 3: API Component View
The API package (packages/api) currently co-locates Express routers, Apollo resolvers, and service classes. Responsibilities bleed across files, but natural seams already exist that map well to NestJS modules.
graph TB
subgraph API[API Process]
direction LR
AuthRouter[/REST: Auth & Mobile Auth/]
ContentRouter[/REST: Content & Article Save/]
DigestRouter[/REST: Digests & Email/]
GraphQL[Apollo GraphQL Schema]
TaskRouter[/REST: Admin Tasks/]
IntegrationRouter[/REST: Integrations/]
ServiceLayer[[Domain Services]]
DataAccess[(TypeORM Repositories)]
QueueClients[[BullMQ Producers]]
ExternalSDKs[[3rd-party SDKs]]
end
AuthRouter --> ServiceLayer
ContentRouter --> ServiceLayer
DigestRouter --> ServiceLayer
IntegrationRouter --> ServiceLayer
TaskRouter --> ServiceLayer
GraphQL --> ServiceLayer
ServiceLayer --> DataAccess
ServiceLayer --> QueueClients
ServiceLayer --> ExternalSDKs
QueueClients --> RedisQueue[(Redis / BullMQ)]
DataAccess --> Postgres[(PostgreSQL)]
Proposed Component Boundaries
| Proposed NestJS Module | Current Assets | Notes |
|---|---|---|
AuthModule |
auth_router, mobile_auth_router, JWT helpers, SSO handlers |
Centralize cookie/token issuance, unify mobile/web flows |
LibraryModule |
article_router, GraphQL resolvers under library_item, highlights, labels |
Owns CRUD for saved content, tagging, reading progress |
IngestionModule |
Content save services, ContentWorker interfaces, queue producers | Separate HTTP ingestion from async processing, share DTOs |
DigestModule |
digest_router, email scheduler, service usage limits |
Provide email digest scheduling, ensure rate limiting |
IntegrationModule |
integration_router, webhook handlers, third-party connectors |
Use config-driven connectors, document credentials |
NotificationModule |
Push/email notifications, notification_router |
Align with queue processors |
UserModule |
User CRUD, shortcuts, settings endpoints | Should surface GraphQL + REST parity |
ObservabilityModule |
Prometheus middleware, logging, Sentry bootstrap | Expose providers for metrics & tracing |
What Exists vs. Missing
- Routers & services exist for every responsibility but lack composition: each file wires its own dependencies and does manual validation.
- GraphQL schema is rich but entangled with TypeORM entities and business logic inside resolvers.
- Domain services are plain functions (e.g.,
createPageSaveRequest,applyRulesToLibraryItem) without DI, making them hard to test in isolation. - Configuration & lifecycle logic is scattered (
env.ts, ad-hoc initialization inserver.ts). - Background worker interfaces (
ContentWorker, queue processors) share logic via imports instead of contracts.
NestJS adoption should formalize these components into modules with explicit providers, DTO validation (class-validator), and unified exception filters.