How taira0222/juku-cloud-backend works
Project type and purpose
• This is a Ruby on Rails API-only application (no embedded frontend).
• It exposes a versioned REST API (app/controllers/api/v1/*) to manage resources (students, teachers, invites, lesson notes, student traits, dashboards).
• It uses token-based authentication (Devise + DeviseTokenAuth).
• It persists data in a relational database and uploads files (if any) via ActiveStorage.
• It runs on Docker in AWS ECS, with CI/CD on GitHub Actions, and relies on background jobs for asynchronous processing.
File structure for architectural clues
• app/controllers/api/v1 → versioned API boundary
• app/services, app/queries, app/serializers → layered, service‐oriented, hexagonal flavor (thin controllers, POJO services, query objects, presenters/serializers)
• config/storage.yml → ActiveStorage (local vs S3)
• db/queue_schema.rb → jobs backed by DB (ActiveJob + DelayedJob or similar)
• Dockerfile + ecs/taskdef.json → containerized deployment in ECS
• config/routes.rb → entrypoint mapping controllers to URL paths
• Gemfile → shows core technologies: Rails, Devise, RSpec, etc.
README for missing details
• We infer: PostgreSQL (via database.yml), Puma (config/puma.rb), Redis or DB queue, AWS S3 storage, GitHub Actions for CI/CD.
• Clients: Web SPA, Mobile Apps, or third-party integrators
• API Layer: Load Balancer / API Gateway (AWS ALB/NGINX)
• Application Containers: Rails app running Puma in Docker (ECS Task)
• Relational Database: PostgreSQL (Amazon RDS)
• Object Storage: AWS S3 bucket (ActiveStorage)
• Background Job Processor: Separate ECS service or worker container (ActiveJob / DelayedJob)
• Email Service: External SMTP or AWS SES (ActionMailer)
• CI/CD: GitHub Actions workflows triggering Docker builds and ECS deployments
1. Client → HTTPS → Load Balancer → ECS Rails Container
2. Rails Container → SQL (read/write) → PostgreSQL RDS
3. Rails Container → S3 API → S3 Bucket (file uploads/downloads)
4. Rails Container (Auth) ↔ DeviseTokenAuth logic (in-process)
5. Rails Container → DB job enqueue → jobs table (ActiveJob)
6. Worker Container polls jobs table → executes background services → may send Email or write DB
7. Rails Container → SMTP/API → Email Service (confirmations, invites)
8. GitHub Actions → Docker build & push → ECS deploy
c. Architectural patterns & design principles:
• MVC at core, extended by service-objects (single-responsibility)
• Query Objects for encapsulating read logic (app/queries/*)
• Serializer layer (JSON:API–style) for response shaping
• API Versioning (v1) to support backward compatibility
• Layered hexagon: controllers → services → models → persistence
• Containerization & twelve-factor app principles (config via ENV, stateless pods)
d. Key technologies/frameworks (annotate each component):
• Ruby 3.x, Rails 7.x, Puma Web Server
• Docker, AWS ECS (Fargate or EC2 launch type)
• PostgreSQL (RDS)
• AWS S3 (via ActiveStorage)
• ActiveJob + DelayedJob (or custom queue adapter)
• ActionMailer + AWS SES/SMTP
• Devise + DeviseTokenAuth (authentication)
• GitHub Actions (CI/CD), Brakeman, RuboCop (quality checks)