How 4hprojects/hellorun works
1. What this repository is
- HelloRun is a server-rendered Node.js web platform built around a single Express application.
- It combines public marketing pages, authenticated runner/organizer/admin portals, event operations, submissions, certificates, blog content, and a shop/commerce module.
2. Primary runtime and delivery model
- The app is rendered mostly with EJS templates under src/views, with shared layouts and partials.
- Static assets live in src/public and are complemented by some root-level css/ and js/ files.
- The main entrypoint is src/server.js, with routing and middleware layered around it.
3. Request handling architecture
- Requests flow through route modules in src/routes, then through middleware, then into controllers.
- Controllers are thin HTTP adapters; business logic is pushed into src/services, and persistence is handled through models and database helpers.
- This separation is important for drawing the system boundary: routes/middleware at the edge, services in the center, database/models at the core.
4. Identity, roles, and access control
- The app has a role-aware authorization model with at least three major personas: runner, organizer, and admin.
- Cross-cutting middleware enforces auth, CSRF, rate limits, role checks, organizer-event access, and shop access.
- The README confirms dual-role support: an organizer can also be a runner, so role logic is not mutually exclusive.
5. Core product domain: events and participation
- The main domain is running events: event creation, registration, public event pages, leaderboards, rankings, and results/submission review.
- Key services such as event-shadow, event-approval, registration-price, ranking, leaderboard, and public-event-list indicate a workflow where public discovery, registration, and result tracking are separate concerns.
- The event subsystem has both public-facing pages and organizer-managed operational views.
6. Runner workflow
- Runner-facing screens center on profile, dashboard, notifications, submissions, groups, badges, certificates, and event progress.
- Data flows for runners include registration history, accumulated activity, submission review state, leaderboard placement, and achievement progress.
- This area is represented by dedicated runner routes, runner controller logic, and dashboard partials that assemble many independent data widgets.
7. Organizer workflow
- Organizer functionality includes application onboarding, profile completion, event creation/editing, registrant management, submission review, onsite operations, QR/dashboard tools, payment proof review, and event-level shop management.
- There is a clear boundary between organizer self-service and admin oversight: organizers manage their own events, while admins review applications, govern policies, and handle platform-wide controls.
- Docs and routes show a mature workflow around event creation and organizer verification documents.
8. Admin and moderation layer
- The admin area includes user management, event oversight, blog moderation, communications, ads, badges, shop administration, submissions review, and policy content editing.
- Admin-specific pages and controllers suggest a central operations console rather than a separate application.
- Moderation flows appear in blog reports, review queues, payment reviews, and critical audit services.
9. Content, blog, and policy management
- The platform includes a blog subsystem with authorship, revisions, comments, likes, views, trending, and scheduled publishing.
- Static and governed content includes policy pages, cookie/privacy/terms packs, FAQ/about/contact pages, and SEO-oriented public pages.
- This content layer is not just informational; it supports trust, compliance, and discovery for the platform.
10. Commerce and monetization
- There is a separate shop subsystem for products, variants, inventory, cart/checkout, order management, payment review, and organizer vs platform product boundaries.
- Shop access is mediated by dedicated middleware and mirrored in both organizer and admin consoles.
- The architecture implies commerce is embedded into the same app, but kept logically isolated from event registration and submissions.
11. Certificates, badges, and proof verification
- Certificate generation and verification are first-class workflows, with a template system and dedicated verification pages.
- Achievement badges are also a separate subsystem, with templates, content, progress, notifications, and audits.
- Run proof handling is supported by OCR-focused client scripts and server-side integrity/review services, indicating automated plus manual validation.
12. Data storage and migration strategy
- The persistence layer is PostgreSQL-based, with explicit migration history under src/db/migrations.
- The schema shows phased expansion, including shadow tables and backfill/verification scripts for app users, event core, registration payment, submissions/certificates, rankings, and onsite operations.
- This suggests a hybrid architecture where legacy data is gradually bridged into the current schema rather than migrated in one step.
13. Supporting infrastructure and integrations
- Redis is present in src/config/redis.js, likely for sessions, rate limiting, caching, or transient workflow state.
- Upload handling is built in, with services, setup scripts, and upload directories for event images, organizer docs, and profile photos.
- External integrations include Google OAuth, Strava, OCR tooling, and a webhook route for timing-system data.
14. Operational scripts and test coverage
- The repo includes many maintenance scripts: backfills, cleanup, seeding, smoke tests, verification jobs, and live-sync checks.
- The test suite is broad and integration-heavy, covering auth, event flows, organizers, runners, shop, certificates, OCR, policies, security, and rate limiting.
- For architecture diagrams, this indicates a production monolith with significant operational tooling around database consistency and phased feature rollout.
Main entry points: services Services · routes Routes · controllers Controllers · views Views
Components 21
Runtime
Express app, middleware, and server-rendered delivery
- Server · Main Node.js entrypoint that boots the app and wires middleware/routes.
src/server.js - Routes · Route layer that splits traffic across auth, pages, runner, organizer, admin, shop, and webhooks.
src/routes - Middleware · Cross-cutting auth, CSRF, rate limit, role, shop, and organizer-event access controls.
src/middleware - Controllers · Thin request handlers that adapt route inputs to services and views.
src/controllers - Views · Server-rendered EJS pages, layouts, and partials for public and authenticated screens.
src/views
Product domains
Core user-facing workflows and business capabilities
- Services · Core application logic spanning events, runners, organizer operations, content, certificates, shop, and integrations.
src/services - Runner portal · Runner dashboard, profile, notifications, groups, submissions, badges, and certificates.
src/views/runner - Organizer portal · Organizer onboarding, profile completion, event creation, registrants, submissions, onsite ops, and event shop management.
src/views/organizer - Admin console · Platform oversight for users, events, moderation, communications, ads, badges, and shop administration.
src/views/admin - Events · Public event discovery, registration, approvals, leaderboards, rankings, and event lifecycle management.
src/services/event-approval.service.js - Submissions · Run proof intake, review, shadow validation, and submission integrity handling.
src/services/submission.service.js - Certificates · Certificate templates, verification, badge content, progress, notification, and audit workflows.
src/services/certificate.service.js - Shop · Products, variants, inventory, carts, orders, and payment review for platform and organizer commerce.
src/services/shop/order.service.js
Content
Blog, policies, and governed public pages
Infrastructure
Storage, uploads, integrations, and operational tooling
- Postgres · Database connection and schema-backed persistence for users, events, registrations, submissions, shop, and content.
src/config/db.js - Migrations · Phased SQL migration set including shadow tables, backfills, and feature rollouts.
src/db/migrations - Models · Database-facing model layer for users, events, blogs, submissions, certificates, shop, badges, and settings.
src/models - Uploads · Uploaded event images, organizer documents, and profile photos served from public storage.
src/public/uploads - Integrations · Google OAuth, Strava, OCR tooling, timing-system webhooks, and Redis-backed runtime support.
src/services/strava.service.js - Ops scripts · Backfills, smoke tests, verification jobs, seeding, cleanup, sync, and publish automation.
src/scripts
Connections 23
- Server → Routes: mounts · Server attaches the route modules.
- Server → Middleware: applies · Server wires shared request guards and processing.
- Routes → Controllers: dispatches to · Routes hand requests to controllers.
- Controllers → Services: calls · Controllers delegate business logic to services.
- Services → Models: reads/writes · Services use models for domain persistence.
- Models → Postgres: uses · Models persist through the Postgres layer.
- Postgres → Migrations: evolves via · Schema changes are managed by SQL migrations.
- Controllers → Views: renders · Controllers render server-side templates.
- Views → Runner portal: includes · Runner templates assemble dashboard and workflow pages.
- Views → Organizer portal: includes · Organizer templates assemble event operations pages.
- Views → Admin console: includes · Admin templates assemble moderation and platform ops pages.
- Services → Events: covers · Event, registration, ranking, leaderboard, and approval logic.
- Services → Submissions: covers · Submission intake, review, and integrity logic.
- Services → Certificates: covers · Certificate and badge workflows.
- Services → Shop: covers · Commerce, inventory, ordering, and payment review.
- Services → Blog: covers · Blog composition, publishing, interaction, and trending.
- Routes → Policies: serves · Public and policy routes expose governed pages.
- Services → Uploads: stores files · Upload service and related workflows write media and documents.
- Services → Integrations: integrates · Services coordinate OAuth, Strava, OCR, Redis, and webhooks.
- Ops scripts → Migrations: runs · Operational scripts apply or validate database changes.
- Ops scripts → Postgres: repairs · Backfills and verifications operate against live data.
- Middleware → Routes: guards · Access control and request validation protect routes.
- Controllers → Routes: served by · Controllers are exposed through route modules.