How rudra00434/shortly_url_shortener works
This is a React and FastAPI URL shortener. A user submits a long URL in the frontend; the API validates it, generates a collision-checked short code, and persists the mapping in PostgreSQL. A later request for that code retrieves the mapping and redirects the client. The frontend also supports copying the result and generating/downloading a QR code. Redis cache helpers and a rate limiter exist, but the sampled API does not connect them to its routes; those relationships are therefore not inferred.
Main entry points: main.py API routes · App.jsx Shortener UI · database.py DB session · models.py URL mapping model
Components 13
Frontend
- React mount
frontend/src/main.jsx - Shortener UI
frontend/src/App.jsx
API and domain
- API routes
shortener_app/main.py - URL schemas
shortener_app/schemas.py - Short-code CRUD
shortener_app/crud.py
Persistence
- DB session
shortener_app/database.py - URL mapping model
shortener_app/models.py - PostgreSQL
Redis utilities
- URL cache helpers
shortener_app/redis_client.py - Rate limiter
shortener_app/rate_limiter.py - Redis
Other components
- Link user
- Original URL site
Connections 15
- Link user → React mount: opens app
frontend/src/main.jsx - React mount → Shortener UI: renders
frontend/src/main.jsx - Shortener UI → API routes: POSTs URL
frontend/src/App.jsx - API routes → URL schemas: validates request
shortener_app/main.py - API routes → DB session: gets session
shortener_app/main.py - API routes → Short-code CRUD: creates or looks up
shortener_app/main.py - Short-code CRUD → URL mapping model: queries and stores
shortener_app/crud.py - URL mapping model → DB session: uses Base
shortener_app/models.py - API routes → URL mapping model: creates table metadata
shortener_app/main.py - DB session → PostgreSQL: connects
shortener_app/database.py - API routes → Shortener UI: returns short code
frontend/src/App.jsx - API routes → Original URL site: redirects client
shortener_app/main.py - Shortener UI → Link user: shows result
frontend/src/App.jsx - URL cache helpers → Redis: reads and writes cache
shortener_app/redis_client.py - Rate limiter → URL cache helpers: uses Redis client
shortener_app/rate_limiter.py