A modern, secure URL shortener built with React and Express.js.
Developed by Aadi, 2025
Clean, modern interface for shortening URLs
Result view with copy functionality
- URL Shortening - Convert long URLs into short, memorable links
- Custom Codes - Create personalized short codes
- Analytics - Track click counts and access times
- Responsive Design - Optimized for desktop and mobile
- Security - Rate limiting, input validation, and security headers
- Node.js v14 or higher
- npm
- Clone the repository:
git clone <repository-url>
cd urlshortner- Install dependencies:
npm run install-all- Configure environment variables:
cp .env.example .envEdit .env with your settings (see Environment Variables section below).
- Start the development servers:
npm run dev- Frontend:
http://localhost:3000 - Backend API:
http://localhost:5000
Create a .env file in the root directory:
| Variable | Description | Default |
|---|---|---|
PORT |
Server port | 5000 |
BASE_URL |
Base URL for generated short links | http://localhost:5000 |
REACT_APP_API_URL |
Frontend API endpoint | http://localhost:5000/api |
Important: Never commit .env files to version control.
urlshortner/
├── assets/ # Screenshots and images
├── server/
│ ├── index.js # Express server
│ └── database.js # SQLite operations
├── client/
│ ├── public/
│ └── src/
│ ├── App.js # Main component
│ └── App.css # Styles
└── package.json
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/shorten |
Create short URL |
GET |
/api/urls |
List all URLs |
GET |
/api/stats/:code |
Get URL statistics |
DELETE |
/api/urls/:code |
Delete a URL |
GET |
/:code |
Redirect to original URL |
- Backend: Express.js, SQLite, Helmet, Rate Limiting
- Frontend: React, Framer Motion, Axios
This application includes:
- Helmet.js for security headers
- Rate limiting (100 requests/15 min per IP)
- Input validation and sanitization
- SQL injection prevention via parameterized queries
For production deployment, ensure you:
- Use HTTPS
- Configure CORS to allow only your domain
- Set secure environment variables
- Use a reverse proxy (nginx/Apache)
Planned features and improvements for future releases:
- User authentication and personal dashboards
- QR code generation for short URLs
- Custom expiration dates for links
- API key support for developers
MIT
Developed by Aadi, 2025