How princetechs/rails_rag_system works
Main Components
A. Frontend Layer:
• Rails Views layer (/app/views)
• JavaScript components (Importmaps and Stimulus controllers)
• PWA capabilities (manifest.json and service-worker.js)
B. Application Layer:
• Controllers (Documents, Sessions, Users, Passwords)
• Models (Document, User, Session)
• Authentication system
• Mailer system (PasswordsMailer)
C. Database Layer:
• PostgreSQL database (indicated by vector extension)
• Active Storage for file handling
• Vector embeddings storage (for AI/ML features)
D. External Services:
• OpenAI integration (shown by config/initializers/openai.rb)
• Active Storage service
E. Background Processing:
• Job processing system (indicated by bin/jobs)
• Queue system (config/queue.yml)
┌─ Client Layer ─────────────────────┐
• Web Browsers │
• Progressive Web App │
• ┬───────────────────┘
• ↓
┌─ Application Layer ─────────────────────────────────┐
• ┌─ Web Layer ─────┐ ┌─ Business Logic ─────────┐ │
• Controllers │ │ - Models │ │
• Views │ │ - Services │ │
• Assets │ │ - Background Jobs │ │
• ┘ └────────────────────────────┘ │
• ┬───────────────────────────────────┘
• ↓
┌─ Data Layer ──────────────────────┐
• PostgreSQL + Vector Extension │
• Active Storage │
• Cache │
• ┬──────────────────┘
• ↓
┌─ External Services ───────────────┐
• OpenAI API │
• Storage Service │
• ┘
Key Relationships to Highlight
• Authentication flow between Users, Sessions, and Controllers
• Document processing flow including vector embeddings
• Background job processing for async operations
• File storage flow through Active Storage
• OpenAI integration for document processing
Technical Details
• Ruby on Rails framework
• Stimulus for JavaScript
• PostgreSQL with vector extension
• Active Storage
• Background job processing
• OpenAI integration
• PWA capabilities