A robust and secure URL shortening service built with Node.js and Express.js. This backend service provides APIs for shortening URLs, managing user accounts, and tracking URL analytics.
- 🔗 URL shortening with custom aliases
 - 👤 User authentication and authorization
 - 📊 URL analytics and tracking
 
- Runtime: Node.js
 - Framework: Express.js
 - Database: MongoDB with Mongoose
 - Authentication: JWT (JSON Web Tokens)
 - Validation: Joi
 
- Node.js (v14 or higher)
 - MongoDB
 - npm or yarn
 
- Clone the repository:
 
git clone https://github.com/Sandeep-Petwal/Shrinkr.git
cd Shrinkr- Install dependencies:
 
npm install- Create a 
.envfile in the root directory and add the following variables (see.env.samplefor reference): 
PORT=5000
MONGODB_URI=your_mongodb_uri
JWT_SECRET=your_jwt_secret
BASE_SHORT_URL=your_base_url- Start the development server:
 
npm startThe API is versioned and accessible under /api/v1/. Main endpoints include:
POST /auth/register- User registrationPOST /auth/login- User loginPOST /url/shorten- Create short URLGET /url/:shortId- Redirect to original URLGET /url/analytics/:shortId- Get URL analytics
- Rate limiting to prevent abuse
 - CORS protection
 - Input validation using Joi
 - Secure password hashing with bcrypt
 - JWT-based authentication
 - Cookie-based session management
 
Contributions are welcome! Please feel free to submit a Pull Request.
Sandeep Prasad
For support, please open an issue in the GitHub repository.