# markoinla/build-together architecture

> Architecture diagram of the GitHub repository markoinla/build-together, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/markoinla/build-together
- Repository: https://github.com/markoinla/build-together

## Overview

##### Project Overview
- Build Together is a project management web application designed for “vibe coders” to collaborate using both AI and human input. It incorporates a dynamic web interface, a RESTful API backend, and specialized support for MCP (Model Context Protocol) integration with popular AI coding assistants (e.g., Cursor, Windsurf, Claude Code).

##### Main Components
a. Web Application Backend:
- The core application is built in Python (using Flask, as indicated by the file structure and Flask-Migrate in migrations).
- Sub-components include:
- Route Handlers (found in app/routes/): Different endpoints for pages (e.g., dashboard, project details, sprint details) and dynamic HTMX interactions.
- API Endpoints (in app/api/): Provide JSON/REST interface for managing projects, sprints, tasks, and issues.
- Database Models (in app/models/): Represent entities like project, sprint, task, and issue.
- Utility Functions (in app/utils/): For processing markdown and other support tasks.

b. Frontend Assets & Styling:
- Templates (in app/templates/) provide the Jinja2-based HTML views.
- Static assets (in app/static/) include CSS (with Tailwind, DaisyUI, and custom themes) and JavaScript (e.g., main.js for client-side dynamic behaviors).
- There is also a separate frontend folder that contains build configurations (package.json, tailwind.config.js, etc.), indicating a modern workflow for styling and possibly additional JS tooling.

c. MCP (Model Context Protocol) Server:
- Dedicated directory (mcp/) responsible for starting and running the MCP server.
- Contains MCP tool definitions (in mcp/tools) that the AI assistants use for actions on the project.
- The run_mcp.sh script is used to launch the MCP server as a separate process.

d. Database and Migrations:
- Migrations directory shows use of Flask-Migrate for schema evolution and versioning.
- The init_db.py script is used to initialize the database with the proper schema and sample data.

e. Configuration & Setup:
- The config.py file holds application configurations (e.g., PORT, SECRET_KEY, DATABASE_URL).
- Setup scripts (setup.sh, run.sh) are provided to streamline environment setup and start the application.

##### Relationships and Interactions
- The web server (app.py) acts as the entry point to the backend, connecting the routes, models, and API calls.
- HTTP requests from clients pass through the route handlers, which may render a template (using data from models) or perform CRUD operations via the API.
- The API layer exposes endpoints (e.g., /api/projects, /api/tasks) that interact with the database layer using the defined models.
- The MCP server (separate process launched via mcp/run_mcp.sh) communicates with the backend endpoints. It enables external AI coding assistants to operate through natural language for actions like creating or updating projects, sprints, tasks, etc.
- Frontend assets (HTML templates, CSS, and JavaScript) provide the client interface with HTMX facilitating dynamic updates without full page reloads.
- The model data and state changes from the backend are also made available to the REST API for external integration.

##### Architectural Patterns and Design Principles
- MVC-like Separation: Models (in app/models), Views (in app/templates and static files), and Controllers (in app/routes and app/api).
- Modular Organization: Different directories for API endpoints, utility functions, and MCP integration encourage clean separation of concerns.
- Use of REST and HTMX: Ensures that the application is both API-driven and capable of dynamic, client-side updates.
- MCP Integration: Provides a mechanism for AI assistants to communicate with the web application via specialized protocols.

## Diagram (Mermaid)

