Skip to content
adityamukeshPublic

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Snip — URL Shortener with Analytics

Shorten long URLs (random or custom aliases), copy them in one click, and see analytics for every link: clicks per day over the last 14 days, top referrers and device types.

Stack

  • Frontend: Next.js 15 (App Router), React 19, TypeScript, Tailwind CSS 4
  • Backend: Next.js Route Handlers — REST API plus a /:code redirect handler that records each click
  • Database: PostgreSQL (Neon) — falls back to in-process PGlite when DATABASE_URL is not set

API

Method Route Description
GET /api/links List your links with click counts
POST /api/links Create { url, code? }
GET /api/links/:id Analytics: daily clicks, referrers, devices
DELETE /api/links/:id Delete a link and its clicks
GET /:code Redirect to the original URL (307) and log the click

Only http/https URLs are accepted; aliases are 3–32 characters of letters, numbers, - or _.

Run locally

npm install
npm run dev

Set DATABASE_URL to a Postgres connection string for persistent storage; tables are created automatically.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages