How say-boop/shortlink works
ShortLink is a FastAPI service for authenticated link management and public redirects. Users register or log in, create and manage short links, and visitors follow codes to reach the original URL while click activity is recorded for statistics. Separate branches cover accounts, tags, and link analytics/export. The repository also includes Celery configuration and documents expiry notifications, but the sampled material does not show task dispatch or notification delivery, so those connections are left unasserted.
Main entry points: links.py Link endpoints · auth.py Account endpoints · database.py SQL database · dependencies.py Token user lookup
Components 22
API workflows
- FastAPI application
app/main.py - Link endpoints
app/routers/links.py - Tag endpoints
app/routers/tags.py
Identity and profiles
- Account endpoints
app/routers/auth.py - Auth helpers
app/services/auth.py - Token user lookup
app/dependencies.py - User schemas
app/schemas/user.py
Link and activity data
- User records
app/models/user.py - Link schemas
app/schemas/link.py - Tag schemas
app/schemas/tag.py - Link records
app/models/link.py - Tag records
app/models/tag.py - Click records
app/models/click_log.py - Short-code logic
app/services/shortcode.py - Link previews
app/services/preview.py - Country lookup
app/services/geoip.py - Device lookup
app/services/device.py
Runtime services
- SQL database
app/database.py - Redis cache
app/cache/redis_client.py - Background tasks
app/celery_app.py
Other components
- Link visitor
- Account user
Connections 32
- FastAPI application → Link endpoints: registers routes
app/main.py - FastAPI application → Account endpoints: registers routes
app/main.py - FastAPI application → Tag endpoints: registers routes
app/main.py - Account user → Account endpoints: uses account API
README.md - Link visitor → Link endpoints: requests redirect
README.md - Account endpoints → SQL database: queries and updates
app/routers/auth.py - Account endpoints → Auth helpers: hashes and verifies
app/routers/auth.py - Account endpoints → Token user lookup: requires current user
app/routers/auth.py - Account endpoints → Redis cache: stores tokens
app/routers/auth.py - Account endpoints → User schemas: validates responses
app/routers/auth.py - Token user lookup → SQL database: loads user
app/dependencies.py - Token user lookup → Auth helpers: verifies token
app/dependencies.py - Token user lookup → User records: queries user
app/dependencies.py - Link endpoints → SQL database: queries and updates
app/routers/links.py - Link endpoints → Token user lookup: requires current user
app/routers/links.py - Link endpoints → Link schemas: validates link data
app/routers/links.py - Link endpoints → Link records: reads and writes
app/routers/links.py - Link endpoints → Redis cache: checks cached URL
app/routers/links.py - Link endpoints → Short-code logic: generates codes
app/routers/links.py - Link endpoints → Link previews: gets link title
app/routers/links.py - Link endpoints → Country lookup: looks up country
app/routers/links.py - Link endpoints → Device lookup: detects device
app/routers/links.py - Link endpoints → Click records: records clicks
app/routers/links.py - Link endpoints → Tag records: attaches tags
app/routers/links.py - Tag endpoints → SQL database: queries and updates
app/routers/tags.py - Tag endpoints → Token user lookup: requires current user
app/routers/tags.py - Tag endpoints → Tag records: reads and writes
app/routers/tags.py - Tag endpoints → Tag schemas: validates responses
app/routers/tags.py - SQL database → Link records: registers model
app/database.py - SQL database → User records: registers model
app/database.py - Link records → Tag records: associates tags
app/models/link.py - Background tasks → SQL database: uses database
app/celery_app.py