How teach-hack/intern-intel works
1. What this system is
- InternIntel is an internship-ingestion platform, not just an API. Its main job is to discover internships from company career pages, normalize them, store them, and notify users.
2. Top-level execution surfaces
- There are three main entry points: the HTTP API (app/api), the CLI/runtime commands (app/cli.py, app/runner.py), and the scheduler (app/scheduler.py).
- This suggests the app can be used both interactively through endpoints and autonomously as a background scraping pipeline.
3. Core ingestion pipeline
- The central flow appears to be: scheduler/runner → pipeline_service → scraper_service → mapper_service → dedup_service → database_service/repositories.
- pipeline_service.py likely orchestrates the whole run, while scraper_service.py executes company scrapers, mapper_service.py converts scraped payloads into internal internship models, and dedup_service.py prevents duplicate records.
4. Scraping architecture
- app/core/base_scraper.py defines the shared scraper contract, and app/scrapers/ contains one implementation per ATS/platform: Ashby, Greenhouse, iCIMS, Lever, Oracle, SmartRecruiters, SuccessFactors, and Workday.
- This is a clear boundary between a shared scraping engine and platform-specific adapters. The repo is structured to add more company/ATS scrapers without changing the pipeline core.
5. Shared HTTP and reliability layer
- app/core/http_client.py, retry.py, retry_policy.py, and rate_limiter.py indicate that scraping is network-heavy and protected against failures, throttling, and transient errors.
- That layer is part of the infrastructure boundary: it shields scrapers from unstable external career sites.
6. Configuration and company metadata
- Configuration comes from YAML and env files (app/config/settings.yaml, companies.yaml, keywords.yaml, .env.example), which matches the repository rules.
- app/constants/keywords.py, company_types.py, and status.py suggest company classification and keyword-based filtering/status tracking are part of the normalization logic.
- app/registry.py likely maps configured companies to the correct scraper implementation.
7. Persistence layer
- Persistence is SQLAlchemy-based (app/models, app/database) with Alembic migrations (alembic/).
- The domain model includes at least users, refresh tokens, and internships. Repositories exist for users and refresh tokens, which indicates the database layer is accessed through repository abstractions rather than directly from API routes.
- The README rule about unique URLs aligns with deduplication at the data model or repository boundary.
8. API layer
- The API is organized by router: auth, health, internships, notifications, and pipeline.
- schemas/ contains request/response DTOs, dependencies.py wires shared request-time concerns, and exception_handlers.py centralizes API error translation.
- This layer is likely read/write over the database and may also expose operational controls for triggering or observing the pipeline.
9. Authentication and security
- Auth is implemented with users, refresh_tokens, tokens, pwd_context, and throttle.
- This implies a token-based auth flow with password hashing and rate limiting for sensitive endpoints.
- The API auth subsystem is separate from the scraping pipeline, which is a useful architectural boundary.
10. Notifications
- notification_service.py, message_builder.py, and telegram.py show a dedicated outbound notification subsystem.
- The likely flow is: new or relevant internships are detected in the pipeline, formatted into human-readable messages, then sent through Telegram.
- This is an external integration boundary distinct from scraping and storage.
11. Startup and operational wiring
- app/core/startup.py, app/core/settings.py, config.py, and config_validator.py suggest a structured boot process that validates configuration before the app starts.
- app/database/session.py and database.py manage connection/session lifecycle, while app/core/logger.py provides centralized logging via Loguru.
12. Testing and quality gates
- The repo has strong test coverage across API, scrapers, services, retries, scheduler, startup, and migrations.
- This indicates the architecture is intentionally modular: each major subsystem has isolated tests, which is consistent with the repository’s single-responsibility layout.
13. How to draw the architecture
- A good diagram would place external career platforms on the left, feeding into platform-specific scrapers and the shared HTTP/retry/rate-limit core.
- In the center, show the pipeline services performing mapping, deduplication, and persistence.
- On the right, show PostgreSQL/SQLAlchemy-backed storage and a separate Telegram notification path.
- Above or alongside that, show the FastAPI API for auth, internships, health, notifications, and pipeline control, with CLI/scheduler as alternate entry points into the same business logic.
14. Key architectural constraint
- The repo is built around avoiding duplicated business logic: web requests, background jobs, and scrapers are all meant to reuse the same core services and repositories rather than implement their own data flow.
Main entry points: pipeline_service.py Pipeline · app.py API app · scraper_service.py Scraping · repository.py Repositories
Components 23
Entry points
Ways the system starts or is triggered.
Ingestion pipeline
Shared services that discover, normalize, deduplicate, and persist internships.
- Pipeline · Coordinates scraping, mapping, deduplication, persistence, and downstream actions.
app/services/pipeline_service.py - Scraping · Selects and executes the configured scraper implementations.
app/services/scraper_service.py - Mapping · Converts scraped payloads into normalized internship records.
app/services/mapper_service.py - Deduplication · Prevents duplicate internship records from entering storage.
app/services/dedup_service.py - Persistence · Writes normalized data through repositories and session-backed storage.
app/services/database_service.py
Scraping adapters
Shared scraper base plus ATS/platform-specific implementations.
- Scraper base · Shared interface and common scraper behavior.
app/core/base_scraper.py - ATS scrapers · Company-platform implementations for Ashby, Greenhouse, iCIMS, Lever, Oracle, SmartRecruiters, SuccessFactors, and Workday.
app/scrapers/ashby.py - HTTP reliability · HTTP client, retries, retry policy, and rate limiting for resilient scraping.
app/core/http_client.py
HTTP API
FastAPI routers, schemas, and request-time wiring.
- API app · Application wiring for the HTTP server and router registration.
app/api/app.py - Auth · Authentication endpoints and token-based access control.
app/api/routers/auth.py - Internships · Read/write internship endpoints over the domain model.
app/api/routers/internships.py - Pipeline · Operational endpoints for triggering or observing ingestion.
app/api/routers/pipeline.py - Notifications · Endpoints related to outbound notification behavior.
app/api/routers/notifications.py
Storage
Database models, repositories, sessions, and migrations.
- Database · Models, repositories, sessions, and migration-managed persistence.
app/database/database.py - Domain models · Internship, user, and refresh token entities.
app/models/internship.py - Repositories · User and refresh-token repository abstractions over the database.
app/database/repository.py
Ops and integration
Startup, config, logging, security, and outbound notifications.
- Notifications · Formats and sends internship alerts.
app/notifications/notification_service.py - Telegram · External messaging delivery channel for alerts.
app/notifications/telegram.py - Startup config · Configuration loading, validation, startup wiring, and logging.
app/core/startup.py - Security · Password hashing, tokens, and throttle controls used by the API.
app/security/tokens.py
Connections 24
- CLI → Pipeline: run · Manual command invokes the shared ingestion pipeline.
- Runner → Pipeline: execute · Runtime entry drives the same pipeline logic.
- Scheduler → Pipeline: schedule · Scheduled jobs trigger pipeline runs.
- Pipeline → Pipeline: control · API can trigger or observe pipeline execution.
- Pipeline → Scraping: collect · Pipeline asks for internships from configured scrapers.
- Scraping → Scraper base: contract · Scraper execution is built around the shared scraper interface.
- Scraping → ATS scrapers: adapters · Platform-specific scraper implementations are selected here.
- ATS scrapers → HTTP reliability: fetch · Scrapers rely on the HTTP/retry/rate-limit layer.
- Pipeline → Mapping: normalize · Scraped payloads are converted into canonical internship records.
- Pipeline → Deduplication: filter · Duplicate records are removed before persistence.
- Pipeline → Persistence: persist · Normalized records are written to storage.
- Persistence → Repositories: access · Persistence goes through repository abstractions.
- Repositories → Database: store · Repositories operate over SQLAlchemy-backed storage.
- Database → Domain models: map · ORM models define the persisted domain schema.
- API app → Auth: mount · Application registers auth routes.
- API app → Internships: mount · Application registers internship routes.
- API app → Pipeline: mount · Application registers pipeline control routes.
- API app → Notifications: mount · Application registers notification routes.
- Auth → Security: protect · Auth endpoints use token, password, and throttling utilities.
- Internships → Repositories: query · API reads and writes through repositories.
- Notifications → Telegram: send · Notifications are delivered through Telegram.
- Pipeline → Notifications: alert · New or relevant internships can trigger outbound notifications.
- Startup config → API app: boot · Configuration and startup wiring initialize the HTTP app.
- Startup config → Scheduler: boot · Startup also prepares background scheduling.