How amanbtech/shorturl works
This repository implements a URL-shortener web application: users create short links, share them, and redirect visitors, with account management and link metrics as supporting capabilities. The backend is a FastAPI service that routes authentication and link operations to SQLite and Redis; a scheduler refreshes cached popular links and synchronizes click counts. The frontend tree also includes dashboard, analytics, link-management, profile, settings, and password-recovery screens. README documentation is absent, and some frontend/backend wiring is not shown, so those connections are omitted or marked unverified.
Main entry points: url_routes.py Short links · main.py FastAPI app · auth_routes.py Authentication · craete.js Create links
Components 20
Web interface
- Sign in / signup
frontend/script.js - Create links
frontend/craete.js - Manage links
frontend/myurl.js - Dashboard
frontend/dashboard.js - Analytics
frontend/analystics.js - Account screens
frontend/profile.js - Password recovery
frontend/forget.js
API and domain
- FastAPI app
main.py - Authentication
routes/auth_routes.py - Short links
routes/url_routes.py - Link metrics
routes/url_routes.py - Password recovery
routes/url_routes.py - Token and passwords
auth.py - Request schemas
schemas.py - Code and OTP helpers
utils.py
Persistence and cache
- User records
database.py - Link records
database.py - Redis cache
redis_client.py
Background maintenance
- Cache and click sync
scheduler.py
Other components
- Visitor
Connections 21
- Visitor → Create links: creates links
- Create links → Short links: submits link
frontend/craete.js - Create links → Short links: requests dashboard
frontend/craete.js - FastAPI app → Authentication: registers router
main.py - FastAPI app → Short links: registers router
main.py - FastAPI app → Cache and click sync: starts scheduler
main.py - FastAPI app → User records: initializes tables
main.py - Authentication → Request schemas: validates requests
routes/auth_routes.py - Authentication → User records: reads and writes users
routes/auth_routes.py - Authentication → Token and passwords: hashes and verifies
routes/auth_routes.py - Short links → Request schemas: validates requests
routes/url_routes.py - Short links → Token and passwords: checks current user
routes/url_routes.py - Short links → Link records: reads and writes links
routes/url_routes.py - Short links → Redis cache: reads and updates cache
routes/url_routes.py - Short links → Code and OTP helpers: generates link codes
routes/url_routes.py - Link metrics → Link records: queries link metrics
routes/url_routes.py - Password recovery → User records: updates password
routes/url_routes.py - Password recovery → Redis cache: stores OTP
routes/url_routes.py - Password recovery → Code and OTP helpers: generates OTP
routes/url_routes.py - Cache and click sync → Link records: reads and updates links
scheduler.py - Cache and click sync → Redis cache: refreshes and reads cache
scheduler.py