# ankan00v/ivy-league-portal architecture

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

- Interactive diagram: https://gitdiagram.com/ankan00v/ivy-league-portal
- Repository: https://github.com/ankan00v/ivy-league-portal

## Overview

#### 1. Purpose and runtime entry points
VidyaVerse is an opportunity-intelligence platform for student internships, jobs, and events. It combines source ingestion, personalized retrieval/ranking, an AI assistant, applications, and employer/admin workflows.
- FastAPI service bootstrap and API assembly: `backend/app/main.py`, `backend/app/api/api_v1/api.py`
- Separate background-job runtime: `backend/app/worker.py`, `backend/app/services/job_runner.py`
- Next.js frontend entry, routing, and backend proxy: `frontend/src/app/page.tsx`, `frontend/src/app/api/[...path]/route.ts`, `frontend/src/proxy.ts`

#### 2. API, identity, and security boundary
The backend exposes versioned endpoint domains for opportunities, applications, chat, experiments, MLOps, source governance, and administration. Requests cross centralized dependency, middleware, rate-limit, and cookie-session boundaries before services access data.
- API domains: `backend/app/api/api_v1/endpoints/opportunities.py`, `backend/app/api/api_v1/endpoints/auth.py`, `backend/app/api/api_v1/endpoints/admin.py`
- Security/session infrastructure: `backend/app/core/http_middleware.py`, `backend/app/core/security.py`, `backend/app/services/session_security_service.py`
- Admin access is a distinct privileged plane with identity/TOTP/audit behavior: `backend/app/services/admin_identity_service.py`, `backend/app/models/recruiter_audit_log.py`

#### 3. Opportunity acquisition and curation pipeline
Scheduled scraper jobs acquire listings and source candidates. Discovery qualifies and probes new sources; provider clients and company-board scraping handle extraction. Records are normalized, quality/trust assessed, deduplicated, then persisted rather than deleted when expired.
- Orchestration and ingestion: `backend/app/services/scraper.py`, `backend/app/services/source_discovery.py`, `backend/app/services/company_careers_intelligence.py`
- External-fetch boundary: `backend/app/services/firecrawl_client.py`, `backend/app/services/apify_unstop_client.py`, `backend/app/services/scraper_fetch_bridge.py`
- Curation controls: `backend/app/services/duplicate_detector.py`, `backend/app/services/opportunity_quality_service.py`, `backend/app/services/opportunity_trust.py`

#### 4. Core data and storage layers
MongoDB is the primary operational store through Beanie-style models, holding users, profiles, opportunities, interactions, jobs, experiments, model versions, and audits. Redis supports session state, rate limiting, queues, caching, and online features. ClickHouse receives privacy-governed analytical exports and materializes reporting marts.
- Principal records: `backend/app/models/opportunity.py`, `backend/app/models/profile.py`, `backend/app/models/opportunity_interaction.py`
- Redis/cache integration: `backend/app/core/redis.py`, `backend/app/core/cache.py`
- Warehouse export and marts: `backend/app/services/warehouse_export_service.py`, `backend/warehouse/clickhouse_schema.sql`, `backend/warehouse/models/mart_training_dataset.sql`

#### 5. Retrieval, personalization, and assistant
Opportunity text is enriched into embeddings/vector-index entries for semantic retrieval. Feed construction combines profile/context features, ranking mode selection, quality gating, and explanation signals. The RAG assistant has its own conversation, governance, feedback, and template/version records.
- Embedding/vector path: `backend/app/services/embedding_pipeline.py`, `backend/app/services/vector_service.py`, `backend/app/models/vector_index_entry.py`
- Recommendation/ranking path: `backend/app/services/recommendation_service.py`, `backend/app/services/personalization/feature_builder.py`, `backend/app/services/personalization/learned_ranker.py`
- Assistant/RAG path: `backend/app/services/assistant_service.py`, `backend/app/services/rag_service.py`, `backend/app/services/rag_intelligence.py`

