How cncf/open-community-groups works
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: handlers.rs Handlers · services.rs Services · db.rs DB access · functions Functions
Components 25
Runtime services
Deployed Rust services that handle user traffic and redirects.
- ocg-server · Main user-facing Rust service for the public site and dashboards.
ocg-server - redirector · Separate Rust service for redirect handling and legacy links.
ocg-redirector
Application server
The main server-rendered web application and its internal layers.
- Router · Maps incoming requests to handlers and dashboard routes.
ocg-server/src/router.rs - Handlers · Business endpoints for auth, site pages, communities, groups, events, dashboards, images, and meetings.
ocg-server/src/handlers.rs - Templates · Server-rendered page and fragment templates for the UI.
ocg-server/src/templates.rs - Client JS · Page interactivity, validation, dashboards, and explore widgets.
ocg-server/static/js - Services · Cross-cutting service adapters for images, meetings, and notifications.
ocg-server/src/services.rs - DB access · Rust modules that call PostgreSQL functions for each domain area.
ocg-server/src/db.rs - Public site · Home, docs, stats, and explore surfaces for public discovery.
ocg-server/src/handlers/site.rs - Community pages · Community summaries, stats, and group discovery pages.
ocg-server/src/handlers/community.rs - Group pages · Group home, membership, event lists, and related public pages.
ocg-server/src/handlers/group.rs - Event pages · Event details, attendance, check-in, and CFS interactions.
ocg-server/src/handlers/event.rs - Dashboards · User, community, and group operational workflows and dashboards.
ocg-server/src/handlers/dashboard.rs - Auth · Local accounts, social login, verification, and profile updates.
ocg-server/src/handlers/auth.rs - Images · Upload and retrieval paths for user and page images.
ocg-server/src/handlers/images.rs - Meetings · Meeting lifecycle and Zoom-backed synchronization flows.
ocg-server/src/handlers/meetings.rs - Notifs UI · Email and in-app notification templates.
ocg-server/templates/notifications/base.html
PostgreSQL domain
Schema, functions, and triggers that encode core business rules.
- Schema · Core tables, indexes, constraints, and schema evolution.
database/migrations/schema - Functions · Business operations implemented as PostgreSQL functions by domain.
database/migrations/functions - Triggers · Database-side checks that enforce integrity and audit protections.
database/migrations/functions/triggers
Operations
Packaging, deployment, and migration workflows.
- Helm chart · Kubernetes packaging for server, redirector, migrator, and PostgreSQL.
charts/ocg - Migrator · 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 · Database schema and function tests mirroring the migration contract.
database/tests - Rust tests · Service, handler, and module tests in the Rust crates.
ocg-server/src - E2E tests · Playwright coverage for public pages, auth, dashboards, and visual regressions.
tests/e2e
Connections 30
- 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.