How nitzanpap/url-shortener works
Main Components
A. Frontend (Client Layer):
• Next.js Application
• Pages/Routes
• Components
• API Integration Layer
• PWA capabilities
B. Backend (Server Layer):
• Go/Gin Server
• URL Handling Service
• Route Management
• Base62 Encoding Utility
C. Database Layer:
• PostgreSQL Database
[Client Tier]
• ▼
[Server Tier]
• ▼
[Database Tier]
Detailed Component Breakdown
• Next.js frontend with subcomponents:
• Main Page (/src/app/page.tsx)
• URL Shortener Component
• Redirect Page (/s/[...slug])
• API Integration Layer (src/api/)
• Toast Provider for notifications
• Gin server with:
• URL Routes Handler
• URL Service Layer
• URL Repository Layer
• Base62 Encoding Utility
• Configuration Management
• PostgreSQL Database
• URL Storage
• Mapping between short and long URLs
Connection Flows to Illustrate
• Client to Server communication via REST API
• Server to Database interactions
• URL shortening flow:
1. User input → Frontend
2. Frontend → Backend API
3. Backend processing (Base62 encoding)
4. Database storage
5. Response flow back to user
Technical Details
Labels for:
• TypeScript/SCSS for frontend
• Go/Gin for backend
• PostgreSQL for database
• Base62 encoding utility
• REST API endpoints
Additional Elements
• A title: "URL Shortener System Architecture"
• Version/date
• Notes about deployment (Vercel for frontend, render.com for backend)
• Environment configuration flow
For tools, recommend using:
• Lucidchart