```mermaid
graph TD
    %% External Client
    Client["Client / Browser"]:::external

    %% Frontend Layer
    subgraph "Frontend Layer"
        FE_Templates["Templates"]:::frontend
        FE_Static["Static Assets"]:::frontend
        FE_Build["Build Tooling & Config"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BS_Web["Web Server (app.py)"]:::backend
        %% Route Handlers subgraph
        subgraph "Route Handlers"
            RH_htmx["htmx_routes.py"]:::backend
            RH_issue["issue_routes.py"]:::backend
            RH_main["main_routes.py"]:::backend
            RH_project["project_routes.py"]:::backend
            RH_sprint["sprint_routes.py"]:::backend
            RH_task["task_routes.py"]:::backend
        end
        AE_API["API Endpoints (app/api/api.py)"]:::backend
        %% Database Models subgraph
        subgraph "Database Models"
            DM_project["project.py"]:::backend
            DM_sprint["sprint.py"]:::backend
            DM_task["task.py"]:::backend
            DM_issue["issue.py"]:::backend
        end
        UF_Util["Utility Functions (markdown_parser.py)"]:::backend
    end

    %% MCP Server Layer
    subgraph "MCP Server"
        MCP_Run["MCP Server (run_mcp.sh)"]:::mcp
        MCP_Server["MCP Server (mcp_server.py)"]:::mcp
        MCP_Tools["MCP Tools (mcp/tools/)"]:::mcp
    end

    %% Database & Migrations Layer
    subgraph "Database & Migrations"
        DB_Mig["Migrations (migrations/)"]:::database
        DB_Init["Database Init (init_db.py)"]:::database
    end

    %% Configuration & Setup
    subgraph "Configuration & Setup"
        CFG["config.py"]:::config
        Setup["setup.sh"]:::config
        Run["run.sh"]:::config
    end

    %% External AI Assistants
    subgraph "External AI Assistants"
        AI_Cursor["Cursor"]:::external
        AI_Windsurf["Windsurf"]:::external
        AI_Claude["Claude Code"]:::external
    end

    %% Connections
    Client -->|"HTTP request"| BS_Web
    BS_Web -->|"handles"| RH_main
    BS_Web -->|"exposes"| AE_API
    BS_Web -->|"renders"| FE_Templates
    RH_main -->|"uses"| UF_Util
    AE_API -->|"CRUD"| DM_project
    DB_Init -->|"initializes"| DM_project
    DB_Mig -->|"defines"| DB_Init
    CFG -->|"configures"| BS_Web
    Setup -->|"initializes"| BS_Web
    Run -->|"starts"| BS_Web
    MCP_Run -->|"communicates"| BS_Web
    MCP_Run -->|"calls"| AE_API
    MCP_Run -->|"instructs"| AI_Cursor
    MCP_Run -->|"instructs"| AI_Windsurf
    MCP_Run -->|"instructs"| AI_Claude

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef backend fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef mcp fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef config fill:#F5CBA7,stroke:#873600,stroke-width:2px;
    classDef external fill:#FAD7A0,stroke:#D35400,stroke-width:2px;
    classDef database fill:#F2D7D5,stroke:#922B21,stroke-width:2px;

    %% Click Events - Backend
    click BS_Web "https://github.com/markoinla/build-together/blob/main/app.py"
    click RH_htmx "https://github.com/markoinla/build-together/blob/main/app/routes/htmx_routes.py"
    click RH_issue "https://github.com/markoinla/build-together/blob/main/app/routes/issue_routes.py"
    click RH_main "https://github.com/markoinla/build-together/blob/main/app/routes/main_routes.py"
    click RH_project "https://github.com/markoinla/build-together/blob/main/app/routes/project_routes.py"
    click RH_sprint "https://github.com/markoinla/build-together/blob/main/app/routes/sprint_routes.py"
    click RH_task "https://github.com/markoinla/build-together/blob/main/app/routes/task_routes.py"
    click AE_API "https://github.com/markoinla/build-together/blob/main/app/api/api.py"
    click DM_project "https://github.com/markoinla/build-together/blob/main/app/models/project.py"
    click DM_sprint "https://github.com/markoinla/build-together/blob/main/app/models/sprint.py"
    click DM_task "https://github.com/markoinla/build-together/blob/main/app/models/task.py"
    click DM_issue "https://github.com/markoinla/build-together/blob/main/app/models/issue.py"
    click UF_Util "https://github.com/markoinla/build-together/blob/main/app/utils/markdown_parser.py"

    %% Click Events - Frontend
    click FE_Templates "https://github.com/markoinla/build-together/tree/main/app/templates/"
    click FE_Static "https://github.com/markoinla/build-together/tree/main/app/static/"
    click FE_Build "https://github.com/markoinla/build-together/tree/main/frontend/"

    %% Click Events - MCP Server
    click MCP_Run "https://github.com/markoinla/build-together/blob/main/mcp/run_mcp.sh"
    click MCP_Server "https://github.com/markoinla/build-together/blob/main/mcp/mcp_server.py"
    click MCP_Tools "https://github.com/markoinla/build-together/tree/main/mcp/tools/"

    %% Click Events - Database & Migrations
    click DB_Mig "https://github.com/markoinla/build-together/tree/main/migrations/"
    click DB_Init "https://github.com/markoinla/build-together/blob/main/init_db.py"

    %% Click Events - Configuration & Setup
    click CFG "https://github.com/markoinla/build-together/blob/main/config.py"
    click Setup "https://github.com/markoinla/build-together/blob/main/setup.sh"
    click Run "https://github.com/markoinla/build-together/blob/main/run.sh"
```
