# abhaytopno/contribution-hub architecture

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

- Interactive diagram: https://gitdiagram.com/abhaytopno/contribution-hub
- Repository: https://github.com/abhaytopno/contribution-hub

## Overview

1. **High-level shape**
   - Contribution Hub is a two-tier application: a **Next.js frontend** and a **Django backend**.
   - The frontend is responsible for discovery, browsing, and detail pages.
   - The backend owns persistence, domain logic, and enrichment from external APIs.

2. **Frontend responsibilities**
   - The frontend lives under `frontend/src/app` and uses the Next.js App Router.
   - Main routes are:
     - `/organizations` for browsing organizations
     - `/organization/[name]` for organization detail
     - `/organization/[name]/contribute` for repositories tied to an organization
     - `/organization/[name]/repository/[...params]` for repository detail
   - Page-level components are split into reusable UI blocks in `src/components`, with separate folders for list, organization detail, contribute view, and repository view.

3. **Frontend data access**
   - The frontend uses **Apollo Client** (`src/lib/apolloClient.ts`) and GraphQL query modules in `src/queries`.
   - That means the browser-facing app does not talk directly to GitHub or other external services; it fetches structured data from the backend API.
   - The query layer is the main boundary between presentation and server-side data.

4. **Backend structure**
   - The backend is a Django project under `backend/setting`.
   - It is split into three domain apps:
     - `gsoc_api` for organization data and GSoC-specific metadata
     - `github` for GitHub-related integration and schema
     - `repos` for repository-level data and contributor/issue information
   - Each app has its own `models.py`, `views.py`, `schema.py`, and tests, which suggests a modular domain-driven layout.

5. **Likely API style**
   - The presence of `schema.py` in multiple apps and Apollo Client on the frontend strongly indicates a **GraphQL API** surface.
   - The backend is therefore likely exposing a unified query layer over organizations, repositories, and related enrichment data rather than multiple ad hoc REST endpoints.

6. **Core data model**
   - The domain appears centered on **organizations** and **repositories**:
     - organizations store ratings, total projects, and GitHub URLs
     - repositories store repository-specific metadata for contribution discovery
   - The backend migrations show the organization model evolved over time to add rating, project count, and GitHub URL fields, which are important for ranking and linking data.

7. **External data ingestion**
   - The `gsoc_api/management/commands` folder contains batch commands:
     - `fetch_gsoc_orgs`
     - `fetch_github_url`
   - These commands populate or enrich the database with organization data and GitHub URLs.
   - The README explicitly mentions required external credentials for **GitHub** and **Google Custom Search Engine**, so the backend uses third-party services to discover and enrich repository/org metadata.

8. **GitHub integration boundary**
   - The `backend/api/github` and `backend/api/repos/github.py` modules indicate GitHub-specific querying or normalization logic is isolated from the core organization models.
   - This keeps GitHub API usage and response parsing out of the frontend and away from generic business logic.
   - The architecture likely uses this layer both for ingestion jobs and for user-facing repository data.

9. **Caching and common utilities**
   - `backend/api/common/cache.py` suggests some shared caching layer or helper used across backend apps.
   - Shared helpers in `utils.py` files indicate common transformation, filtering, or data shaping logic is centralized per domain instead of duplicated in views.

10. **Deployment and runtime**
   - The repo is container-first: `docker-compose.yml`, `dockerfile.backend`, and `dockerfile.frontend` define local deployment.
   - The README references separate healthy services for backend, frontend, and database, so the architecture includes:
     - a Django API container
     - a Next.js UI container
     - a database container
   - Operationally, the app is initialized by running migrations and then executing ingestion commands to seed the organization and repository catalog.

11. **User-facing flow**
   - A user lands on the frontend, browses or filters organizations, opens an organization detail page, then navigates to contribution opportunities and repository-specific pages.
   - Each page pulls its data through Apollo-backed queries from the backend, which serves already-curated, GitHub-enriched content from the database.

12. **Diagram boundaries to emphasize**
   - Put a clear boundary between **frontend presentation/querying** and **backend domain/data ingestion**.
   - Put another boundary between the backend and external services:
     - GitHub API / GitHub search
     - Google Custom Search
   - The database sits behind the backend only; the frontend never accesses it directly.

Main entry points: [`backend/api/gsoc_api`](https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/gsoc_api) (GSoC orgs), [`backend/api/repos`](https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/repos) (Repositories), [`frontend/src/lib/apolloClient.ts`](https://github.com/abhaytopno/contribution-hub/blob/main/frontend/src/lib/apolloClient.ts) (Apollo client), [`backend/api/github`](https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/github) (GitHub integration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_frontend_app["App Router<br/>next.js routes"]
  node_frontend_org_views["Org views<br/>ui components"]
  node_frontend_repo_views["Repo views<br/>ui components"]
  node_frontend_queries["GraphQL queries<br/>apollo query layer"]
  node_frontend_apollo["Apollo client<br/>graphql client<br/>[apolloClient.ts]"]
end

subgraph group_backend["Backend"]
  node_backend_settings["Django project<br/>project config"]
  node_backend_gsoc_api["GSoC orgs<br/>django app"]
  node_backend_repos["Repositories<br/>django app"]
  node_backend_github["GitHub integration<br/>django app"]
  node_backend_common["Shared cache<br/>shared backend<br/>[cache.py]"]
  node_backend_ingest_orgs["Org ingestion<br/>management commands"]
  node_backend_schema_orgs["Org schema<br/>graphql schema<br/>[schema.py]"]
  node_backend_schema_repos["Repo schema<br/>graphql schema<br/>[schema.py]"]
  node_backend_schema_github["GitHub schema<br/>graphql schema<br/>[schema.py]"]
  node_backend_models_orgs[("Org models<br/>domain models<br/>[models.py]")]
  node_backend_models_repos[("Repo models<br/>domain models<br/>[models.py]")]
end

subgraph group_external["External services"]
  node_database[("Database<br/>persistent store")]
  node_github_api{{"GitHub API<br/>external api"}}
  node_gcs_engine{{"Search API<br/>external api"}}
end

node_frontend_app -->|"renders"| node_frontend_org_views
node_frontend_app -->|"renders"| node_frontend_repo_views
node_frontend_org_views -->|"loads data"| node_frontend_queries
node_frontend_repo_views -->|"loads data"| node_frontend_queries
node_frontend_queries -->|"uses client"| node_frontend_apollo
node_frontend_apollo -->|"queries"| node_backend_schema_orgs
node_frontend_apollo -->|"queries"| node_backend_schema_repos
node_frontend_apollo -->|"queries"| node_backend_schema_github
node_backend_settings -->|"routes"| node_backend_gsoc_api
node_backend_settings -->|"routes"| node_backend_repos
node_backend_settings -->|"routes"| node_backend_github
node_backend_gsoc_api -->|"persists"| node_backend_models_orgs
node_backend_repos -->|"persists"| node_backend_models_repos
node_backend_gsoc_api -->|"exposes"| node_backend_schema_orgs
node_backend_repos -->|"exposes"| node_backend_schema_repos
node_backend_github -->|"exposes"| node_backend_schema_github
node_backend_gsoc_api -->|"seeds"| node_backend_ingest_orgs
node_backend_gsoc_api -.->|"shares"| node_backend_common
node_backend_repos -.->|"shares"| node_backend_common
node_backend_gsoc_api -->|"reads/writes"| node_database
node_backend_repos -->|"reads/writes"| node_database
node_backend_models_orgs -->|"stores"| node_database
node_backend_models_repos -->|"stores"| node_database
node_backend_github -->|"fetches"| node_github_api
node_backend_ingest_orgs -->|"searches"| node_gcs_engine
node_backend_ingest_orgs -->|"enriches"| node_github_api
node_backend_schema_orgs -->|"resolves"| node_backend_models_orgs
node_backend_schema_repos -->|"resolves"| node_backend_models_repos
node_backend_schema_github -->|"delegates"| node_backend_github

click node_frontend_app "https://github.com/abhaytopno/contribution-hub/tree/main/frontend/src/app"
click node_frontend_org_views "https://github.com/abhaytopno/contribution-hub/tree/main/frontend/src/components/organization"
click node_frontend_repo_views "https://github.com/abhaytopno/contribution-hub/tree/main/frontend/src/components/repository"
click node_frontend_queries "https://github.com/abhaytopno/contribution-hub/tree/main/frontend/src/queries"
click node_frontend_apollo "https://github.com/abhaytopno/contribution-hub/blob/main/frontend/src/lib/apolloClient.ts"
click node_backend_settings "https://github.com/abhaytopno/contribution-hub/tree/main/backend/setting"
click node_backend_gsoc_api "https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/gsoc_api"
click node_backend_repos "https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/repos"
click node_backend_github "https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/github"
click node_backend_common "https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/common/cache.py"
click node_backend_ingest_orgs "https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/gsoc_api/management/commands"
click node_backend_schema_orgs "https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/gsoc_api/schema.py"
click node_backend_schema_repos "https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/repos/schema.py"
click node_backend_schema_github "https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/github/schema.py"
click node_backend_models_orgs "https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/gsoc_api/models.py"
click node_backend_models_repos "https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/repos/models.py"

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_frontend_app,node_frontend_org_views,node_frontend_repo_views,node_frontend_queries,node_frontend_apollo toneBlue
class node_backend_settings,node_backend_gsoc_api,node_backend_repos,node_backend_github,node_backend_common,node_backend_ingest_orgs,node_backend_schema_orgs,node_backend_schema_repos,node_backend_schema_github,node_backend_models_orgs,node_backend_models_repos toneAmber
class node_database,node_github_api,node_gcs_engine toneMint
```

## Components

### Frontend

Next.js UI and client-side data access

- [App Router](https://github.com/abhaytopno/contribution-hub/tree/main/frontend/src/app): next.js routes · Route shells and page entrypoints for organizations and repositories · `frontend/src/app`
- [Org views](https://github.com/abhaytopno/contribution-hub/tree/main/frontend/src/components/organization): ui components · List, detail, and contribution screens for organizations · `frontend/src/components/organization`
- [Repo views](https://github.com/abhaytopno/contribution-hub/tree/main/frontend/src/components/repository): ui components · Repository detail sections and state handling · `frontend/src/components/repository`
- [GraphQL queries](https://github.com/abhaytopno/contribution-hub/tree/main/frontend/src/queries): apollo query layer · Frontend query modules that fetch structured data from the backend · `frontend/src/queries`
- [Apollo client](https://github.com/abhaytopno/contribution-hub/blob/main/frontend/src/lib/apolloClient.ts): graphql client · Browser-side GraphQL client configuration · `frontend/src/lib/apolloClient.ts`

### Backend

Django API, domain apps, and ingestion

- [Django project](https://github.com/abhaytopno/contribution-hub/tree/main/backend/setting): project config · ASGI/WSGI entrypoints and URL wiring for the API · `backend/setting`
- [GSoC orgs](https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/gsoc_api): django app · Organization catalog and GSoC metadata · `backend/api/gsoc_api`
- [Repositories](https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/repos): django app · Repository discovery, contributors, and issue data · `backend/api/repos`
- [GitHub integration](https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/github): django app · GitHub-facing schema, views, and normalization helpers · `backend/api/github`
- [Shared cache](https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/common/cache.py): shared backend · Common caching and cross-app helpers · `backend/api/common/cache.py`
- [Org ingestion](https://github.com/abhaytopno/contribution-hub/tree/main/backend/api/gsoc_api/management/commands): management commands · Batch jobs that fetch and enrich organization records · `backend/api/gsoc_api/management/commands`
- [Org schema](https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/gsoc_api/schema.py): graphql schema · GraphQL surface for organizations and ranking fields · `backend/api/gsoc_api/schema.py`
- [Repo schema](https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/repos/schema.py): graphql schema · GraphQL surface for repository and contribution data · `backend/api/repos/schema.py`
- [GitHub schema](https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/github/schema.py): graphql schema · GraphQL surface for GitHub-backed data and normalization · `backend/api/github/schema.py`
- [Org models](https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/gsoc_api/models.py): domain models · Organizations with rating, project count, and GitHub URL fields · `backend/api/gsoc_api/models.py`
- [Repo models](https://github.com/abhaytopno/contribution-hub/blob/main/backend/api/repos/models.py): domain models · Repositories and contributor/issue related persistence · `backend/api/repos/models.py`

### External services

Third-party systems and runtime dependencies

- **Database**: persistent store · Primary persistence layer behind the Django backend
- **GitHub API**: external api · Source of repository and organization enrichment data
- **Search API**: external api · Google Custom Search used for discovery and enrichment

## Connections

- App Router → Org views: renders · Route pages compose organization browsing and detail screens
- App Router → Repo views: renders · Route pages compose repository detail screens
- Org views → GraphQL queries: loads data · Organization pages fetch curated backend data through GraphQL queries
- Repo views → GraphQL queries: loads data · Repository pages fetch curated backend data through GraphQL queries
- GraphQL queries → Apollo client: uses client · Query modules execute through the Apollo client
- Apollo client → Org schema: queries · Frontend GraphQL requests reach the backend organization schema
- Apollo client → Repo schema: queries · Frontend GraphQL requests reach the backend repository schema
- Apollo client → GitHub schema: queries · Frontend GraphQL requests reach the GitHub-facing schema
- Django project → GSoC orgs: routes · Project wiring exposes the organization domain app
- Django project → Repositories: routes · Project wiring exposes the repository domain app
- Django project → GitHub integration: routes · Project wiring exposes the GitHub integration app
- GSoC orgs → Org models: persists · Organization app owns the org data model
- Repositories → Repo models: persists · Repository app owns repository persistence
- GSoC orgs → Org schema: exposes · Organization app publishes GraphQL schema
- Repositories → Repo schema: exposes · Repository app publishes GraphQL schema
- GitHub integration → GitHub schema: exposes · GitHub integration app publishes GraphQL schema
- GSoC orgs → Org ingestion: seeds · Management commands populate and enrich organization data
- GSoC orgs → Shared cache: shares · Organization workflows reuse shared caching helpers
- Repositories → Shared cache: shares · Repository workflows reuse shared caching helpers
- GSoC orgs → Database: reads/writes · Organization records are stored in the database
- Repositories → Database: reads/writes · Repository records are stored in the database
- Org models → Database: stores · Organization model maps to persistent storage
- Repo models → Database: stores · Repository model maps to persistent storage
- GitHub integration → GitHub API: fetches · GitHub integration calls out to GitHub for enrichment
- Org ingestion → Search API: searches · Ingestion jobs use Google Custom Search for discovery
- Org ingestion → GitHub API: enriches · Ingestion jobs fetch GitHub URLs and repository data
- Org schema → Org models: resolves · GraphQL resolvers read organization models
- Repo schema → Repo models: resolves · GraphQL resolvers read repository models
- GitHub schema → GitHub integration: delegates · GitHub GraphQL schema delegates to integration logic
