This project is a URL Shortener service that allows users to create short, shareable links with advanced features like email-based authentication, access notifications, and expiration dates. It is designed to provide secure and controlled access to shared URLs.
⚠️ Note: This is a fully functional prototype, designed to demonstrate core features like secure sharing, authentication, and notifications. It provides a strong starting point and flexibility for scaling into a production-ready system.
Deployed at https://secret-url-site.vercel.app/
2025-04-07.02-14-50.mp4
- Purpose: Handles backend logic, including URL shortening, authentication, and email notifications.
- Tech Stack: Node.js, Firebase Firestore, Express.js
- Key Features:
- Shortens URLs and stores them in Firebase Firestore.
- Supports email-based authentication for accessing protected URLs.
- Sends email notifications when URLs are accessed.
- Handles URL expiration logic.
- Purpose: Provides a user-friendly interface for creating and managing short URLs.
- Tech Stack: React, Vite, TailwindCSS
- Key Features:
- Allows users to create short URLs with optional expiration dates and access restrictions.
- Implements an authentication flow for accessing protected URLs.
The system uses Firebase Firestore, a scalable NoSQL database, to store URLs and authentication data. This schema is simple but designed for future enhancements.
Stores metadata for each shortened URL.
| Field | Type | Description |
|---|---|---|
originalURL |
string |
Target URL (e.g., "https://drive.google.com/") |
shortId |
string |
Unique identifier (e.g., "Qusjrv") |
ownerEmail |
string |
Creator’s email |
ownerName |
string |
Creator’s name |
emails |
array |
Authorized emails |
expiresAt |
timestamp |
Optional expiration timestamp |
createdAt |
timestamp |
Time of creation |
require-sign |
boolean |
Whether sign-in is required |
send-notification |
boolean |
Whether to notify owner on access |
Stores email codes for access to protected links.
| Field | Type | Description |
|---|---|---|
code |
string |
Verification code |
email |
string |
Recipient’s email |
expiresAt |
timestamp |
Code expiration time |
shortId |
string |
Reference to shortened URL |
- Endpoint:
POST /shorten - Purpose: Creates a short URL with optional expiration and access restrictions.
- Example Use Case: A user wants to share a link that expires in 7 days and is accessible only to specific email addresses.
- Endpoint:
POST /auth/verify-email - Purpose: Sends a verification code to the user's email to authenticate access to a protected URL.
- Example Use Case: A user tries to access a protected URL and needs to verify their email.
- Endpoint:
POST /auth/verify-code - Purpose: Verifies the code sent to the user's email and grants access to the original URL.
- Example Use Case: A user enters the verification code they received to access the URL.
- Endpoint:
POST /auth/resend-code - Purpose: Resends the verification code to the user's email.
- Example Use Case: A user did not receive the verification code and requests it again.
- Endpoint:
GET /:shortId - Purpose: Redirects to the original URL if no authentication is required, or to the authentication page if access is restricted.
- Example Use Case: A user clicks on a short URL and is redirected to the appropriate destination.
- Endpoint:
POST /checkurl - Purpose: Checks if a short URL requires authentication to access.
- Example Use Case: The client checks if a URL requires sign-in before proceeding.
- Create a Short URL: Users provide the original URL, optional expiration date, and access restrictions.
- Share the Short URL: The generated short URL can be shared with others.
- Access the URL:
- If unrestricted, users are redirected to the original URL.
- If restricted, users must verify their email to access the URL.
- Notifications: The owner of the URL receives an email notification when someone accesses the URL (if enabled).
- Navigate to the
/serverdirectory. - Install dependencies:
npm install - Create a
.envfile with Firebase and email credentials. - Start the server:
node server.js
- Navigate to the
/clientdirectory. - Install dependencies:
npm install - Create a
.envfile with the backend URL. - Start the client:
npm run dev
- Secure Sharing: Restrict access to specific email addresses.
- Expiration Dates: Set a time limit for URL validity.
- Notifications: Get notified when someone accesses your URL.
- User-Friendly Interface: Easy-to-use client for creating and managing URLs.
apiKey,authDomain,projectId,storageBucket,messagingSenderId,appId(Firebase config)EMAIL_USER,EMAIL_PASS(Email credentials)FRONTEND_URL(Client URL)
VITE_BACKEND_URL(Server URL)
This project is licensed under the MIT License.

