A modern, secure, and lightning-fast URL shortener service built with Node.js. Instantly convert long URLs into short, shareable links and track analytics in real-time. Perfect for social media, marketing, and web applications.
- Custom Short URLs: Generate branded or personalized short links.
- Click Analytics: Track URL usage, referrers, and stats.
- RESTful API: Integrate URL shortening into your own apps.
- Secure: Protects against abuse and malicious redirects.
- Easy to Use: Minimal setup, clean codebase, and ready-to-deploy.
- Scalable: Built for high performance and easy scaling.
- Node.js (backend logic)
- Express.js (routing and server)
- MongoDB (URL & analytics storage)
- Mongoose (MongoDB ODM)
- Other dependencies: See
package.json
.
├── controller/ # Business logic and controllers
├── models/ # MongoDB data models
├── routes/ # App and API routes
├── connection.js # Database connection setup
├── index.js # Main entry point (Express app)
├── package.json # Dependencies & scripts
├── url_shortner_requirements.txt # Requirements/notes
- Node.js (v14+ recommended)
- MongoDB (local or cloud)
git clone https://github.com/techysanoj/URL-Shortner-new-version.git
cd URL-Shortner-new-version
npm installEdit connection.js to set your MongoDB connection string.
npm startThe server runs on http://localhost:3000 by default.
POST /api/shorten
Request body:
{
"originalUrl": "https://your-long-url.com"
}Response:
{
"shortUrl": "http://localhost:3000/abc123"
}Visiting http://localhost:3000/abc123 will redirect to the original URL.
Endpoint and analytics implementation details can be extended as needed.
- Fork this repo
- Create your feature branch (
git checkout -b feature/FeatureName) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/FeatureName) - Open a Pull Request
- Built with best practices in Node.js and MongoDB
- Designed for extensibility (custom domains, analytics, admin dashboard, etc.)
- Perfect for learning, side projects, or deploying at scale
Made with ❤️ by techysanoj