# cncf/open-community-groups architecture

> Architecture diagram of the GitHub repository cncf/open-community-groups, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cncf/open-community-groups
- Repository: https://github.com/cncf/open-community-groups

## Overview

1. **Overall shape**
   - This is a Rust monorepo for an events/community platform built around a PostgreSQL-backed application server plus a small redirector service.
   - The system is split into three major layers: HTTP application logic in `ocg-server`, URL redirection in `ocg-redirector`, and the database-centric domain model in `database/`.

2. **Primary runtime services**
   - `ocg-server` is the main user-facing service. It serves public site pages, community/group/event dashboards, authentication flows, and static assets.
   - `ocg-redirector` is a separate service used for redirect handling, likely for legacy URLs or short links, and is kept isolated from the main app.
   - Both are containerized independently and deployed via the Helm chart under `charts/ocg`.

3. **Web application structure**
   - The server follows a classic request-handler architecture: `router` maps routes to `handlers`, handlers call `db` access modules and service adapters, then render `templates`.
   - The UI is server-rendered with Askama templates, with supporting client-side JavaScript for interactivity, validation, dashboards, and rich controls.
   - Static styling and behavior live in `ocg-server/static`, while page structure lives in `ocg-server/templates`.

4. **Domain boundaries in the server**
   - The code is organized by business area: `auth`, `community`, `group`, `event`, `site`, `meetings`, `notifications`, `images`, and `dashboard`.
   - Dashboard functionality is further split by actor and scope: user dashboard, group dashboard, community dashboard, and shared/common dashboard code.
   - This separation is reflected consistently across handlers, DB access modules, templates, and client-side JS.

5. **Database as the core domain engine**
   - The `database/migrations` tree is central to the architecture: schema evolution, SQL functions, triggers, and reference data define most business rules.
   - Instead of embedding all business logic in Rust, many operations are implemented as PostgreSQL stored functions such as event creation, membership changes, invitations, search, stats, and permission checks.
   - Triggers enforce invariants like audit-log protection, session bounds, and referential checks around event/group relationships.

6. **Data flow pattern**
   - Most user actions flow from HTTP request → Rust handler → DB function call → template/data model response.
   - Reads are often backed by SQL functions that return pre-shaped summaries or “full” views for pages like home, explore, stats, and dashboards.
   - Writes are usually funneled through purpose-built DB functions, which keeps application logic and integrity rules close to the data.

7. **External integrations and side effects**
   - Meeting management integrates with Zoom through `ocg-server/src/services/meetings/zoom`, with DB tables/functions tracking meeting state, auto-end checks, recording URLs, and sync status.
   - Image storage is abstracted through an images service layer with both database-backed and S3-backed paths, indicating external object storage for uploaded media.
   - Notifications are orchestrated through database functions and server-side templates, covering event reminders, invitations, and custom notifications.

8. **Public discovery and content surfaces**
   - The public site includes home, stats, docs, explore, community pages, group pages, and event pages.
   - Explore views support search/filtering and are enhanced with map, calendar, and filter widgets in JavaScript.
   - Many page fragments are reusable templates for cards, headers, modals, stats, and search/filter components, showing a componentized server-rendered UI.

9. **Dashboard and workflow model**
   - Dashboards are the operational control plane for communities, groups, and individual users.
   - Community dashboards manage categories, regions, groups, team members, and analytics.
   - Group dashboards manage events, attendees, waitlists, submissions, sponsors, members, and team/invitation workflows.
   - User dashboards focus on invitations, submissions, session proposals, logs, and personal event participation.

10. **Identity and permissions**
   - Authentication supports local email/password accounts plus social login providers, with email verification.
   - Authorization is mediated through role/permission concepts in the database, with functions for checking community and group permissions.
   - The presence of RBAC schema changes suggests fine-grained access control is a first-class architectural concern.

11. **Operational packaging and deployment**
   - The Helm chart deploys separate workloads for the server and redirector, plus a database migrator job and secrets/services/ingress resources.
   - PostgreSQL is a core dependency and the chart includes a packaged PostgreSQL subchart, reinforcing that persistence is the main infrastructure anchor.
   - Database migration images and scripts are part of the operational model, not just development tooling.

12. **Testing and quality gates**
   - The repo has three major test layers: Rust unit/integration tests, database SQL tests, and Playwright end-to-end tests.
   - Database tests mirror the migration functions and schema, which suggests the DB layer is treated as a key contract boundary.
   - E2E tests cover public site flows, dashboards, auth, event attendance/check-in, and visual regressions, indicating the system is heavily workflow-driven rather than API-only.

