โ s n i p
A production-grade URL shortener with real-time analytics, custom aliases, QR codes, and link expiry controls.
Built with Node.js, React, and SQLite. Zero signup required.
View Live Demo ยท GitHub Repo ยท Report Bug
Landing Page
Clean hero section with an instant URL shortener form, animated gradient background, and feature grid.
Dashboard
Full link management dashboard โ search, filter, click tracking, and one-click analytics per link.
- โ๏ธ Instant shortening โ Collision-resistant NanoID-based short codes generated in milliseconds
- ๐ Custom aliases โ Choose your own slug for branded, memorable links (
/my-launch) - โฑ๏ธ Link expiry โ Set links to auto-deactivate after N minutes
- ๐๏ธ Link deletion โ Full CRUD management from the dashboard
- ๐ Click tracking โ Every redirect is logged with browser, device type, and referrer
- ๐ Daily click charts โ Area chart showing click trends over time (powered by Recharts)
- ๐ Geo insights โ Country detection on each redirect event
- ๐ฅง Browser & device breakdown โ Pie chart + progress bars for device type distribution
- ๐ Recent events log โ Live feed of the last N clicks with timestamps
- ๐ฑ QR code generation โ Auto-generated, downloadable QR code for every short link
- ๐ One-click copy โ Instant clipboard copy with visual feedback
- ๐ Search & filter โ Filter links by status: All / Active / Expired / Custom
- ๐ Skeleton loaders โ Smooth loading states on every async operation
- ๐ Toast notifications โ Animated slide-in toasts with success / error / info states
- ๐ Fully responsive โ Works on mobile, tablet, and desktop
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite, React Router v6 |
| Styling | Pure CSS with custom design system (CSS variables, Geist font) |
| Charts | Recharts (AreaChart, PieChart) |
| Backend | Node.js, Express 5 |
| Database | SQLite via better-sqlite3 (WAL mode for concurrent reads) |
| ID Generation | NanoID (collision-resistant 8-char IDs) |
| QR Codes | qrcode npm package |
| Security | Helmet.js, CORS, express-rate-limit |
| Logging | Morgan HTTP logger |
| Dev tooling | Nodemon, Concurrently |
User pastes URL โ POST /api/shorturls โ NanoID generated โ Saved to SQLite
โ
User visits /abc โ GET /:code โ Lookup in DB โ Log analytics โ 302 Redirect
โ
Dashboard โ GET /api/shorturls โ List all links with click counts
โ GET /api/shorturls/:code/stats โ Full analytics breakdown
โ GET /api/shorturls/:code/qr โ Base64 QR code image
- Shortening โ A
POSTto/api/shorturlsvalidates the URL, generates a NanoID (or uses your custom alias), stores it in SQLite, and returns the short link. - Redirection โ Any
GET /:coderequest looks up the code, logs the click event (browser, device, country, referrer), and immediately redirects with a302. - Analytics โ The dashboard fetches per-link stats including daily aggregated clicks, browser/device breakdowns, and a raw event log.
- Node.js
v18+ - npm
v9+
git clone https://github.com/SamridhiiiGupta/SNIP-Short_links_that_work
cd snipnpm run setupThis runs
npm installin the root andcd frontend && npm installautomatically.
cp .env.example .envEdit .env:
PORT=3000
BASE_URL=http://localhost:3000
NODE_ENV=developmentnpm run devThis starts both the backend (port 3000) and the frontend (port 5173) concurrently, and automatically opens the browser.
| Service | URL |
|---|---|
| Frontend | http://localhost:5173 |
| Backend API | http://localhost:3000/api |
snip/
โโโ src/
โ โโโ db/
โ โ โโโ connection.js # SQLite connection + schema init
โ โโโ middlewares/
โ โ โโโ logger.js # Morgan HTTP logger
โ โโโ routes/
โ โ โโโ shorturls.js # All /api/shorturls routes
โ โโโ index.js # Express app entry point
โ
โโโ frontend/
โ โโโ src/
โ โ โโโ components/
โ โ โ โโโ Navbar.jsx
โ โ โ โโโ ShortenerForm.jsx
โ โ โ โโโ StatsModal.jsx
โ โ โ โโโ Toast.jsx
โ โ โโโ hooks/
โ โ โ โโโ useToast.js
โ โ โโโ lib/
โ โ โ โโโ api.js # Typed API client
โ โ โโโ pages/
โ โ โ โโโ Home.jsx
โ โ โ โโโ Dashboard.jsx
โ โ โโโ App.jsx
โ โ โโโ main.jsx
โ โ โโโ index.css # Full design system
โ โโโ index.html
โ โโโ vite.config.js
โ
โโโ db.sqlite # Auto-created on first run
โโโ Dockerfile
โโโ nginx.conf.example
โโโ package.json
docker build -t snip .
docker run -p 3000:3000 -v $(pwd)/data:/app/data snip# Build frontend
npm run build:frontend
# Start production server
NODE_ENV=production npm startThen point Nginx to port 3000 using the included nginx.conf.example.
| Service | Platform |
|---|---|
| Frontend | Vercel โ connect /frontend as root |
| Backend + DB | Railway โ attach a persistent volume for SQLite |
Tip: For high-traffic production use, consider replacing SQLite with PostgreSQL and using a managed database like Supabase or Neon.
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/shorturls |
Create a short link |
GET |
/api/shorturls |
List all short links |
GET |
/api/shorturls/:code/stats |
Get analytics for a link |
GET |
/api/shorturls/:code/qr |
Get QR code (base64 PNG) |
DELETE |
/api/shorturls/:code |
Delete a link |
GET |
/:code |
Redirect to original URL |
GET |
/health |
Health check |
Create short link โ request body:
{
"url": "https://example.com/very/long/path",
"shortcode": "my-link",
"validity": 1440,
"title": "My link label"
}- Authentication โ User accounts with private link collections
- Link passwords โ Password-protect any short link
- Bulk import โ CSV upload to shorten many URLs at once
- Click maps โ Visual geo heatmap of click origins
- API keys โ Programmatic access for developers
- Teams โ Shared workspaces and link collaboration
- Custom domains โ Use your own domain for short links
- PostgreSQL support โ For larger deployments beyond SQLite
Contributions are welcome! Here's how to get started:
# Fork the repo, then:
git clone https://github.com/SamridhiiiGupta/SNIP-Short_links_that_work
git checkout -b feature/your-feature-name
# Make your changes, then:
git commit -m "feat: add your feature"
git push origin feature/your-feature-name
# Open a Pull RequestPlease follow the existing code style and include a clear PR description.
MIT License โ see LICENSE for details.
Built with โ and care.
If you found this useful, consider giving it a โญ on GitHub.

