How billymohajeri/final-group-capstone-backend works
Project Type and Purpose
• This is a full-stack booking application split into two repos:
– Backend: Ruby on Rails API (monolithic MVC with ActionCable, ActiveJob, ActionMailer)
– Frontend: React + Redux single-page app
File Structure (Backend)
• app/controllers/api/*: JSON-only endpoints for users, rooms, reservations, sessions
• app/models: ActiveRecord models (User, Room, Reservation)
• app/channels: WebSocket channels via ActionCable for real-time updates
• app/jobs & app/mailers: Background jobs (ActiveJob) and email delivery (ActionMailer)
• config/storage.yml: ActiveStorage configuration (local or cloud file store)
• config/cable.yml: ActionCable setup
• config/routes.rb: API namespace and routing
• Rakefile, bin/puma.sh, config/puma.rb: Puma web server entrypoint
• swagger/v1/swagger.yaml + rswag_* initializers: API documentation
Key Components
a. Client (React + Redux SPA)
b. API Server (Rails monolith)
– HTTP layer: Puma web server
– Controllers (API namespace)
– Models (ActiveRecord → PostgreSQL)
– ActionCable (WebSocket server)
– ActiveJob queue (async tasks)
– ActionMailer (email service)
– ActiveStorage (file uploads)
c. Database (PostgreSQL)
d. External Services
– SMTP/Email provider
– (Optional) Cloud storage if ActiveStorage uses S3
– Reverse proxy or load balancer (e.g., Nginx)
– Swagger UI served under /api-docs
Relationships & Data Flows
• SPA ↔ HTTP(s) ↔ Rails Controllers → JSON
• Controllers ↔ Models → SQL ↔ PostgreSQL
• Controllers → ActionCable → WebSocket → SPA (real-time updates)
• Controllers/Jobs → ActiveJob → (local/Redis) queue → perform background tasks
• Jobs → ActionMailer → SMTP provider → User email
• Controllers → ActiveStorage → file system or S3
• Rails ↔ Swagger UI for interactive docs
Architectural Patterns & Design Principles
• Monolithic MVC API-only backend
• RESTful JSON endpoints under /api namespace
• CQRS-like separation: Controllers handle requests; models encapsulate persistence
• Event-driven components: ActionCable channels for real-time
• Background processing via ActiveJob adapter
• Externalized configuration (credentials.yml.enc, storage.yml)
Essential Elements
• Annotations for frameworks/tech: React, Redux, Ruby on Rails, Puma, PostgreSQL, ActionCable, ActiveJob, ActionMailer, ActiveStorage