# brocodeadi/hackforge architecture

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

- Interactive diagram: https://gitdiagram.com/brocodeadi/hackforge
- Repository: https://github.com/brocodeadi/hackforge

## Overview

#### Purpose and Deployment
HackForge is a Windows-oriented Electron desktop workspace combining hackathon discovery with team project execution. The Electron shell owns application lifecycle, single-instance behavior, custom local protocol handling, and backend startup; the React SPA is the renderer; a local Node/Express service exposes domain APIs.
- `electron/main.js`
- `electron/preload.js`
- `src/server.js`

#### Renderer Entry and Workspace Boundary
The frontend is a Vite React application with a mode selector separating Fetcher and Manager experiences. Shared layout, identity/profile state, API access, and visual shell components provide cross-mode concerns rather than duplicating them per subsystem.
- `frontend/src/main.jsx`
- `frontend/src/App.jsx`
- `frontend/src/shared/layout/ModeLayout.jsx`

#### Discovery Ingestion Pipeline
The catalog pipeline obtains opportunities from Devpost, MLH, Hack Club, feeds, and HTML sources through adapter abstractions. It normalizes and validates source data, deduplicates records, then persists a catalog snapshot. This is the boundary between unreliable external source formats and the application’s canonical hackathon model.
- `src/services/ingestion/IngestionEngine.js`
- `src/services/ingestion/adapters/BaseSourceAdapter.js`
- `src/services/ingestion/deduplicator.js`

#### Catalog API and Discovery UI
Hackathon routes expose catalog search/filter/detail behavior to Fetcher pages. The UI presents exploration, saved opportunities, profile-driven discovery, and alerts; shared API and local saved-store utilities bridge renderer state to backend/profile-specific persistence.
- `src/routes/hackathons.js`
- `frontend/src/fetcher/pages/ExplorePage.jsx`
- `frontend/src/shared/lib/api.js`

#### Fit and Recommendation Engine
Recommendations score normalized hackathons against user skills, technology preferences, interests, experience, eligibility, and travel constraints. Semantic analysis/cache support richer matching while keeping recommendation computation behind a service boundary; recommendation routes are the HTTP-facing adapter.
- `src/services/fit/HackathonFitEngine.js`
- `src/services/fit/SemanticAnalyzer.js`
- `src/routes/recommendations.js`

#### Alerts and Change Detection
The notifications subsystem compares catalog changes, evaluates discovery/update/deadline rules against preferences, records notification events, and delivers through pluggable in-app or email providers. It is decoupled from ingestion through stored catalog state and notification-domain stores.
- `src/services/notifications/AlertEngine.js`
- `src/services/notifications/RuleEvaluator.js`
- `src/services/notifications/providers/EmailNotificationProvider.js`

#### Manager Domain and AI Planning
Manager APIs govern projects, members/roles, tasks, review transitions, and generated plans. Role authority (`CAPTAIN`, `ADMIN`, `MEMBER`) is enforced in domain services; the four-stage task flow supports review feedback. Plan generation uses OpenRouter when configured and deterministic templates otherwise, preserving generation provenance for the UI.
- `src/routes/managerCore.js`
- `src/services/manager/taskFlowService.js`
- `src/services/manager/planGenerator.js`

#### Persistence and External Dependencies
Application state is local JSON snapshot storage with repository/store abstractions and atomic-write intent. Material external dependencies are hackathon source websites/feeds, optional OpenRouter AI API, and optional email delivery; the desktop backend is launched locally rather than hosted infrastructure.
- `src/services/storage/CatalogStore.js`
- `src/services/storage/HackathonRepository.js`
- `src/services/ai/OpenRouterProvider.js`

