# ofamosomario/simple-task-with-pipeline architecture

> Architecture diagram of the GitHub repository ofamosomario/simple-task-with-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ofamosomario/simple-task-with-pipeline
- Repository: https://github.com/ofamosomario/simple-task-with-pipeline

## Overview

##### Project type and purpose
- This is a Ruby on Rails back-end (API-style) application that provides a “tasks” resource under the namespace API::V1.
- It demonstrates how to integrate RSpec and RuboCop checks into a GitHub Actions CI pipeline (`.github/workflows/rubyonrails.yml`).
- It includes a Dockerfile for containerization and standard Rails components (models, controllers, jobs, mailers, ActionCable channels).

##### File structure
- Top-level artifacts:
- Dockerfile / .dockerignore → container build
- .github/workflows/rubyonrails.yml → CI pipeline
- Gemfile / Rakefile / config/ / db/ → classic Rails project layout
- app/controllers/api/v1/tasks_controller.rb and app/models/api/v1/task.rb → primary domain (Task resource)
- config/routes.rb registers `/api/v1/tasks` endpoints
- config/database.yml, db/migrate, db/schema.rb → ActiveRecord + relational database
- spec/… and .rspec → RSpec suite
- .rubocop.yml → linting rules

##### README for additional insights
- The README confirms the goal is to showcase GitHub Actions integration alongside RSpec and RuboCop enforcement.
- No front-end UI; this is pure back-end/API.

a. Main components
- Developer & Git repository (GitHub)
- GitHub Actions CI pipeline
- Docker build / container registry
- API server (Rails + Puma)
- Database (PostgreSQL or specified adapter)
- Optional: File storage (local or cloud via ActiveStorage)
- Optional: ActionCable channels (WebSocket)
b. Relationships & interactions
- Developer pushes code → GitHub → CI pipeline runs RuboCop & RSpec → builds Docker image → pushes to registry / deploys
- Client (e.g. mobile app, curl, Postman) → HTTP(S) → Rails (Puma) → Controllers (API::V1::TasksController) → Models → Database → Response
- Rails may write/read files via ActiveStorage (storage.yml)
- WebSocket clients ↔ ActionCable server
c. Architectural patterns & design principles
- MVC separation: Controllers (app/controllers), Models (app/models), no Views for HTML (API only)
- Namespacing by API version (api/v1) to support future evolution
- CI/CD pipeline (shift-left testing and linting)
- Containerization for consistent environments
d. Key technologies, frameworks, libraries
- Ruby on Rails (API)
- RSpec (testing)
- RuboCop (static analysis)
- Docker
- GitHub Actions

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External
    Developer["Developer"]:::external
    Client["Client (HTTP/WebSocket)"]:::external

    %% Repository
    GitHubRepo[/"GitHub Repo"/]:::external

    %% CI/CD
    subgraph "CI/CD Pipeline" 
        direction TB
        CI["GitHub Actions CI"]:::cicd
        RSpec["Run RSpec Tests"]:::cicd
        RuboCop["Run RuboCop Lint"]:::cicd
    end

    %% Docker Build & Registry
    DockerBuild["Docker Build"]:::cicd
    DockerRegistry["Docker Registry"]:::storage

    %% Runtime Container
    subgraph "Container" 
        direction TB
        subgraph "Rails API Server" 
            direction TB
            RailsApp["Rails App (Puma)"]:::runtime

            subgraph "API::V1 Tasks" 
                direction TB
                TaskController["TasksController"]:::runtime
                TaskModel["Task Model"]:::runtime
            end

            ActionCable["ActionCable (WebSocket)"]:::runtime
            ActiveStorage["ActiveStorage"]:::runtime
            BackgroundJobs["Background Jobs"]:::runtime
            Mailers["Mailers"]:::runtime
        end

        DB[(PostgreSQL DB)]:::storage
    end

    %% Flows
    Developer -->|push code| GitHubRepo
    GitHubRepo -->|trigger| CI
    CI -->|tests| RSpec
    CI -->|lint| RuboCop
    CI -->|build image| DockerBuild
    DockerBuild -->|push image| DockerRegistry
    DockerRegistry -->|deploy| Container

    Client -->|HTTP| RailsApp
    Client -->|WebSocket| ActionCable
    RailsApp -->|reads/writes| DB
    RailsApp -->|stores files| ActiveStorage

    %% Click Events
    click DockerBuild "https://github.com/ofamosomario/simple-task-with-pipeline/tree/main/Dockerfile"
    click DockerBuild "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/.dockerignore"
    click CI "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/.github/workflows/rubyonrails.yml"
    click RailsApp "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/config/application.rb"
    click RailsApp "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/config/routes.rb"
    click RailsApp "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/config/puma.rb"
    click RailsApp "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/config/environment.rb"
    click TaskController "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/app/controllers/api/v1/tasks_controller.rb"
    click TaskModel "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/app/models/api/v1/task.rb"
    click DB "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/config/database.yml"
    click DB "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/db/migrate/20241123164834_create_api_v1_tasks.rb"
    click DB "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/db/schema.rb"
    click DB "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/db/seeds.rb"
    click RSpec "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/.rspec"
    click RSpec "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/spec/spec_helper.rb"
    click RSpec "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/spec/rails_helper.rb"
    click RSpec "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/spec/models/api/v1/task_spec.rb"
    click RSpec "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/spec/requests/api/v1/tasks_spec.rb"
    click RSpec "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/spec/routing/api/v1/tasks_routing_spec.rb"
    click RuboCop "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/.rubocop.yml"
    click ActionCable "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/app/channels/application_cable/connection.rb"
    click ActionCable "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/app/channels/application_cable/channel.rb"
    click ActionCable "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/config/cable.yml"
    click ActiveStorage "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/config/storage.yml"
    click ActiveStorage "https://github.com/ofamosomario/simple-task-with-pipeline/tree/main/storage/"
    click ActiveStorage "https://github.com/ofamosomario/simple-task-with-pipeline/tree/main/tmp/storage/"
    click BackgroundJobs "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/app/jobs/application_job.rb"
    click Mailers "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/app/mailers/application_mailer.rb"
    click Developer "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/.gitattributes"
    click Developer "https://github.com/ofamosomario/simple-task-with-pipeline/blob/main/.gitignore"

    %% Styles
    classDef cicd fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef runtime fill:#d4edda,stroke:#333,stroke-width:1px
    classDef storage fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef external fill:#f0f0f0,stroke:#333,stroke-width:1px
```
