MinifyURL is a fast and simple backend service that lets you shorten long web addresses (URLs) into easy-to-share short links. It's perfect for sharing links on social media, in emails, or anywhere you want a cleaner, more manageable URL.
MinifyURL is designed to make sharing links easier. Instead of sending a long, complicated web address, you can use MinifyURL to create a short, memorable link that redirects to the original address.
- Shorten any long URL into a simple, short link
- Redirect users from the short link to the original URL
- Easy-to-use API for developers
- Built with speed and reliability in mind
- You provide a long URL (like https://www.example.com/very/long/link).
- MinifyURL generates a short code (like https://minify.url/abc123).
- Share the short link with anyone!
- When someone visits the short link, they are instantly redirected to the original URL.
- Hashing Algorithm: Uses farmhash to generate a unique hash from the original URL and creator ID, then encodes it with base62 for short, URL-friendly codes.
- Database: Stores all URL data in MongoDB using the Mongoose ODM for schema validation and easy data access.
- Clone the repository:
git clone https://github.com/tsvillain/minifyurl.git cd minifyurl - Install dependencies:
npm install
- Set up environment variables:
- Copy
sample.envto.envand fill in the required values.
- Copy
- Build and start the server:
Or for development:
npm run build npm start
npm run dev
- Ask your developer or IT team to set up MinifyURL for you.
- Once running, you can use the provided API or a simple web interface (if available) to shorten your links.
Endpoint: POST /api/url
Request Body:
{
"url": "https://www.example.com/very/long/link",
"creator_id": "user123",
"expire_in": 30
}url: The original long URL to shortencreator_id: Unique identifier for the user creating the short URLexpire_in: Number of days until the short URL expires
Response:
{
"status": "success",
"message": "Short Url created successfully",
"data": {
"id": "...",
"original_url": "https://www.example.com/very/long/link",
"code": "abc123",
"expired_at": "2024-07-31T12:00:00.000Z",
"visit_count": 0,
"creator_id": "user123",
"created_at": "2024-07-01T12:00:00.000Z",
"updated_at": "2024-07-01T12:00:00.000Z",
"url_prefix": "http://localhost:3000",
"full_url": "http://localhost:3000/abc123"
}
}Endpoint: GET /api/urls
Request Body:
{
"creator_id": "user123"
}Response:
{
"status": "success",
"message": "List of all urls created by the creator",
"data": [
{
"id": "...",
"original_url": "https://www.example.com/very/long/link",
"code": "abc123",
"expired_at": "2024-07-31T12:00:00.000Z",
"visit_count": 0,
"creator_id": "user123",
"created_at": "2024-07-01T12:00:00.000Z",
"updated_at": "2024-07-01T12:00:00.000Z",
"url_prefix": "http://localhost:3000",
"full_url": "http://localhost:3000/abc123"
}
]
}Endpoint: GET /:code
- Visit the short URL (e.g.,
http://localhost:3000/abc123) in your browser. - If the code is valid and not expired, you will be redirected to the original URL.
- If the code is invalid or expired, an error message is returned.
- Node.js
- Express.js
- TypeScript
- MongoDB (or your preferred database)
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License.
Created by Tekeshwar Singh. For questions or support, open an issue on GitHub.