# canvasbird/canvasboard architecture

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

- Interactive diagram: https://gitdiagram.com/canvasbird/canvasboard
- Repository: https://github.com/canvasbird/canvasboard

## Overview

##### Project type and purpose
- Canvasboard is a single‑page web application (SPA) built with Angular (frontend), which communicates via REST APIs with a FastAPI backend (hosted separately). It provides an interactive “canvas” workspace with pluggable tools for teaching, presenting, and collaboration.
- The README confirms that backend (FastAPI + MongoDB) and cloud hosting (AWS) are separate concerns; this repository holds the frontend only.

##### File structure
- Top‑level config: Dockerfile, GitHub workflows, lint/prettier, Angular CLI config (angular.json).
- src/app: Angular modules and lazy‑loaded feature modules organized under components, plugins, services, shared.
- components/… each feature has its own routing.module.ts and module.ts
- plugins/… custom plugin modules and CLI loader (src/app/plugins_cli.js)
- services/: AuthService, RestService, LoadingService
- shared/: route guards, pipes
- src/environments: environment.ts & production
- e2e/: end‑to‑end tests with Protractor
- Interfaces define type contracts for plugin parameters, board data, dashboard, etc.

##### README for additional insights
- Mentions dependencies: Angular, Bootstrap, jQuery, FastAPI, MongoDB, AWS.
- States that Canvasboard is standalone and extensible via plugins.
- Indicates separate backend repo handling persistence and authentication.

##### Detailing and capturing essential architecture
- Do not simply dump every file; group by module or concern (UI, services, plugins).
- Environment configurations feeding into the build pipeline (Angular CLI → Docker → Netlify).
- Authentication flow with guard symbols protecting feature routes.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend (Angular SPA)"
        direction TB
        AppModule["App Module"]:::frontend
        Router["App Router"]:::frontend
        subgraph "Feature Modules"
            direction TB
            Dashboard["Dashboard Module"]:::frontend
            Files["Files Module"]:::frontend
            Contribution["Contribution Module"]:::frontend
            Home["Home Module"]:::frontend
            Login["Login Module"]:::frontend
            SignUp["Sign-Up Module"]:::frontend
            Verify["Verify-Code Module"]:::frontend
            Forgot["Forgot-Password Module"]:::frontend
            NewBoard["New-Board Module"]:::frontend
            Navbar["Navbar Module"]:::frontend
            Footer["Footer Module"]:::frontend
            ScrollTop["Scroll-To-Top Module"]:::frontend
        end
        subgraph "Plugins"
            direction TB
            PluginLoader["Plugin Loader"]:::frontend
            CorePlugins["Core Plugin Definitions"]:::frontend
            ClockPlugin["Clock Plugin Module"]:::frontend
        end
        subgraph "Services & Shared"
            direction TB
            AuthService["Auth Service"]:::frontend
            RestService["REST Service"]:::frontend
            LoadingService["Loading Service"]:::frontend
            AuthGuard["Route Guards"]:::frontend
            Pipes["Shared Pipes"]:::frontend
            Interfaces["TS Interfaces"]:::frontend
        end
        Env["Environment Configs"]:::frontend
    end

    Browser["User Browser"]:::external
    Browser -->|"loads SPA"| AppModule
    AppModule --> Router
    Router -->|"lazy loads"| Dashboard
    Router --> Files
    Router --> Contribution
    Router --> Home
    Router --> Login
    Router --> SignUp
    Router --> Verify
    Router --> Forgot
    Router --> NewBoard

    Dashboard --> AuthGuard
    Files --> AuthGuard
    Contribution --> AuthGuard
    Home --> AuthGuard
    NewBoard --> AuthGuard

    Dashboard --> RestService
    Files --> RestService
    Contribution --> RestService
    Home --> RestService
    Login --> RestService
    SignUp --> RestService
    Verify --> RestService
    Forgot --> RestService
    NewBoard --> RestService

    PluginLoader --> CorePlugins
    PluginLoader --> ClockPlugin
    Dashboard --> PluginLoader

    Env --> AppModule

    subgraph "Backend & Infrastructure"
        direction TB
        API["FastAPI REST API"]:::external
        MongoDB["MongoDB"]:::external
        Hosting["AWS / Netlify CDN"]:::external
    end

    RestService -->|"/boards, auth"| API
    API -->|"findOne(), insert()"| MongoDB
    Hosting -->|"serves SPA"| Browser

    subgraph "Dev & CI/CD"
        direction TB
        Dockerfile["Docker Config"]:::ci
        CI["GitHub Workflows"]:::ci
        Protractor["E2E Tests"]:::ci
        Karma["Unit Tests"]:::ci
    end

    CI --> Dockerfile
    CI --> Protractor
    CI --> Karma
    Dockerfile --> Hosting

    click AppModule "https://github.com/canvasbird/canvasboard/blob/master/src/app/app.module.ts"
    click Router "https://github.com/canvasbird/canvasboard/blob/master/src/app/app-routing.module.ts"
    click Dashboard "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/dashboard/dashboard.module.ts"
    click Files "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/files/files.module.ts"
    click Contribution "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/contribution/contribution.module.ts"
    click Home "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/home/home.module.ts"
    click Login "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/login/login.module.ts"
    click SignUp "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/sign-up/sign-up.module.ts"
    click Verify "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/verify-code/verify-code.module.ts"
    click Forgot "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/forgot-password/forgot-password.module.ts"
    click NewBoard "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/new-board/new-board.module.ts"
    click Navbar "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/navbar/navbar.module.ts"
    click Footer "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/footer/footer.module.ts"
    click ScrollTop "https://github.com/canvasbird/canvasboard/blob/master/src/app/components/scroll-to-top/scroll-to-top.module.ts"
    click PluginLoader "https://github.com/canvasbird/canvasboard/blob/master/src/app/plugins_cli.js"
    click CorePlugins "https://github.com/canvasbird/canvasboard/blob/master/src/app/plugins/*.ts"
    click ClockPlugin "https://github.com/canvasbird/canvasboard/blob/master/src/app/plugins/clock/clock.module.ts"
    click AuthService "https://github.com/canvasbird/canvasboard/blob/master/src/app/services/auth.service.ts"
    click RestService "https://github.com/canvasbird/canvasboard/blob/master/src/app/services/rest.service.ts"
    click LoadingService "https://github.com/canvasbird/canvasboard/blob/master/src/app/services/loading.service.ts"
    click AuthGuard "https://github.com/canvasbird/canvasboard/blob/master/src/app/shared/auth.guard.ts"
    click Pipes "https://github.com/canvasbird/canvasboard/blob/master/src/app/shared/filter-folder.pipe.ts"
    click Interfaces "https://github.com/canvasbird/canvasboard/blob/master/src/interfaces/*.ts"
    click Env "https://github.com/canvasbird/canvasboard/blob/master/src/environments/environment.ts"
    click Dockerfile "https://github.com/canvasbird/canvasboard/tree/master/Dockerfile"
    click CI "https://github.com/canvasbird/canvasboard/blob/master/ .github/workflows/main.yml"
    click CI "https://github.com/canvasbird/canvasboard/blob/master/ .github/workflows/on_pull_request.yml"
    click Protractor "https://github.com/canvasbird/canvasboard/blob/master/e2e/protractor.conf.js"
    click Karma "https://github.com/canvasbird/canvasboard/blob/master/karma.conf.js"

    classDef frontend fill:#add8e6,stroke:#005f8b,color:#000
    classDef external fill:#90ee90,stroke:#006400,color:#000
    classDef ci fill:#d3d3d3,stroke:#696969,color:#000
```
