How userdavidgar03/fastapi-url-shortener works
Fast URL Shortener is a full-stack service for creating, managing, analyzing, and resolving short links. Users start as guests or authenticate, submit URLs, then manage link history and analytics; short-link visits resolve through the backend and may use Redis before PostgreSQL. The frontend also generates downloadable QR codes locally. The README documents PostgreSQL, Redis, JWT, guest quotas, analytics, and QR support; sampled source establishes the main UI/API and redirect relationships, while some detailed backend route behavior is not shown.
Main entry points: App.jsx App orchestration · routes.py URL API and redirect · api.js API client · main.py FastAPI application
Components 21
Web interface
- App orchestration
frontend/src/App.jsx - Welcome and guest
frontend/src/components/WelcomeView.jsx - Login and signup
frontend/src/components/AuthView.jsx - Shorten form
frontend/src/components/ShortenerForm.jsx - Short link result
frontend/src/components/ResultCard.jsx - Link history
frontend/src/components/UrlHistoryTable.jsx - Summary statistics
frontend/src/components/StatsCards.jsx - Session navigation
frontend/src/components/Navbar.jsx - API client
frontend/src/services/api.js
API and identity
- FastAPI application
app/main.py - URL API and redirect
app/routes.py - JWT and guest identity
app/auth.py - Request and response schemas
app/schemas.py - ORM entities
app/models.py - Database sessions
app/database.py
Persistence and cache
- PostgreSQL
- Redis cache
Link features
- QR generation and download
frontend/src/components/QrModal.jsx - Click analytics
frontend/src/components/AnalyticsModal.jsx - Click event records
app/models.py
Other components
- Visitor
Connections 29
- Visitor → App orchestration: uses
README.md - App orchestration → Welcome and guest: renders
frontend/src/App.jsx - App orchestration → Login and signup: renders
frontend/src/App.jsx - App orchestration → Shorten form: renders
frontend/src/App.jsx - App orchestration → Short link result: renders
frontend/src/App.jsx - App orchestration → Link history: renders
frontend/src/App.jsx - App orchestration → Summary statistics: renders
frontend/src/App.jsx - App orchestration → Session navigation: renders
frontend/src/App.jsx - App orchestration → QR generation and download: renders
frontend/src/App.jsx - App orchestration → Click analytics: renders
frontend/src/App.jsx - Welcome and guest → API client: submits URL
frontend/src/components/WelcomeView.jsx - Login and signup → API client: authenticates
frontend/src/components/AuthView.jsx - App orchestration → API client: manages links
frontend/src/App.jsx - Link history → App orchestration: invokes actions
frontend/src/App.jsx - API client → FastAPI application: REST requests
README.md - FastAPI application → URL API and redirect: registers routes
app/main.py - FastAPI application → JWT and guest identity: uses identity
app/main.py - URL API and redirect → JWT and guest identity: resolves actor
app/routes.py - URL API and redirect → Request and response schemas: validates payloads
app/routes.py - URL API and redirect → ORM entities: queries and updates
app/routes.py - URL API and redirect → Database sessions: opens sessions
app/routes.py - FastAPI application → Database sessions: initializes schema
app/main.py - Database sessions → PostgreSQL: persists records
README.md - URL API and redirect → Redis cache: looks up short links
app/routes.py - URL API and redirect → PostgreSQL: loads redirect target
app/routes.py - URL API and redirect → Click event records: records visits
app/routes.py - QR generation and download → Visitor: offers PNG download
frontend/src/components/QrModal.jsx - Click analytics → API client: requests metrics
frontend/src/components/AnalyticsModal.jsx - URL API and redirect → Click event records: provides analytics
README.md