# sagarsutarxyz/retroboard architecture

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

- Interactive diagram: https://gitdiagram.com/sagarsutarxyz/retroboard
- Repository: https://github.com/sagarsutarxyz/retroboard

## Overview

##### Main Components
- Frontend/UI: Represented by the “app” folder containing a Next.js project (pages, components, styles, etc.). This component is responsible for rendering the user interface and interacting with the backend API.
- Backend/API Lambda: Contained under “functions/api”. This Python-based API handles board-related operations. Key files (e.g., main.py, models.py, errors.py) indicate the implementation of REST endpoints.
- Email Summary Function: Under “functions/email-summary”, a Lambda function implemented in Python that sends summary emails via SES.
- Slack Alerts Function: Under “functions/slack-alerts”, another Lambda function that triggers alerts (using the Slack webhook) when new boards are created.
- Data Storage: Although you won’t see a physical directory for DynamoDB, the README indicates DynamoDB is used to store board data.
- Infrastructure as Code (IaC): The project is intended to work with StackGen to generate and manage AWS resources including S3, Lambda, DynamoDB, SES, etc.

##### Relationships and Interactions
- The Frontend (Next.js app) communicates with the backend API (Lambda functions) to create or update kanban boards.
- The API Lambda interacts with DynamoDB to store and retrieve data.
- When certain actions occur (e.g., new board creation), the API Lambda may trigger additional Lambda functions:
- The Email Summary function uses AWS SES to send an email summary, where the flow of information is from the API to the email function.
- The Slack Alerts function sends notifications via the provided Slack webhook.

##### Architecture Patterns & Technologies
- Serverless Architecture: With lightweight Lambda functions handling different aspects of the application and S3/DynamoDB handling hosting and storage.
- Separation of Concerns: The UI is decoupled from backend logic, and each backend function is designed with a single responsibility (API handling, email summary, slack alerts).
- Use of Next.js: Ensures a modern web experience with server-side rendering and client-side interactivity.
- Python for Lambda Functions: Indicates usage of relevant Python libraries and standard practices for building serverless APIs.

##### Important Reminders for the Principal Software Engineer
- Every main component (e.g., Frontend, Backend/API, Email Function, Slack Alerts Function, Database, External Services like SES and Slack) is visually represented.
- Notes on configuration files (e.g., next.config.mjs, tailwind.config.js for the frontend, and Python files in functions/api) to further convey how code organization reflects architectural roles.

## Diagram (Mermaid)

```mermaid
flowchart TB
  subgraph "Frontend Layer"
    UI["Next.js UI (served from S3)"]:::frontend
  end

  subgraph "Backend Layer"
    API["Backend/API Lambda (Python)"]:::backend
    EMAIL["Email Summary Lambda (Python)"]:::backend
    SLACK["Slack Alerts Lambda (Python)"]:::backend
  end

  subgraph "Data & External Services"
    DB["DynamoDB"]:::aws
    SES["AWS SES"]:::aws
    SLACK_WEBHOOK["Slack Webhook"]:::aws
    STACKGEN["StackGen IaC"]:::aws
  end

  UI -->|"API call"| API
  API -->|"Data operations"| DB
  API -->|"Trigger email"| EMAIL
  EMAIL -->|"Send via SES"| SES
  API -->|"Trigger slack alert"| SLACK
  SLACK -->|"Send notification"| SLACK_WEBHOOK
  API -->|"Managed by"| STACKGEN

  subgraph "Legend"
    L1["Frontend/UI (Blue)"]:::frontend
    L2["Lambda Functions (Green)"]:::backend
    L3["AWS/External Services (Orange)"]:::aws
  end

  click UI "https://github.com/sagarsutarxyz/retroboard/tree/main/app/"
  click API "https://github.com/sagarsutarxyz/retroboard/tree/main/functions/api/"
  click EMAIL "https://github.com/sagarsutarxyz/retroboard/blob/main/functions/email-summary/main.py"
  click SLACK "https://github.com/sagarsutarxyz/retroboard/blob/main/functions/slack-alerts/main.py"

  classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
  classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
  classDef aws fill:#fff3cd,stroke:#856404,stroke-width:2px;
```
