A full-stack URL shortener built with React, Node.js, Express, and PostgreSQL. Create short links, track clicks, and manage your URLs with a clean, responsive interface.
- Create custom or auto-generated short links
- Track click statistics for each link
- Search and filter your links
- Responsive design with Tailwind CSS
- Fast redirects with click tracking
- Easy link management (delete links)
- PostgreSQL database for reliability
- URL validation and error handling
- Modern React frontend with component-based architecture
- React Router for seamless navigation
- Frontend: React + Vite + Tailwind CSS
- Backend: Node.js + Express
- Database: PostgreSQL
- Clone the repository:
git clone <https://github.com/farzank69/tinyURL.git>
cd tinyURL- Install all dependencies:
npm run install:all- Start both servers:
npm run dev- Open your browser and navigate to
http://localhost:5173
GET /healthz- Returns server health status
POST /api/links- Create a new short linkGET /api/links- Get all linksGET /api/links/:code- Get stats for a specific linkDELETE /api/links/:code- Delete a link
GET /:code- Redirect to target URL (302)
POST /api/links
Content-Type: application/json
{
"target_url": "https://example.com",
"code": "mylink" // optional, 6-8 alphanumeric characters
}Response:
{
"code": "mylink",
"target_url": "https://example.com",
"short_url": "http://localhost:3000/mylink",
"clicks": 0,
"created_at": "2025-11-21T12:00:00.000Z"
}GET /api/linksDELETE /api/links/mylinknpm run dev- Start both backend and frontend serversnpm run install:all- Install all dependencies
- Create new short links with optional custom codes
- View all links in a sortable table
- Search/filter links by code or URL
- Copy short URLs to clipboard
- Delete links
- Responsive design for mobile and desktop
- Toast notifications for user feedback
- View detailed statistics for a link
- See total clicks and last clicked time
- Quick actions: visit link, copy URL
- Delete link from stats page
- Responsive card layout
- Fast 302 redirects
- Automatic click tracking
- 404 for non-existent or deleted links
Farzan Khan | Built as a take-home assignment for URL shortening service.