How roh355/short-url works
Short-URL is a web service for creating short links, redirecting visitors while recording clicks, and viewing link analytics; it also supports user registration and login. The main workflow runs from the home page’s URL form through the frontend API to the backend, which validates and stores links. Redirect requests look up a link and record a click; the stats page requests aggregates for charts and tables. Authentication is a separate frontend-to-backend flow. The README documents several server capabilities whose implementation details are only partly sampled, so those relationships are shown at the documented level.
Main entry points: index.ts Express Server · data-source.ts TypeORM Database · url-form.tsx URL Form · stats.tsx Stats Page
Components 24
Frontend
- App Shell
_frontend/app/root.tsx - Home Page
_frontend/app/routes/home.tsx - URL Form
_frontend/app/components/url-form.tsx - Link Cards
_frontend/app/components/url-card-detailed.tsx - Recent Links
_frontend/app/components/recents.tsx - API Client
_frontend/app/api/axios.ts - Stats Page
_frontend/app/routes/stats.tsx - Stats API Client
_frontend/app/api/stats.ts - Charts and Table
_frontend/app/components/top-urls-table.tsx - Login and Register
_frontend/app/components/register-form.tsx
URL Service
- Express Server
backend/src/index.ts - Link Creation
backend/src/index.ts - Redirect and Tracking
backend/src/index.ts
Authentication
- Auth Context
_frontend/app/contexts/AuthContext.tsx - Auth Routes
backend/src/routes/auth.ts - Auth Service
backend/src/services/AuthService.ts
Analytics
- URL Statistics
backend/src/index.ts - Click Statistics
backend/src/index.ts - Top Links
backend/src/index.ts
Persistence
- TypeORM Database
backend/src/data-source.ts - URL Entity
backend/src/entity/URL.ts - Click Entity
backend/src/entity/Click.ts - User Entity
backend/src/entity/User.ts
Other components
- Visitor
Connections 35
- Visitor → Home Page: opens
README.md - App Shell → Home Page: renders routes
_frontend/app/root.tsx - Home Page → URL Form: presents
_frontend/app/routes/home.tsx - URL Form → Link Cards: renders result
_frontend/app/components/url-form.tsx - URL Form → API Client: submits link
README.md - API Client → Express Server: POST create
README.md - Express Server → Link Creation: routes request
backend/src/index.ts - Link Creation → TypeORM Database: saves link
backend/src/index.ts - Link Creation → Recent Links: updates recents
README.md - Visitor → Express Server: requests short link
README.md - Express Server → Redirect and Tracking: routes alias
backend/src/index.ts - Redirect and Tracking → TypeORM Database: reads link and records click
README.md - Redirect and Tracking → Visitor: redirects to destination
README.md - Visitor → Stats Page: opens analytics
README.md - Stats Page → Stats API Client: requests metrics
README.md - Stats API Client → API Client: uses client
_frontend/app/api/stats.ts - Stats API Client → Express Server: GET stats
README.md - Express Server → URL Statistics: routes URL stats
backend/src/index.ts - Express Server → Click Statistics: routes click stats
backend/src/index.ts - Express Server → Top Links: routes top links
backend/src/index.ts - URL Statistics → TypeORM Database: queries aggregates
README.md - Click Statistics → TypeORM Database: queries aggregates
README.md - Top Links → TypeORM Database: queries rankings
README.md - Stats Page → Charts and Table: renders analytics
README.md - Visitor → Login and Register: enters credentials
README.md - Login and Register → Auth Context: submits credentials
_frontend/app/components/register-form.tsx - Auth Context → Auth Routes: POST auth
_frontend/app/contexts/AuthContext.tsx - Express Server → Auth Routes: mounts routes
backend/src/index.ts - Auth Routes → Auth Service: validates and delegates
backend/src/routes/auth.ts - Auth Service → TypeORM Database: reads and saves users
backend/src/services/AuthService.ts - TypeORM Database → URL Entity: registers entity
backend/src/data-source.ts - TypeORM Database → Click Entity: registers entity
backend/src/data-source.ts - TypeORM Database → User Entity: registers entity
backend/src/data-source.ts - URL Entity → Click Entity: relates clicks
backend/src/entity/URL.ts - User Entity → URL Entity: relates owned links
backend/src/entity/User.ts