How priyank766/tross works
Purpose and Entrypoints
A browserless LinkedIn profile-read service. It accepts a LinkedIn URL/vanity name, calls LinkedIn Voyager APIs using a server-held member session, and returns a normalized JSON profile with provenance and partial-data warnings.
• ASGI app: app/main.py
• CLI lookup command: app/cli.py
• React evaluation console: web/src/main.tsx, web/src/App.tsx
HTTP Boundary
FastAPI routes expose profile retrieval, health/readiness, session diagnostics, and optionally raw upstream payloads. Middleware/error handling provides request IDs, timings, stable error envelopes, API-key authentication, and per-client/key fixed-window limiting before service calls.
• app/api/routes/profile.py
• app/api/routes/system.py
• app/api/errors.py
• app/api/security.py
• app/api/ratelimit.py
Profile Orchestration and Cache
The service canonicalizes profile identifiers, checks a TTL/LRU cache, and coalesces simultaneous misses for the same profile. A refresh bypasses cache. Successful assembled documents receive cache metadata; upstream failures are translated into API-level errors.
• app/services/profile_service.py
• app/services/cache.py
• app/linkedin/urls.py
LinkedIn Session and Transport
The integration owns LinkedIn-specific HTTP concerns: session cookies and CSRF headers, optional password fallback, persisted cookie rotation, HTTP/2 requests, proxy support, retries, and status-to-domain-exception mapping. Each client session pairs with pacing, concurrency limits, and a circuit breaker to protect the scarce upstream account budget.
• app/linkedin/auth.py
• app/linkedin/session.py
• app/linkedin/client.py
• app/linkedin/throttle.py
• app/linkedin/exceptions.py
Upstream Retrieval Strategy
repository attempts progressively compatible profile sources: decorated Dash profile collection, minimal Dash variant, configured GraphQL, then legacy profile projection. It stops on a populated profile. Optional contact, skills, and network enrichment calls execute concurrently and degrade to warnings instead of failing the entire profile.
• app/linkedin/repository.py
• app/linkedin/endpoints.py
• app/linkedin/normalized.py
Transformation and Public Contract
Raw Dash embedded trees and GraphQL normalized entity graphs are converted to a shared draft, then assembled into the published Pydantic response schema. Parsers remain pure and isolated from FastAPI and transport code. Output standardizes names, dates, images, URNs, nullability, populated sections, source-call results, warnings, and completeness.
• app/linkedin/parsers/dash.py
• app/linkedin/parsers/draft.py
• app/linkedin/parsers/assembler.py
• app/models/profile.py
• app/models/responses.py
Runtime and Deployment
Python/FastAPI runs the API; the frontend is a Vite/React build served from the application image. Typed environment settings are centralized, including LinkedIn cookies, API keys, cache/throttle limits, proxy, and raw-endpoint exposure. Docker builds Node assets and Python runtime into one container; Fly and Render manifests support persistent session/cache storage.
• app/config.py
• Dockerfile
• docker-compose.yml
• fly.toml
• render.yaml
Main entry points: profile_service.py Profile orchestration · client.py Voyager client session · main.py ASGI application · security.py API guardrails
Components 18
Clients
- React evaluation console
web/src/App.tsx - CLI lookup
app/cli.py
API Runtime
- ASGI application
app/main.py - Profile routes
app/api/routes/profile.py - System routes · Health, readiness, diagnostics, and optional raw payloads.
app/api/routes/system.py - API guardrails · Authentication, rate limits, request context, and stable errors.
app/api/security.py
Profile Service
- Profile orchestration · Canonicalizes identifiers, coalesces misses, and translates upstream failures.
app/services/profile_service.py - TTL/LRU profile cache
app/services/cache.py - LinkedIn URL canonicalizer
app/linkedin/urls.py
LinkedIn Integration
- Retrieval repository · Falls back across Dash, GraphQL, and legacy profile sources.
app/linkedin/repository.py - Voyager client session · Applies cookies, CSRF, retries, proxying, pacing, concurrency limits, and circuit breaking.
app/linkedin/client.py - Session authentication · Maintains and rotates persisted cookies with optional password fallback.
app/linkedin/auth.py - LinkedIn Voyager APIs
Transformation & Contract
- Dash and GraphQL parsers · Converts embedded trees and normalized graphs into a shared draft.
app/linkedin/parsers/dash.py - Profile assembler · Standardizes populated sections, provenance, warnings, and completeness.
app/linkedin/parsers/assembler.py - Published profile contract
app/models/profile.py
Deployment
- Typed runtime settings · Centralizes credentials, limits, proxy, and raw-endpoint exposure.
app/config.py - Container deployment · Builds React assets and Python API into one image.
Dockerfile
Connections 20
- React evaluation console → ASGI application: HTTP requests
- CLI lookup → Profile orchestration: lookup
- ASGI application → API guardrails: applies
- API guardrails → Profile routes: protects
- API guardrails → System routes: protects
- Profile routes → Profile orchestration: retrieve profile
- Profile orchestration → LinkedIn URL canonicalizer: canonicalizes
- Profile orchestration → TTL/LRU profile cache: checks and stores
- Profile orchestration → Retrieval repository: cache miss / refresh
- Retrieval repository → Voyager client session: progressive source calls
- Voyager client session → Session authentication: uses session
- Voyager client session → LinkedIn Voyager APIs: Voyager requests
- Retrieval repository → Dash and GraphQL parsers: raw source payloads
- Dash and GraphQL parsers → Profile assembler: shared draft
- Profile assembler → Published profile contract: normalized response
- Profile orchestration → Published profile contract: returns
- Typed runtime settings → ASGI application: configures
- Typed runtime settings → Voyager client session: credentials and limits
- Container deployment → ASGI application: runs
- Container deployment → React evaluation console: serves built assets