Fast, friendly URL shortener built on Next.js 15 (App Router), MongoDB, and NextAuth.
- Shorten links instantly as a guest (links live for 15 days) or as a registered user (permanent).
- Custom aliases, link history, copy/visit/delete actions.
- Email/password auth and Google sign-in.
- Server-rendered redirects, abuse protection, SEO-friendly.
- Next.js 15 (App Router, Server Components)
- React 19
- Tailwind CSS 3
- MongoDB via Mongoose
- NextAuth v4 (Credentials + Google)
- Upstash Ratelimit for abuse protection
- Cloudflare Turnstile for CAPTCHA
- Sentry for error tracking
- Node.js >= 20
- MongoDB connection string (Atlas free tier works fine)
- Google OAuth credentials (optional, for Google sign-in)
-
Clone the repo and install dependencies:
git clone https://github.com/<you>/shrinkverse.git cd shrinkverse npm install
-
Copy
.env.exampleto.env.localand fill in values:cp .env.example .env.local
At minimum you need
MONGODB_URI,NEXTAUTH_SECRET,NEXTAUTH_URL, andNEXT_PUBLIC_BASE_URL. The rest enable optional features (Google sign-in, rate limiting, CAPTCHA, error tracking, URL safety scanning). -
Run the dev server:
npm run dev
Open http://localhost:3000.
# NEXTAUTH_SECRET / IP_HASH_SALT
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"| Script | Purpose |
|---|---|
npm run dev |
Start dev server with Turbopack |
npm run build |
Production build |
npm start |
Start production server |
npm run lint |
Run ESLint |
npm run format |
Run Prettier on the repo |
src/
app/ # Next.js App Router pages and API routes
api/
auth/ # NextAuth + register endpoints
url/ # Shorten / list / get / delete
[alias]/ # Server-side redirect handler
about/ contact/ ... # Static pages
privacy/ terms/ abuse/ # Legal pages
components/ # Reusable UI components
context/ # React context providers
lib/ # Server utilities (db, auth, rate limit, ...)
models/ # Mongoose models
- Push the repo to GitHub.
- Import the project in Vercel.
- Add every variable from
.env.examplein the Vercel project settings. - Set
NEXTAUTH_URLandNEXT_PUBLIC_BASE_URLto your production URL. - Deploy.
See CONTRIBUTING.md for the commit-message convention and dev workflow.
MIT — see LICENSE.