# whamtet/acastream architecture

> Architecture diagram of the GitHub repository whamtet/acastream, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/whamtet/acastream
- Repository: https://github.com/whamtet/acastream

## Overview

#### Purpose and entry points
Acastream is a server-rendered Clojure application for creating and running classroom activities: games, printable PDFs, quizzes, vocabulary tools, scheduling, student records, and mixed video/slides. Runtime startup and system wiring are centered on `src/clj/simpleui/flashcards3/core.clj`, with environment-specific settings under `env/dev/clj/simpleui/flashcards3/env.clj` and `env/prod/clj/simpleui/flashcards3/env.clj`.

#### HTTP composition and request boundaries
The web handler assembles the HTTP application in `src/clj/simpleui/flashcards3/web/handler.clj`. Routes are separated by audience/type: authenticated UI routes, open routes, and API routes in `src/clj/simpleui/flashcards3/web/routes/ui.clj`, `src/clj/simpleui/flashcards3/web/routes/open.clj`, and `src/clj/simpleui/flashcards3/web/routes/api.clj`. Cross-cutting request behavior is isolated in authentication, format, exception, and sharing middleware under `src/clj/simpleui/flashcards3/web/middleware/auth.clj`, `src/clj/simpleui/flashcards3/web/middleware/formats.clj`, and `src/clj/simpleui/flashcards3/web/middleware/share.clj`.

#### Feature-controller layer
Controllers own activity-specific request handling and orchestration. Interactive/game flows are represented by `src/clj/simpleui/flashcards3/web/controllers/battleships/place.clj`, `src/clj/simpleui/flashcards3/web/controllers/boggle.clj`, and `src/clj/simpleui/flashcards3/web/controllers/memory.clj`. Content and classroom-management capabilities are separate controller domains, including reading, students, schedule, slideshow, and sharing in `src/clj/simpleui/flashcards3/web/controllers/reading.clj`, `src/clj/simpleui/flashcards3/web/controllers/students.clj`, and `src/clj/simpleui/flashcards3/web/controllers/slideshow.clj`.

#### Server-rendered UI and progressive interaction
Views are Clojure-rendered presentation modules consumed by controllers, with shared page/component composition in `src/clj/simpleui/flashcards3/web/views/components.clj`. Activity UIs are organized per feature, for example `src/clj/simpleui/flashcards3/web/views/play.clj`, `src/clj/simpleui/flashcards3/web/views/battleships.clj`, and `src/clj/simpleui/flashcards3/web/views/readings.clj`. HTMX integration is a dedicated boundary in `src/clj/simpleui/flashcards3/web/htmx.clj`, indicating partial-response interactions rather than a separate SPA frontend.

#### Persistence, migrations, and content imports
Database schema changes are versioned as SQL migrations in `resources/migrations/20240417013522-slideshow.up.sql` and `resources/migrations/20240417013523-reading.up.sql`, applied through `src/clj/simpleui/flashcards3/migratus.clj`. SQL query definitions reside in `resources/sql/queries.sql`. Student persistence is explicitly separated from request/UI handling in `src/clj/simpleui/flashcards3/web/controllers/students_persist.clj`; spreadsheet ingestion support lives in `src/clj/simpleui/flashcards3/excel.clj`.

#### Generated artifacts and static delivery
PDF-generation controllers form a major output pipeline for printable classroom materials, including `src/clj/simpleui/flashcards3/web/controllers/pdf.clj`, `src/clj/simpleui/flashcards3/web/controllers/pdf_bingo.clj`, and `src/clj/simpleui/flashcards3/web/controllers/pdf_maze.clj`. Public browser behavior and assets are served from `resources/public`, such as `resources/public/blooket.js`, `resources/public/edit.js`, and `resources/public/fullScreen.js`. Static learning data/import assets include `resources/blooket.csv` and `resources/kahoot.xlsx`.

#### Runtimes and deployment
The primary runtime is JVM Clojure, using dependency/build descriptors `deps.edn` and `build.clj`; production packaging is an uberjar. Node/npm is used to build/watch Tailwind CSS via `package.json` and `tailwind.config.js`. Container deployment is defined by `Dockerfile`; operational database backup scripts are `backup.sh` and `backup-stg.sh`. A Chrome extension is a separate browser runtime under `chrome-extension/manifest.json`, `chrome-extension/background.js`, and `chrome-extension/content.js`.