Main entry points: [`frontend/src/shared/lib/api.js`](https://github.com/brocodeadi/hackforge/blob/master/frontend/src/shared/lib/api.js) (Renderer API client), [`src/services/notifications/AlertEngine.js`](https://github.com/brocodeadi/hackforge/blob/master/src/services/notifications/AlertEngine.js) (Alert engine), [`src/services/fit/HackathonFitEngine.js`](https://github.com/brocodeadi/hackforge/blob/master/src/services/fit/HackathonFitEngine.js) (Fit engine), [`src/routes/managerCore.js`](https://github.com/brocodeadi/hackforge/blob/master/src/routes/managerCore.js) (Manager API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop Runtime"]
  node_electron_main["Electron shell<br/>desktop runtime<br/>[main.js]"]
  node_preload["Preload bridge<br/>Electron bridge<br/>[preload.js]"]
  node_server["Local Express API<br/>Node service<br/>[server.js]"]
end

subgraph group_renderer["React Renderer"]
  node_renderer_entry["Vite entry<br/>React entry<br/>[main.jsx]"]
  node_app["Workspace app<br/>React shell<br/>[App.jsx]"]
  node_mode_layout["Mode layout<br/>shared UI<br/>[ModeLayout.jsx]"]
  node_fetcher_ui["Fetcher exploration<br/>discovery UI<br/>[ExplorePage.jsx]"]
  node_renderer_api["Renderer API client<br/>shared API client<br/>[api.js]"]
end

subgraph group_discovery["Discovery Backend"]
  node_ingestion["Ingestion engine<br/>catalog pipeline<br/>[IngestionEngine.js]"]
  node_source_adapter["Source adapters<br/>source abstraction"]
  node_deduplicator["Catalog deduplicator<br/>normalization stage<br/>[deduplicator.js]"]
  node_catalog_store[("Catalog store<br/>local JSON storage<br/>[CatalogStore.js]")]
  node_hackathon_repo[("Hackathon repository<br/>catalog repository")]
  node_hackathon_routes["Hackathon API<br/>Express routes<br/>[hackathons.js]"]
  node_fit_engine["Fit engine<br/>recommendation service"]
  node_semantic_analyzer["Semantic analyzer<br/>matching service"]
  node_recommendation_routes["Recommendation API<br/>Express routes<br/>[recommendations.js]"]
  node_alert_engine["Alert engine<br/>notification service<br/>[AlertEngine.js]"]
  node_rule_evaluator["Alert rules<br/>notification rules<br/>[RuleEvaluator.js]"]
  node_email_provider["Email provider<br/>notification provider"]
end

subgraph group_manager["Manager Backend"]
  node_manager_routes["Manager API<br/>Express routes<br/>[managerCore.js]"]
  node_task_flow["Task flow service<br/>manager domain service<br/>[taskFlowService.js]"]
  node_plan_generator["Plan generator<br/>AI planning service<br/>[planGenerator.js]"]
end

subgraph group_external["External Dependencies"]
  node_openrouter{{"OpenRouter API<br/>optional AI provider"}}
  node_sources{{"Hackathon sources<br/>websites and feeds"}}
  node_email_delivery{{"Email delivery<br/>optional external delivery"}}
end

node_electron_main -->|"starts local backend"| node_server
node_electron_main -->|"loads"| node_preload
node_preload -->|"bridges desktop APIs"| node_renderer_entry
node_renderer_entry -->|"renders"| node_app
node_app -->|"uses"| node_mode_layout
node_mode_layout -->|"hosts Fetcher mode"| node_fetcher_ui
node_fetcher_ui -->|"queries through"| node_renderer_api
node_renderer_api -->|"catalog HTTP"| node_hackathon_routes
node_renderer_api -->|"recommendation HTTP"| node_recommendation_routes
node_renderer_api -->|"manager HTTP"| node_manager_routes
node_source_adapter -->|"fetches"| node_sources
node_ingestion -->|"orchestrates"| node_source_adapter
node_ingestion -->|"normalizes and deduplicates"| node_deduplicator
node_deduplicator -->|"writes snapshot"| node_catalog_store
node_catalog_store -->|"backs"| node_hackathon_repo
node_hackathon_routes -->|"searches catalog"| node_hackathon_repo
node_recommendation_routes -->|"delegates"| node_fit_engine
node_fit_engine -->|"scores catalog"| node_hackathon_repo
node_fit_engine -->|"enriches matching"| node_semantic_analyzer
node_alert_engine -->|"compares stored changes"| node_catalog_store
node_alert_engine -->|"evaluates preferences"| node_rule_evaluator
node_alert_engine -.->|"delivers alerts"| node_email_provider
node_email_provider -.->|"sends"| node_email_delivery
node_manager_routes -->|"manages tasks and reviews"| node_task_flow
node_manager_routes -->|"generates plans"| node_plan_generator
node_plan_generator -.->|"uses when configured"| node_openrouter

click node_electron_main "https://github.com/brocodeadi/hackforge/blob/master/electron/main.js"
click node_preload "https://github.com/brocodeadi/hackforge/blob/master/electron/preload.js"
click node_server "https://github.com/brocodeadi/hackforge/blob/master/src/server.js"
click node_renderer_entry "https://github.com/brocodeadi/hackforge/blob/master/frontend/src/main.jsx"
click node_app "https://github.com/brocodeadi/hackforge/blob/master/frontend/src/App.jsx"
click node_mode_layout "https://github.com/brocodeadi/hackforge/blob/master/frontend/src/shared/layout/ModeLayout.jsx"
click node_fetcher_ui "https://github.com/brocodeadi/hackforge/blob/master/frontend/src/fetcher/pages/ExplorePage.jsx"
click node_renderer_api "https://github.com/brocodeadi/hackforge/blob/master/frontend/src/shared/lib/api.js"
click node_ingestion "https://github.com/brocodeadi/hackforge/blob/master/src/services/ingestion/IngestionEngine.js"
click node_source_adapter "https://github.com/brocodeadi/hackforge/blob/master/src/services/ingestion/adapters/BaseSourceAdapter.js"
click node_deduplicator "https://github.com/brocodeadi/hackforge/blob/master/src/services/ingestion/deduplicator.js"
click node_catalog_store "https://github.com/brocodeadi/hackforge/blob/master/src/services/storage/CatalogStore.js"
click node_hackathon_repo "https://github.com/brocodeadi/hackforge/blob/master/src/services/storage/HackathonRepository.js"
click node_hackathon_routes "https://github.com/brocodeadi/hackforge/blob/master/src/routes/hackathons.js"
click node_fit_engine "https://github.com/brocodeadi/hackforge/blob/master/src/services/fit/HackathonFitEngine.js"
click node_semantic_analyzer "https://github.com/brocodeadi/hackforge/blob/master/src/services/fit/SemanticAnalyzer.js"
click node_recommendation_routes "https://github.com/brocodeadi/hackforge/blob/master/src/routes/recommendations.js"
click node_alert_engine "https://github.com/brocodeadi/hackforge/blob/master/src/services/notifications/AlertEngine.js"
click node_rule_evaluator "https://github.com/brocodeadi/hackforge/blob/master/src/services/notifications/RuleEvaluator.js"
click node_email_provider "https://github.com/brocodeadi/hackforge/blob/master/src/services/notifications/providers/EmailNotificationProvider.js"
click node_manager_routes "https://github.com/brocodeadi/hackforge/blob/master/src/routes/managerCore.js"
click node_task_flow "https://github.com/brocodeadi/hackforge/blob/master/src/services/manager/taskFlowService.js"
click node_plan_generator "https://github.com/brocodeadi/hackforge/blob/master/src/services/manager/planGenerator.js"
click node_openrouter "https://github.com/brocodeadi/hackforge/blob/master/src/services/ai/OpenRouterProvider.js"

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_electron_main,node_preload,node_server toneBlue
class node_renderer_entry,node_app,node_mode_layout,node_fetcher_ui,node_renderer_api toneAmber
class node_ingestion,node_source_adapter,node_deduplicator,node_catalog_store,node_hackathon_repo,node_hackathon_routes,node_fit_engine,node_semantic_analyzer,node_recommendation_routes,node_alert_engine,node_rule_evaluator,node_email_provider toneMint
class node_manager_routes,node_task_flow,node_plan_generator toneRose
class node_openrouter,node_sources,node_email_delivery toneIndigo
```

## Components

### Desktop Runtime

- [Electron shell](https://github.com/brocodeadi/hackforge/blob/master/electron/main.js): desktop runtime · Owns lifecycle, local protocol, single-instance behavior, and backend startup. · `electron/main.js`
- [Preload bridge](https://github.com/brocodeadi/hackforge/blob/master/electron/preload.js): Electron bridge · `electron/preload.js`
- [Local Express API](https://github.com/brocodeadi/hackforge/blob/master/src/server.js): Node service · Locally launched API host for discovery and manager domains. · `src/server.js`

### React Renderer

- [Vite entry](https://github.com/brocodeadi/hackforge/blob/master/frontend/src/main.jsx): React entry · `frontend/src/main.jsx`
- [Workspace app](https://github.com/brocodeadi/hackforge/blob/master/frontend/src/App.jsx): React shell · Selects Fetcher or Manager workspace mode. · `frontend/src/App.jsx`
- [Mode layout](https://github.com/brocodeadi/hackforge/blob/master/frontend/src/shared/layout/ModeLayout.jsx): shared UI · Provides shared workspace layout and cross-mode shell concerns. · `frontend/src/shared/layout/ModeLayout.jsx`
- [Fetcher exploration](https://github.com/brocodeadi/hackforge/blob/master/frontend/src/fetcher/pages/ExplorePage.jsx): discovery UI · Explores catalog results and saved opportunities. · `frontend/src/fetcher/pages/ExplorePage.jsx`
- [Renderer API client](https://github.com/brocodeadi/hackforge/blob/master/frontend/src/shared/lib/api.js): shared API client · `frontend/src/shared/lib/api.js`

### Discovery Backend

- [Ingestion engine](https://github.com/brocodeadi/hackforge/blob/master/src/services/ingestion/IngestionEngine.js): catalog pipeline · Orchestrates canonical catalog ingestion from unreliable sources. · `src/services/ingestion/IngestionEngine.js`
- [Source adapters](https://github.com/brocodeadi/hackforge/blob/master/src/services/ingestion/adapters/BaseSourceAdapter.js): source abstraction · Adapts Devpost, MLH, Hack Club, feeds, and HTML sources. · `src/services/ingestion/adapters/BaseSourceAdapter.js`
- [Catalog deduplicator](https://github.com/brocodeadi/hackforge/blob/master/src/services/ingestion/deduplicator.js): normalization stage · Removes duplicate normalized opportunity records. · `src/services/ingestion/deduplicator.js`
- [Catalog store](https://github.com/brocodeadi/hackforge/blob/master/src/services/storage/CatalogStore.js): local JSON storage · Persists catalog snapshots with atomic-write intent. · `src/services/storage/CatalogStore.js`
- [Hackathon repository](https://github.com/brocodeadi/hackforge/blob/master/src/services/storage/HackathonRepository.js): catalog repository · Provides canonical catalog access to domain consumers. · `src/services/storage/HackathonRepository.js`
- [Hackathon API](https://github.com/brocodeadi/hackforge/blob/master/src/routes/hackathons.js): Express routes · Exposes catalog search, filtering, and detail endpoints. · `src/routes/hackathons.js`
- [Fit engine](https://github.com/brocodeadi/hackforge/blob/master/src/services/fit/HackathonFitEngine.js): recommendation service · Scores opportunities against profile, eligibility, and travel constraints. · `src/services/fit/HackathonFitEngine.js`
- [Semantic analyzer](https://github.com/brocodeadi/hackforge/blob/master/src/services/fit/SemanticAnalyzer.js): matching service · Provides cached semantic analysis for richer fit matching. · `src/services/fit/SemanticAnalyzer.js`
- [Recommendation API](https://github.com/brocodeadi/hackforge/blob/master/src/routes/recommendations.js): Express routes · `src/routes/recommendations.js`
- [Alert engine](https://github.com/brocodeadi/hackforge/blob/master/src/services/notifications/AlertEngine.js): notification service · Detects catalog changes and records or delivers eligible alerts. · `src/services/notifications/AlertEngine.js`
- [Alert rules](https://github.com/brocodeadi/hackforge/blob/master/src/services/notifications/RuleEvaluator.js): notification rules · Evaluates discovery, update, and deadline rules against preferences. · `src/services/notifications/RuleEvaluator.js`
- [Email provider](https://github.com/brocodeadi/hackforge/blob/master/src/services/notifications/providers/EmailNotificationProvider.js): notification provider · `src/services/notifications/providers/EmailNotificationProvider.js`

### Manager Backend

- [Manager API](https://github.com/brocodeadi/hackforge/blob/master/src/routes/managerCore.js): Express routes · Governs projects, members, roles, tasks, reviews, and plans. · `src/routes/managerCore.js`
- [Task flow service](https://github.com/brocodeadi/hackforge/blob/master/src/services/manager/taskFlowService.js): manager domain service · Enforces four-stage task and review-feedback transitions. · `src/services/manager/taskFlowService.js`
- [Plan generator](https://github.com/brocodeadi/hackforge/blob/master/src/services/manager/planGenerator.js): AI planning service · Uses OpenRouter when available and deterministic templates otherwise. · `src/services/manager/planGenerator.js`

### External Dependencies

- [OpenRouter API](https://github.com/brocodeadi/hackforge/blob/master/src/services/ai/OpenRouterProvider.js): optional AI provider · `src/services/ai/OpenRouterProvider.js`
- **Hackathon sources**: websites and feeds
- **Email delivery**: optional external delivery

## Connections

- Electron shell → Local Express API: starts local backend
- Electron shell → Preload bridge: loads
- Preload bridge → Vite entry: bridges desktop APIs
- Vite entry → Workspace app: renders
- Workspace app → Mode layout: uses
- Mode layout → Fetcher exploration: hosts Fetcher mode
- Fetcher exploration → Renderer API client: queries through
- Renderer API client → Hackathon API: catalog HTTP
- Renderer API client → Recommendation API: recommendation HTTP
- Renderer API client → Manager API: manager HTTP
- Source adapters → Hackathon sources: fetches
- Ingestion engine → Source adapters: orchestrates
- Ingestion engine → Catalog deduplicator: normalizes and deduplicates
- Catalog deduplicator → Catalog store: writes snapshot
- Catalog store → Hackathon repository: backs
- Hackathon API → Hackathon repository: searches catalog
- Recommendation API → Fit engine: delegates
- Fit engine → Hackathon repository: scores catalog
- Fit engine → Semantic analyzer: enriches matching
- Alert engine → Catalog store: compares stored changes
- Alert engine → Alert rules: evaluates preferences
- Alert engine → Email provider: delivers alerts
- Email provider → Email delivery: sends
- Manager API → Task flow service: manages tasks and reviews
- Manager API → Plan generator: generates plans
- Plan generator → OpenRouter API: uses when configured
