How sintan1729/chhoto-url works
Chhoto URL is a self-hosted URL shortener. Users create links through the web UI or API; the backend authenticates requests, validates and stores links, then redirects visitors and records hits. Link management also covers listing, editing, deletion, search/filtering, notes and expiry. Background workers batch hit updates and periodically clean expired links. The README documents additional capabilities including QR codes, public mode and configurable landing pages. Source excerpts show server wiring and selected handlers; some subsystem connections are therefore omitted rather than inferred.
Main entry points: main.rs HTTP server · post.rs Create and login API · get.rs Read and redirect API · events.rs Link and hit operations
Components 18
Server and configuration
- HTTP server
backend/src/main.rs - Runtime configuration
backend/src/config.rs - Authentication
backend/src/auth.rs - Health endpoint
backend/src/services/get.rs
Link management
- Create and login API
backend/src/services/post.rs - Read and redirect API
backend/src/services/get.rs - Edit link API
backend/src/services/put.rs - Delete link API
backend/src/services/delete.rs - Service helpers
backend/src/services/utils.rs - API data types
backend/src/services/types.rs
Persistence and maintenance
- SQLite database
backend/src/database/utils.rs - Link and hit operations
backend/src/database/events.rs - SQL queries
backend/src/database/queries.rs - Background workers
backend/src/background.rs
User interfaces
- Management UI
frontend/static/script.js - Public landing UI
site/static/script.js
Other components
- Link visitor
- Admin or API client
Connections 27
- HTTP server → Runtime configuration: loads settings
backend/src/main.rs - HTTP server → Authentication: wires authentication
backend/src/main.rs - HTTP server → Create and login API: registers routes
backend/src/main.rs - HTTP server → Read and redirect API: registers routes
backend/src/main.rs - HTTP server → Edit link API: registers routes
- HTTP server → Delete link API: registers routes
- HTTP server → SQLite database: initializes
backend/src/main.rs - HTTP server → Background workers: starts workers
backend/src/main.rs - HTTP server → Health endpoint: registers endpoint
- Admin or API client → Management UI: uses
README.md - Admin or API client → Create and login API: submits requests
- Link visitor → Read and redirect API: opens short link
README.md - Management UI → Create and login API: uses API
- Create and login API → Authentication: checks access
backend/src/services/post.rs - Create and login API → Service helpers: delegates creation
backend/src/services/post.rs - Create and login API → SQLite database: reads link details
backend/src/services/post.rs - Read and redirect API → Authentication: checks access
- Read and redirect API → SQLite database: reads links
backend/src/services/get.rs - Read and redirect API → Link and hit operations: records redirect hit
backend/src/services/get.rs - Edit link API → Service helpers: delegates edits
- Delete link API → Service helpers: delegates deletion
backend/src/services/delete.rs - Service helpers → Link and hit operations: changes link data
- Link and hit operations → SQLite database: queries and updates
- Background workers → Link and hit operations: flushes hit counts
backend/src/background.rs - Background workers → SQLite database: cleans expired links
backend/src/background.rs - Link and hit operations → SQL queries: uses SQL definitions
- Public landing UI → HTTP server: served by