Main entry points: [`src/clj/simpleui/flashcards3/web/handler.clj`](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/handler.clj) (HTTP handler), [`src/clj/simpleui/flashcards3/web/routes/ui.clj`](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/routes/ui.clj) (UI, open & API routes), [`src/clj/simpleui/flashcards3/web/controllers/students.clj`](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/controllers/students.clj) (Classroom controllers), [`src/clj/simpleui/flashcards3/web/views/components.clj`](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/views/components.clj) (Server-rendered views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime &amp; deployment"]
  node_core{{"System startup<br/>Clojure runtime<br/>[core.clj]"}}
  node_env["Environment settings<br/>Clojure config<br/>[env.clj]"]
  node_build["JVM build &amp; uberjar<br/>build descriptor<br/>[build.clj]"]
  node_container["Container deployment<br/>Docker image"]
end

subgraph group_http["HTTP application"]
  node_handler{{"HTTP handler<br/>Ring application<br/>[handler.clj]"}}
  node_routes["UI, open &amp; API routes<br/>route modules<br/>[ui.clj]"]
  node_middleware["Request middleware<br/>Ring middleware<br/>[auth.clj]"]
end

subgraph group_features["Activity features"]
  node_activity_controllers["Game controllers<br/>controller layer<br/>[boggle.clj]"]
  node_classroom_controllers["Classroom controllers<br/>controller layer<br/>[students.clj]"]
  node_pdf_controllers["Printable PDF pipeline<br/>PDF controllers<br/>[pdf.clj]"]
  node_views["Server-rendered views<br/>Clojure views<br/>[components.clj]"]
  node_htmx["HTMX responses<br/>interaction boundary<br/>[htmx.clj]"]
end

subgraph group_data["Data &amp; imports"]
  node_student_persistence["Student persistence<br/>persistence adapter"]
  node_sql_queries["SQL query definitions<br/>SQL queries<br/>[queries.sql]"]
  node_migrations["Database migrations<br/>Migratus migrations<br/>[migratus.clj]"]
  node_imports["Spreadsheet imports<br/>content ingestion<br/>[excel.clj]"]
end

subgraph group_outputs["Browser &amp; generated outputs"]
  node_static_assets["Public browser assets<br/>static assets"]
  node_tailwind["Tailwind asset build<br/>Node/npm build<br/>[package.json]"]
  node_chrome_extension["Chrome extension<br/>browser runtime<br/>[manifest.json]"]
end

node_env -.->|"configures"| node_core
node_build -->|"packages"| node_core
node_container -->|"deploys"| node_build
node_core -->|"starts"| node_handler
node_handler -->|"applies"| node_middleware
node_handler -->|"mounts"| node_routes
node_routes -->|"dispatches to"| node_activity_controllers
node_routes -->|"dispatches to"| node_classroom_controllers
node_routes -->|"dispatches to"| node_pdf_controllers
node_activity_controllers -->|"renders"| node_views
node_classroom_controllers -->|"renders"| node_views
node_pdf_controllers -.->|"uses content"| node_views
node_htmx -->|"returns partials from"| node_views
node_classroom_controllers -.->|"supports"| node_htmx
node_classroom_controllers -->|"persists students"| node_student_persistence
node_student_persistence -->|"uses"| node_sql_queries
node_migrations -.->|"evolves schema for"| node_sql_queries
node_imports -->|"ingests into"| node_student_persistence
node_tailwind -->|"builds assets for"| node_static_assets
node_handler -->|"serves"| node_static_assets
node_chrome_extension -.->|"interacts with"| node_handler

click node_core "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/core.clj"
click node_env "https://github.com/whamtet/acastream/blob/main/env/prod/clj/simpleui/flashcards3/env.clj"
click node_build "https://github.com/whamtet/acastream/blob/main/build.clj"
click node_container "https://github.com/whamtet/acastream/blob/main/Dockerfile"
click node_handler "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/handler.clj"
click node_routes "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/routes/ui.clj"
click node_middleware "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/middleware/auth.clj"
click node_activity_controllers "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/controllers/boggle.clj"
click node_classroom_controllers "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/controllers/students.clj"
click node_pdf_controllers "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/controllers/pdf.clj"
click node_views "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/views/components.clj"
click node_htmx "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/htmx.clj"
click node_student_persistence "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/controllers/students_persist.clj"
click node_sql_queries "https://github.com/whamtet/acastream/blob/main/resources/sql/queries.sql"
click node_migrations "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/migratus.clj"
click node_imports "https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/excel.clj"
click node_static_assets "https://github.com/whamtet/acastream/tree/main/resources/public"
click node_tailwind "https://github.com/whamtet/acastream/blob/main/package.json"
click node_chrome_extension "https://github.com/whamtet/acastream/blob/main/chrome-extension/manifest.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_core,node_env,node_build,node_container toneBlue
class node_handler,node_routes,node_middleware toneAmber
class node_activity_controllers,node_classroom_controllers,node_pdf_controllers,node_views,node_htmx toneMint
class node_student_persistence,node_sql_queries,node_migrations,node_imports toneRose
class node_static_assets,node_tailwind,node_chrome_extension toneIndigo
```

## Components

### Runtime & deployment

- [System startup](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/core.clj): Clojure runtime · Wires the application with environment settings. · `src/clj/simpleui/flashcards3/core.clj`
- [Environment settings](https://github.com/whamtet/acastream/blob/main/env/prod/clj/simpleui/flashcards3/env.clj): Clojure config · `env/prod/clj/simpleui/flashcards3/env.clj`
- [JVM build & uberjar](https://github.com/whamtet/acastream/blob/main/build.clj): build descriptor · `build.clj`
- [Container deployment](https://github.com/whamtet/acastream/blob/main/Dockerfile): Docker image · `Dockerfile`

### HTTP application

- [HTTP handler](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/handler.clj): Ring application · Composes routes and request middleware. · `src/clj/simpleui/flashcards3/web/handler.clj`
- [UI, open & API routes](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/routes/ui.clj): route modules · Separates authenticated, public, and API endpoints. · `src/clj/simpleui/flashcards3/web/routes/ui.clj`
- [Request middleware](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/middleware/auth.clj): Ring middleware · Authentication, formats, exceptions, and sharing behavior. · `src/clj/simpleui/flashcards3/web/middleware/auth.clj`

### Activity features

- [Game controllers](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/controllers/boggle.clj): controller layer · Runs interactive activity flows such as Battleships, Boggle, and Memory. · `src/clj/simpleui/flashcards3/web/controllers/boggle.clj`
- [Classroom controllers](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/controllers/students.clj): controller layer · Handles reading, students, scheduling, slideshows, and sharing. · `src/clj/simpleui/flashcards3/web/controllers/students.clj`
- [Printable PDF pipeline](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/controllers/pdf.clj): PDF controllers · Produces printable classroom materials including bingo and mazes. · `src/clj/simpleui/flashcards3/web/controllers/pdf.clj`
- [Server-rendered views](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/views/components.clj): Clojure views · Shared components and activity-specific page rendering. · `src/clj/simpleui/flashcards3/web/views/components.clj`
- [HTMX responses](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/htmx.clj): interaction boundary · Supports progressive partial-page interactions. · `src/clj/simpleui/flashcards3/web/htmx.clj`

### Data & imports

- [Student persistence](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/web/controllers/students_persist.clj): persistence adapter · `src/clj/simpleui/flashcards3/web/controllers/students_persist.clj`
- [SQL query definitions](https://github.com/whamtet/acastream/blob/main/resources/sql/queries.sql): SQL queries · `resources/sql/queries.sql`
- [Database migrations](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/migratus.clj): Migratus migrations · Applies versioned slideshow and reading schema changes. · `src/clj/simpleui/flashcards3/migratus.clj`
- [Spreadsheet imports](https://github.com/whamtet/acastream/blob/main/src/clj/simpleui/flashcards3/excel.clj): content ingestion · Imports learning and student data from spreadsheet assets. · `src/clj/simpleui/flashcards3/excel.clj`

### Browser & generated outputs

- [Public browser assets](https://github.com/whamtet/acastream/tree/main/resources/public): static assets · Serves browser scripts and other public files. · `resources/public`
- [Tailwind asset build](https://github.com/whamtet/acastream/blob/main/package.json): Node/npm build · `package.json`
- [Chrome extension](https://github.com/whamtet/acastream/blob/main/chrome-extension/manifest.json): browser runtime · Separate extension with background and content scripts. · `chrome-extension/manifest.json`

## Connections

- Environment settings → System startup: configures
- JVM build & uberjar → System startup: packages
- Container deployment → JVM build & uberjar: deploys
- System startup → HTTP handler: starts
- HTTP handler → Request middleware: applies
- HTTP handler → UI, open & API routes: mounts
- UI, open & API routes → Game controllers: dispatches to
- UI, open & API routes → Classroom controllers: dispatches to
- UI, open & API routes → Printable PDF pipeline: dispatches to
- Game controllers → Server-rendered views: renders
- Classroom controllers → Server-rendered views: renders
- Printable PDF pipeline → Server-rendered views: uses content
- HTMX responses → Server-rendered views: returns partials from
- Classroom controllers → HTMX responses: supports
- Classroom controllers → Student persistence: persists students
- Student persistence → SQL query definitions: uses
- Database migrations → SQL query definitions: evolves schema for
- Spreadsheet imports → Student persistence: ingests into
- Tailwind asset build → Public browser assets: builds assets for
- HTTP handler → Public browser assets: serves
- Chrome extension → HTTP handler: interacts with
