[Live Project: https://url-shortner-sooty-delta.vercel.app/]
URL Shortener is a modern full-stack web app to create, manage, and share short links. It includes secure JWT authentication, custom short codes, a responsive dashboard UI, and an Owner Admin Dashboard to view platform metrics and activity.
- ๐งฉ Enhanced frontend dashboard with user profile card and quick logout
- ๐ข Google Sign-In flow using Google Identity Services (
/user/google/config,/user/google) - ๐ Owner-only admin analytics panel with user counts, link counts, and latest URL activity
- ๐ชช
GET /user/menow returnsisOwnerto enable role-based UI rendering
- ๐ Email/password signup and login
- ๐ข Google Sign-In (login/signup via Google account)
- โ๏ธ Create short links from long URLs
- ๐ท๏ธ Optional custom short code while creating links
- ๐ View all your created links
- ๐๏ธ Delete your own links
- ๐ฑ Responsive UI (Bootstrap + TailwindCSS)
- ๐งพ Owner-only dashboard visibility (based on
OWNER_EMAIL) - ๐ Platform summary: total users + total links
- ๐ฅ User table with per-user link count
- ๐ Recent links feed with owner email
- ๐ Protected admin API (
/admin/overview)
- ๐ง REST API with Express
- ๐๏ธ PostgreSQL + Drizzle ORM
- ๐ JWT auth middleware (
Authorization: Bearer <token>) - โ Input validation with Zod
- ↪๏ธ Redirect short code to original target URL
- Backend: Node.js, Express, PostgreSQL, Drizzle ORM, JWT, Zod
- Frontend: HTML, Bootstrap 5, TailwindCSS, Vanilla JavaScript
- Auth: Email/Password + Google Identity Services
- Tools: Docker Compose, PNPM, Drizzle Kit
git clone <your-repo-url>
cd URL_Shortner
pnpm installdocker compose up -dCreate or update .env:
DATABASE_URL=postgres://postgres:admin@localhost:5432/postgres
PORT=8000
JWT_SECRET=your_jwt_secret
OWNER_EMAIL=your_owner_email@example.com
GOOGLE_CLIENT_ID=your_google_client_id.apps.googleusercontent.com
GOOGLE_CLIENT_IDis required only if you want Google Sign-In enabled.
pnpm db:pushpnpm devOpen: http://localhost:8000
Make sure your latest changes are pushed to your repository.
- Go to Vercel Dashboard
- Click Add New Project
- Select this GitHub repository
- Framework Preset: Other
- Install Command:
pnpm install - Build Command: (leave empty)
- Output Directory: (leave empty)
Set these in Project Settings → Environment Variables:
DATABASE_URLJWT_SECRETOWNER_EMAILGOOGLE_CLIENT_ID(optional if Google Sign-In is used)
PORTis managed by Vercel automatically.
Run this against your hosted PostgreSQL database:
pnpm db:pushAdd your Vercel domain to Google OAuth Authorized JavaScript origins, for example:
https://your-project.vercel.app
- Open Google Cloud Console: https://console.cloud.google.com/
- Create OAuth Client ID (Web application)
- Add Authorized JavaScript origin:
http://localhost:8000
- Copy the generated Client ID into
.envasGOOGLE_CLIENT_ID - Restart the app
POST /user/signupPOST /user/loginPOST /user/googleGET /user/google/configGET /user/me(auth required)
POST /shorten(auth required)GET /codes(auth required)DELETE /:id(auth required)GET /:shortcode(public redirect)
GET /admin/overview(auth + owner email match)
URL_Shortner/
├── api/
│ └── index.js
├── db/
├── middleware/
├── model/
├── public/
│ ├── app.js
│ ├── index.html
│ └── styles.css
├── routes/
├── services/
├── utils/
├── validation/
├── docker-compose.yml
├── drizzle.config.js
├── index.js
├── package.json
├── server.js
├── vercel.json
└── README.md
This project is licensed under the ISC License.
For support or contributions, please open an issue or pull request in this repository.