How cpeggy/cl3 works
Project type and purpose
• This is a Ruby on Rails 7 monolithic full-stack web application.
• The README is a standard Rails template, indicating this app handles HTTP requests, template rendering, asset management, background jobs, websockets (Action Cable), mailing, and file uploads.
File structure
• Top-level Ruby/Rails files: Gemfile, Rakefile, config.ru, bin/, config/, lib/, db/, public/, storage/, test/.
• app/ contains the MVC layers:
• app/controllers → Rails controllers handling HTTP requests.
• app/models → ActiveRecord models mapping to database tables.
• app/views → ERB templates for HTML emails and page rendering.
• app/assets & app/javascript → asset pipeline and import-map-driven frontend with Stimulus controllers.
• app/channels → Action Cable WebSocket channels.
• app/jobs → ActiveJob background tasks.
• app/mailers → ActionMailer classes for email delivery.
• config/ holds environment setups, database.yml, routes.rb, importmap.rb, cable.yml, storage.yml.
• db/ seeds and schema migrations (not shown but implied).
• storage/ for Active Storage local files.
• public/ for static error pages and robots.txt.
• test/ for system, integration, unit tests.
Key architectural patterns and stacks
• MVC pattern at its core.
• Single monolithic application server (Puma) serving web requests.
• Importmap + Stimulus for progressive enhancement on the frontend.
• ActiveRecord for relational DB (likely PostgreSQL).
• Active Job with an adapter (Sidekiq/Resque) for background processing.
• Action Cable for real-time WebSockets.
• Active Storage for file uploads and storage.
• Action Mailer for outbound emails.
a. Main components
• Client (Browser or HTTP client)
• Web Server (Puma)
• Rails Application
– Router & Middleware Stack
– Controllers
– Views/Asset Pipeline (Sprockets + Importmap + Stimulus)
– Models (ActiveRecord)
– Jobs (ActiveJob)
– Channels (Action Cable)
– Mailers (Action Mailer)
• Database (PostgreSQL or MySQL)
• Cache/Session store (Redis or Memcached)
• Background queue (Redis + Sidekiq or similar)
• File storage (local disk or external S3)
• External SMTP service
b. Relationships and interactions
• Browser sends HTTP(S) requests → Puma → Rails router → Controller actions.
• Controllers read/write via ActiveRecord to DB.
• Controllers render HTML/JSON via Views and serve assets.
• Stimulus controllers in browser communicate back via AJAX/WebSockets.
• Background tasks enqueued by ActiveJob → Queue backend (Redis) → Worker process.
• Action Cable connection established over WebSocket, handled by the same Rails process or separate server.
• File uploads posted to Rails → Active Storage → local disk or S3.
• Action Mailer sends messages via SMTP service.
c. Architectural patterns in use
• Layered MVC.
• Event-driven async processing (jobs, channels).
• Asset pipeline with importmap for JS modules.
• Convention-over-configuration.
d. Key technologies/frameworks
• Ruby 3.x, Rails 7
• Puma
• Sprockets & Importmap
• Stimulus (via importmap-rails)
• ActiveRecord + PostgreSQL/MySQL
• Active Job + Sidekiq/Resque
• Action Cable
• Active Storage
• Action Mailer