#### 6. Learning, experimentation, and MLOps control loop
Impression and interaction telemetry feeds experiments, warehouse datasets, offline evaluation, retraining, drift detection, and guarded rollout decisions. The README identifies semantic ranking as current trusted behavior; learned-ranking artifacts and rollout machinery exist but are not validated on real engagement data.
- Experiment and telemetry services: `backend/app/services/experiment_service.py`, `backend/app/services/ranking_request_telemetry_service.py`
- Lifecycle controls: `backend/app/services/mlops/retraining_service.py`, `backend/app/services/mlops/drift_service.py`, `backend/app/services/mlops/rollout_guardrail_service.py`
- Benchmark/training execution: `backend/benchmarks/run_offline_benchmarks.py`, `backend/scripts/train_learned_ranker.py`

#### 7. Delivery, operations, and external dependencies
Frontend pages implement candidate, employer, admin-control, feed, profile, and assistant experiences; frontend API routes proxy to FastAPI. Deployment expects managed MongoDB, Redis, ClickHouse, S3-compatible artifact storage, plus SMTP, OAuth, Turnstile, scraping/LLM providers, and Slack/PagerDuty alert hooks. Docker compose is a local verification harness, while GitHub Actions enforce release and data/ML gates.
- Product surfaces: `frontend/src/app/dashboard/page.tsx`, `frontend/src/app/opportunities/page.tsx`, `frontend/src/app/control/ops/page.tsx`
- Container/runtime definitions: `docker-compose.yml`, `backend/Dockerfile`, `frontend/Dockerfile`
- Observability and release automation: `ops/prometheus/prometheus.yml`, `ops/alerts/prometheus-rules.yml`, `.github/workflows/release-blocking-ml-gates.yml`

