Minimal URL shortener that converts long links into clean, shareable URLs.
- Clean user experience – clear and easy to use dashboard and tools.
- One-click link creation – paste any URL, customize the slug, set expirations, and share instantly.
- Insight-rich dashboard – visualize clicks, referrers, geography, and device mix in real time inside
/app/dashboard. - Bring-your-own domain – assign custom domains/subdomains so every short link matches your brand guidelines.
- Secure accounts – credential auth with hashed passwords, protected server actions, and gated
/approutes.
- Framework: Next.js 16 (App Router, Server Actions, Route Handlers)
- UI: React 19, Tailwind CSS 4, shadcn/ui, lucide-react icons
- Auth: NextAuth 5 credentials provider, bcrypt
- Data: Prisma ORM, PostgreSQL
- Tooling: TypeScript 5, ESLint 9
- Node.js 24.11 LTS recommended
- PostgreSQL database
-
Install dependencies
npm install
-
Configure environment
Create
.env(or set variables in your platform) with the values listed below. -
Generate Prisma client
npx prisma generate
-
Provision and migrate the database
npx prisma migrate deploy
If this is the first time the database is created and no migrations exist yet, run
npx prisma db pushonce to sync the schema, then create a baseline migration withnpx prisma migrate dev --name initso future deploys can continue usingmigrate deploy. -
Build and start
npm run build npm run start
Your production server will respond on the port configured by your host (locally that defaults to
http://localhost:3000).
| Variable | Required | Description |
|---|---|---|
AUTH_SECRET |
✅ | Secret used by NextAuth. Generate with openssl rand -base64 32 or npx auth secret. |
AUTH_URL |
Public base URL of your deployment. Needed when deploying NextAuth (e.g. https://shrtlnk.example.com). |
|
DATABASE_URL |
✅ | Primary Postgres connection string used by Prisma. Example: postgresql://USER:PASSWORD@HOST:5432/DB?schema=public. |
DIRECT_URL |
Optional direct connection (e.g. for connection pooling providers such as Prisma Accelerate or Supabase). Set it if your host supplies a different “direct” URL. |
Restart npm run dev after changing secrets so Next.js picks them up.
| Script | Description |
|---|---|
npm run dev |
Starts the Next.js development server. |
npm run build |
Compiles the production bundle. Run before deploying. |
npm start |
Serves the production build (after npm run build). |
npm run lint |
Runs ESLint across the project. |
├─ app/ # App Router routes (marketing pages, /app workspace, API routes)
├─ components/ # UI primitives, forms, sidebar/header, navigation, etc.
├─ lib/ # Prisma client singleton plus server actions
├─ prisma/schema.prisma# Database schema for Prisma
├─ public/ # Static assets
└─ auth*.ts # NextAuth config and route handlers- To experiment with protected routes, set public routes in
auth.config.tsmiddleware already gates everything that is not in the array.
Distributed under the MIT License. See LICENSE for details.