13. **Documentation and product surface**
   - The `docs/` tree is a user-facing documentation site with getting-started guides and dashboard workflows.
   - This is not just code documentation; it is part of the product’s operational and onboarding story, especially for community/group admins.

14. **Architecture summary for diagramming**
   - A good architecture diagram would center PostgreSQL at the bottom, with the Rust server above it calling SQL functions/triggers for domain operations.
   - Around the server, show external integration edges to Zoom and object storage, plus a separate redirector service.
   - On top, show the major user-facing areas: public site, explore, event/group/community pages, and the three dashboard scopes, all rendered server-side with supporting JavaScript.

Main entry points: [`ocg-server/src/handlers.rs`](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers.rs) (Handlers), [`ocg-server/src/services.rs`](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/services.rs) (Services), [`ocg-server/src/db.rs`](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/db.rs) (DB access), [`database/migrations/functions`](https://github.com/cncf/open-community-groups/tree/main/database/migrations/functions) (Functions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime services"]
  node_ocg_server["ocg-server<br/>web server"]
  node_ocg_redirector["redirector<br/>redirect service"]
end

subgraph group_app["Application server"]
  node_router["Router<br/>HTTP routing<br/>[router.rs]"]
  node_handlers["Handlers<br/>[handlers.rs]"]
  node_templates["Templates<br/>askama views<br/>[templates.rs]"]
  node_static_js["Client JS<br/>browser behavior"]
  node_services["Services<br/>adapters<br/>[services.rs]"]
  node_db_access["DB access<br/>sql adapters<br/>[db.rs]"]
  node_site_area["Public site<br/>site pages<br/>[site.rs]"]
  node_community_area["Community pages<br/>community views<br/>[community.rs]"]
  node_group_area["Group pages<br/>group views<br/>[group.rs]"]
  node_event_area["Event pages<br/>event views<br/>[event.rs]"]
  node_dashboard_area["Dashboards<br/>admin control plane<br/>[dashboard.rs]"]
  node_auth_area["Auth<br/>identity<br/>[auth.rs]"]
  node_images_area["Images<br/>media service<br/>[images.rs]"]
  node_meetings_area["Meetings<br/>meeting integration<br/>[meetings.rs]"]
  node_notifications_templates["Notifs UI<br/>mail templates<br/>[base.html]"]
end

subgraph group_db["PostgreSQL domain"]
  node_db_schema[("Schema<br/>migrations")]
  node_db_functions["Functions<br/>stored procedures"]
  node_db_triggers{{"Triggers<br/>db invariants"}}
end

subgraph group_ops["Operations"]
  node_helm_chart["Helm chart<br/>deployment"]
  node_migrator["Migrator<br/>db job"]
end

subgraph group_quality["Quality"]
  node_db_tests["DB tests<br/>sql contract tests"]
  node_rust_tests["Rust tests<br/>unit/integration"]
  node_e2e_tests["E2E tests<br/>browser workflows"]
end

node_ocg_server -->|"routes"| node_router
node_router -->|"dispatches"| node_handlers
node_handlers -->|"queries"| node_db_access
node_handlers -->|"uses"| node_services
node_handlers -->|"renders"| node_templates
node_templates -->|"enhanced by"| node_static_js
node_db_access -->|"calls"| node_db_functions
node_db_access -->|"depends on"| node_db_schema
node_db_functions -->|"protected by"| node_db_triggers
node_db_functions -->|"operates on"| node_db_schema
node_site_area -->|"served by"| node_handlers
node_community_area -->|"served by"| node_handlers
node_group_area -->|"served by"| node_handlers
node_event_area -->|"served by"| node_handlers
node_dashboard_area -->|"served by"| node_handlers
node_auth_area -->|"served by"| node_handlers
node_images_area -->|"backed by"| node_services
node_meetings_area -->|"backed by"| node_services
node_notifications_templates -->|"driven by"| node_services
node_ocg_redirector -->|"looks up redirects"| node_db_access
node_helm_chart -->|"deploys"| node_ocg_server
node_helm_chart -->|"deploys"| node_ocg_redirector
node_helm_chart -->|"runs"| node_migrator
node_migrator -->|"applies"| node_db_schema
node_rust_tests -.->|"covers"| node_handlers
node_rust_tests -.->|"covers"| node_services
node_db_tests -.->|"covers"| node_db_functions
node_db_tests -.->|"covers"| node_db_triggers
node_e2e_tests -.->|"exercises"| node_ocg_server
node_e2e_tests -.->|"exercises"| node_static_js

click node_ocg_server "https://github.com/cncf/open-community-groups/tree/main/ocg-server"
click node_ocg_redirector "https://github.com/cncf/open-community-groups/tree/main/ocg-redirector"
click node_router "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/router.rs"
click node_handlers "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers.rs"
click node_templates "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/templates.rs"
click node_static_js "https://github.com/cncf/open-community-groups/tree/main/ocg-server/static/js"
click node_services "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/services.rs"
click node_db_access "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/db.rs"
click node_site_area "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/site.rs"
click node_community_area "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/community.rs"
click node_group_area "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/group.rs"
click node_event_area "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/event.rs"
click node_dashboard_area "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/dashboard.rs"
click node_auth_area "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/auth.rs"
click node_images_area "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/images.rs"
click node_meetings_area "https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/meetings.rs"
click node_notifications_templates "https://github.com/cncf/open-community-groups/blob/main/ocg-server/templates/notifications/base.html"
click node_db_schema "https://github.com/cncf/open-community-groups/tree/main/database/migrations/schema"
click node_db_functions "https://github.com/cncf/open-community-groups/tree/main/database/migrations/functions"
click node_db_triggers "https://github.com/cncf/open-community-groups/tree/main/database/migrations/functions/triggers"
click node_db_tests "https://github.com/cncf/open-community-groups/tree/main/database/tests"
click node_rust_tests "https://github.com/cncf/open-community-groups/tree/main/ocg-server/src"
click node_e2e_tests "https://github.com/cncf/open-community-groups/tree/main/tests/e2e"
click node_helm_chart "https://github.com/cncf/open-community-groups/tree/main/charts/ocg"
click node_migrator "https://github.com/cncf/open-community-groups/blob/main/charts/ocg/templates/db_migrator_job.yaml"

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_ocg_server,node_ocg_redirector toneBlue
class node_router,node_handlers,node_templates,node_static_js,node_services,node_db_access,node_site_area,node_community_area,node_group_area,node_event_area,node_dashboard_area,node_auth_area,node_images_area,node_meetings_area,node_notifications_templates toneAmber
class node_db_schema,node_db_functions,node_db_triggers toneMint
class node_helm_chart,node_migrator toneRose
class node_db_tests,node_rust_tests,node_e2e_tests toneIndigo
```

## Components

### Runtime services

Deployed Rust services that handle user traffic and redirects.

- [ocg-server](https://github.com/cncf/open-community-groups/tree/main/ocg-server): web server · Main user-facing Rust service for the public site and dashboards. · `ocg-server`
- [redirector](https://github.com/cncf/open-community-groups/tree/main/ocg-redirector): redirect service · Separate Rust service for redirect handling and legacy links. · `ocg-redirector`

### Application server

The main server-rendered web application and its internal layers.

- [Router](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/router.rs): HTTP routing · Maps incoming requests to handlers and dashboard routes. · `ocg-server/src/router.rs`
- [Handlers](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers.rs): request handlers · Business endpoints for auth, site pages, communities, groups, events, dashboards, images, and meetings. · `ocg-server/src/handlers.rs`
- [Templates](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/templates.rs): askama views · Server-rendered page and fragment templates for the UI. · `ocg-server/src/templates.rs`
- [Client JS](https://github.com/cncf/open-community-groups/tree/main/ocg-server/static/js): browser behavior · Page interactivity, validation, dashboards, and explore widgets. · `ocg-server/static/js`
- [Services](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/services.rs): adapters · Cross-cutting service adapters for images, meetings, and notifications. · `ocg-server/src/services.rs`
- [DB access](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/db.rs): sql adapters · Rust modules that call PostgreSQL functions for each domain area. · `ocg-server/src/db.rs`
- [Public site](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/site.rs): site pages · Home, docs, stats, and explore surfaces for public discovery. · `ocg-server/src/handlers/site.rs`
- [Community pages](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/community.rs): community views · Community summaries, stats, and group discovery pages. · `ocg-server/src/handlers/community.rs`
- [Group pages](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/group.rs): group views · Group home, membership, event lists, and related public pages. · `ocg-server/src/handlers/group.rs`
- [Event pages](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/event.rs): event views · Event details, attendance, check-in, and CFS interactions. · `ocg-server/src/handlers/event.rs`
- [Dashboards](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/dashboard.rs): admin control plane · User, community, and group operational workflows and dashboards. · `ocg-server/src/handlers/dashboard.rs`
- [Auth](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/auth.rs): identity · Local accounts, social login, verification, and profile updates. · `ocg-server/src/handlers/auth.rs`
- [Images](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/images.rs): media service · Upload and retrieval paths for user and page images. · `ocg-server/src/handlers/images.rs`
- [Meetings](https://github.com/cncf/open-community-groups/blob/main/ocg-server/src/handlers/meetings.rs): meeting integration · Meeting lifecycle and Zoom-backed synchronization flows. · `ocg-server/src/handlers/meetings.rs`
- [Notifs UI](https://github.com/cncf/open-community-groups/blob/main/ocg-server/templates/notifications/base.html): mail templates · Email and in-app notification templates. · `ocg-server/templates/notifications/base.html`

### PostgreSQL domain

Schema, functions, and triggers that encode core business rules.

- [Schema](https://github.com/cncf/open-community-groups/tree/main/database/migrations/schema): migrations · Core tables, indexes, constraints, and schema evolution. · `database/migrations/schema`
- [Functions](https://github.com/cncf/open-community-groups/tree/main/database/migrations/functions): stored procedures · Business operations implemented as PostgreSQL functions by domain. · `database/migrations/functions`
- [Triggers](https://github.com/cncf/open-community-groups/tree/main/database/migrations/functions/triggers): db invariants · Database-side checks that enforce integrity and audit protections. · `database/migrations/functions/triggers`

### Operations

Packaging, deployment, and migration workflows.

- [Helm chart](https://github.com/cncf/open-community-groups/tree/main/charts/ocg): deployment · Kubernetes packaging for server, redirector, migrator, and PostgreSQL. · `charts/ocg`
- [Migrator](https://github.com/cncf/open-community-groups/blob/main/charts/ocg/templates/db_migrator_job.yaml): db job · Deployment job that applies database migrations. · `charts/ocg/templates/db_migrator_job.yaml`

### Quality

Testing and validation layers across Rust, SQL, and browser flows.

- [DB tests](https://github.com/cncf/open-community-groups/tree/main/database/tests): sql contract tests · Database schema and function tests mirroring the migration contract. · `database/tests`
- [Rust tests](https://github.com/cncf/open-community-groups/tree/main/ocg-server/src): unit/integration · Service, handler, and module tests in the Rust crates. · `ocg-server/src`
- [E2E tests](https://github.com/cncf/open-community-groups/tree/main/tests/e2e): browser workflows · Playwright coverage for public pages, auth, dashboards, and visual regressions. · `tests/e2e`

## Connections

- ocg-server → Router: routes · The server starts request routing here.
- Router → Handlers: dispatches · Routes are mapped to domain handlers.
- Handlers → DB access: queries · Handlers read and write through domain DB modules.
- Handlers → Services: uses · Handlers call adapters for images, meetings, and notifications.
- Handlers → Templates: renders · Responses are server-rendered through Askama templates.
- Templates → Client JS: enhanced by · Templates are paired with client-side interactivity.
- DB access → Functions: calls · Rust DB modules invoke PostgreSQL functions for business operations.
- DB access → Schema: depends on · Access code relies on the underlying tables and indexes.
- Functions → Triggers: protected by · Important invariants are enforced with triggers.
- Functions → Schema: operates on · Functions shape reads and writes over the schema.
- Public site → Handlers: served by · Public site routes are implemented in handlers.
- Community pages → Handlers: served by · Community pages are implemented in handlers.
- Group pages → Handlers: served by · Group pages are implemented in handlers.
- Event pages → Handlers: served by · Event pages are implemented in handlers.
- Dashboards → Handlers: served by · Dashboard workflows are implemented in handlers.
- Auth → Handlers: served by · Authentication flows are implemented in handlers.
- Images → Services: backed by · Image pages use the image service layer.
- Meetings → Services: backed by · Meeting pages use Zoom and meeting adapters.
- Notifs UI → Services: driven by · Notification templates are rendered from server-side orchestration.
- redirector → DB access: looks up redirects · The redirector resolves redirect targets through database access.
- Helm chart → ocg-server: deploys · The chart packages the main web server workload.
- Helm chart → redirector: deploys · The chart packages the redirector workload.
- Helm chart → Migrator: runs · The chart includes a database migration job.
- Migrator → Schema: applies · Migrations evolve the database schema.
- Rust tests → Handlers: covers · Rust tests exercise handlers and service logic.
- Rust tests → Services: covers · Rust tests exercise external service adapters.
- DB tests → Functions: covers · SQL tests validate stored procedures and queries.
- DB tests → Triggers: covers · SQL tests validate trigger behavior.
- E2E tests → ocg-server: exercises · Browser tests drive the deployed web application.
- E2E tests → Client JS: exercises · Browser tests cover client-side interactions.