Main entry points: [`backend/app/api/api_v1/api.py`](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/api/api_v1/api.py) (Versioned API domains), [`backend/app/services/recommendation_service.py`](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/recommendation_service.py) (Personalized feed), [`backend/app/models/opportunity.py`](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/models/opportunity.py) (MongoDB operational store), [`backend/app/core/http_middleware.py`](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/core/http_middleware.py) (Session and security boundary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Product client"]
  node_web["Next.js product surfaces<br/>frontend<br/>[page.tsx]"]
  node_proxy["Backend API proxy<br/>frontend gateway<br/>[route.ts]"]
end

subgraph group_api["API and control plane"]
  node_fastapi["FastAPI service<br/>API runtime<br/>[main.py]"]
  node_api_domains["Versioned API domains<br/>route assembly<br/>[api.py]"]
  node_security["Session and security boundary<br/>middleware<br/>[http_middleware.py]"]
  node_admin["Privileged admin plane<br/>admin service"]
end

subgraph group_ingestion["Opportunity pipeline"]
  node_worker["Background job runtime<br/>worker<br/>[worker.py]"]
  node_acquisition["Source acquisition<br/>ingestion orchestration<br/>[scraper.py]"]
  node_providers{{"Scraping providers<br/>external fetch boundary"}}
  node_curation["Curation and trust<br/>quality pipeline"]
end

subgraph group_intelligence["Retrieval and learning"]
  node_recommendations["Personalized feed<br/>recommendation service"]
  node_vectors["Embedding and vector retrieval<br/>semantic retrieval"]
  node_assistant["RAG assistant<br/>assistant service"]
  node_experiments["Experiments and ranking telemetry<br/>experimentation"]
  node_mlops["MLOps lifecycle controls<br/>model governance"]
end

subgraph group_data["Data and operations"]
  node_mongo[("MongoDB operational store<br/>primary database<br/>[opportunity.py]")]
  node_redis["Redis online state<br/>cache and queue<br/>[redis.py]"]
  node_warehouse[("ClickHouse warehouse<br/>analytics warehouse")]
  node_delivery["Delivery and observability<br/>deployment automation<br/>[docker-compose.yml]"]
end

node_web -->|"product requests"| node_proxy
node_proxy -->|"proxies"| node_fastapi
node_fastapi -->|"applies"| node_security
node_security -->|"authorizes requests"| node_api_domains
node_api_domains -->|"admin endpoints"| node_admin
node_api_domains -->|"feed requests"| node_recommendations
node_api_domains -->|"chat requests"| node_assistant
node_api_domains -->|"reads and writes"| node_mongo
node_security -->|"sessions and limits"| node_redis
node_worker -->|"runs scheduled jobs"| node_acquisition
node_worker -->|"consumes queues"| node_redis
node_acquisition -->|"fetches sources"| node_providers
node_providers -->|"listing candidates"| node_curation
node_curation -->|"persists curated records"| node_mongo
node_mongo -->|"opportunity text"| node_vectors
node_vectors -->|"semantic candidates"| node_recommendations
node_mongo -->|"profiles and interactions"| node_recommendations
node_vectors -->|"retrieval context"| node_assistant
node_recommendations -->|"impressions and ranking telemetry"| node_experiments
node_experiments -->|"governed analytics export"| node_warehouse
node_warehouse -->|"training and evaluation datasets"| node_mlops
node_mlops -.->|"guarded ranking rollout"| node_recommendations
node_delivery -.->|"deploys and monitors"| node_fastapi
node_delivery -.->|"runs ML and data gates"| node_worker

click node_web "https://github.com/ankan00v/ivy-league-portal/blob/main/frontend/src/app/page.tsx"
click node_proxy "https://github.com/ankan00v/ivy-league-portal/blob/main/frontend/src/app/api/%5B...path%5D/route.ts"
click node_fastapi "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/main.py"
click node_api_domains "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/api/api_v1/api.py"
click node_security "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/core/http_middleware.py"
click node_admin "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/admin_identity_service.py"
click node_worker "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/worker.py"
click node_acquisition "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/scraper.py"
click node_providers "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/firecrawl_client.py"
click node_curation "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/duplicate_detector.py"
click node_recommendations "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/recommendation_service.py"
click node_vectors "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/embedding_pipeline.py"
click node_assistant "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/assistant_service.py"
click node_experiments "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/experiment_service.py"
click node_mlops "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/mlops/retraining_service.py"
click node_mongo "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/models/opportunity.py"
click node_redis "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/core/redis.py"
click node_warehouse "https://github.com/ankan00v/ivy-league-portal/blob/main/backend/warehouse/clickhouse_schema.sql"
click node_delivery "https://github.com/ankan00v/ivy-league-portal/blob/main/docker-compose.yml"

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_web,node_proxy toneBlue
class node_fastapi,node_api_domains,node_security,node_admin toneAmber
class node_worker,node_acquisition,node_providers,node_curation toneMint
class node_recommendations,node_vectors,node_assistant,node_experiments,node_mlops toneRose
class node_mongo,node_redis,node_warehouse,node_delivery toneIndigo
```

## Components

### Product client

- [Next.js product surfaces](https://github.com/ankan00v/ivy-league-portal/blob/main/frontend/src/app/page.tsx): frontend · Candidate, employer, admin, feed, profile, and assistant experiences. · `frontend/src/app/page.tsx`
- [Backend API proxy](https://github.com/ankan00v/ivy-league-portal/blob/main/frontend/src/app/api/%5B...path%5D/route.ts): frontend gateway · `frontend/src/app/api/[...path]/route.ts`

### API and control plane

- [FastAPI service](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/main.py): API runtime · `backend/app/main.py`
- [Versioned API domains](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/api/api_v1/api.py): route assembly · Opportunities, auth, applications, chat, experiments, MLOps, sources, and admin. · `backend/app/api/api_v1/api.py`
- [Session and security boundary](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/core/http_middleware.py): middleware · Applies identity, cookies, rate limits, and request controls. · `backend/app/core/http_middleware.py`
- [Privileged admin plane](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/admin_identity_service.py): admin service · Uses elevated identity, TOTP, and audit behavior. · `backend/app/services/admin_identity_service.py`

### Opportunity pipeline

- [Background job runtime](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/worker.py): worker · `backend/app/worker.py`
- [Source acquisition](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/scraper.py): ingestion orchestration · Scrapes listings and discovers or qualifies sources. · `backend/app/services/scraper.py`
- [Scraping providers](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/firecrawl_client.py): external fetch boundary · Provider clients and fetch bridge retrieve source content. · `backend/app/services/firecrawl_client.py`
- [Curation and trust](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/duplicate_detector.py): quality pipeline · Normalizes, deduplicates, quality-scores, and retains expired records. · `backend/app/services/duplicate_detector.py`

### Retrieval and learning

- [Personalized feed](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/recommendation_service.py): recommendation service · Combines profile features, ranking mode, quality gates, and explanations. · `backend/app/services/recommendation_service.py`
- [Embedding and vector retrieval](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/embedding_pipeline.py): semantic retrieval · `backend/app/services/embedding_pipeline.py`
- [RAG assistant](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/assistant_service.py): assistant service · Maintains conversations, governance, feedback, and prompt versions. · `backend/app/services/assistant_service.py`
- [Experiments and ranking telemetry](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/experiment_service.py): experimentation · `backend/app/services/experiment_service.py`
- [MLOps lifecycle controls](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/services/mlops/retraining_service.py): model governance · Retraining, drift detection, and guarded rollout decisions. · `backend/app/services/mlops/retraining_service.py`

### Data and operations

- [MongoDB operational store](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/models/opportunity.py): primary database · Stores users, profiles, opportunities, interactions, jobs, experiments, models, and audits. · `backend/app/models/opportunity.py`
- [Redis online state](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/app/core/redis.py): cache and queue · Supports sessions, rate limits, queues, caching, and online features. · `backend/app/core/redis.py`
- [ClickHouse warehouse](https://github.com/ankan00v/ivy-league-portal/blob/main/backend/warehouse/clickhouse_schema.sql): analytics warehouse · Receives governed exports and materializes reporting and training marts. · `backend/warehouse/clickhouse_schema.sql`
- [Delivery and observability](https://github.com/ankan00v/ivy-league-portal/blob/main/docker-compose.yml): deployment automation · Containers, monitoring, alerts, and release/ML gates. · `docker-compose.yml`

## Connections

- Next.js product surfaces → Backend API proxy: product requests
- Backend API proxy → FastAPI service: proxies
- FastAPI service → Session and security boundary: applies
- Session and security boundary → Versioned API domains: authorizes requests
- Versioned API domains → Privileged admin plane: admin endpoints
- Versioned API domains → Personalized feed: feed requests
- Versioned API domains → RAG assistant: chat requests
- Versioned API domains → MongoDB operational store: reads and writes
- Session and security boundary → Redis online state: sessions and limits
- Background job runtime → Source acquisition: runs scheduled jobs
- Background job runtime → Redis online state: consumes queues
- Source acquisition → Scraping providers: fetches sources
- Scraping providers → Curation and trust: listing candidates
- Curation and trust → MongoDB operational store: persists curated records
- MongoDB operational store → Embedding and vector retrieval: opportunity text
- Embedding and vector retrieval → Personalized feed: semantic candidates
- MongoDB operational store → Personalized feed: profiles and interactions
- Embedding and vector retrieval → RAG assistant: retrieval context
- Personalized feed → Experiments and ranking telemetry: impressions and ranking telemetry
- Experiments and ranking telemetry → ClickHouse warehouse: governed analytics export
- ClickHouse warehouse → MLOps lifecycle controls: training and evaluation datasets
- MLOps lifecycle controls → Personalized feed: guarded ranking rollout · Learned ranking remains unvalidated on real engagement data.
- Delivery and observability → FastAPI service: deploys and monitors
- Delivery and observability → Background job runtime: runs ML and data gates
