Shortys is a simple URL shortener built with Python and Flask, leveraging MongoDB for storage. This project allows users to shorten long URLs easily, providing a clean and user-friendly interface.
Built with the tools and technologies:
Table of Contents
URL Shortener is a web application developed with Flask and built in Python that allows you to shorten long URLs, making them easier to manage and share. This tool converts long URLs into shorter links, ideal for social media posts, emails, or anywhere short and easy to remember links are preferred.
- URL Shortening: Converts long URLs into short, customizable links.
- Simple and Friendly Interface: The application includes an intuitive.
- HTML interface so that users can shorten and manage links without hassle.
- Efficient Storage: Uses a MongoDB database to store and manage shortened URLs.
- Redirected Routes: Allows quick redirection from the shortened URL to the original URL.
This project is ideal for developers who need to implement a custom URL shortener, or for small businesses and users who want to shorten and manage links for easy sharing.
- Python and Flask for the backend logic.
- HTML for the user interface.
- MongoDB for URL and data management.
βββ shortys/
βββ app.py
βββ requirements.txt
βββ static
β βββ style.css
βββ templates
β βββ index.html
βββ vercel.json
βββ wsgi.pySHORTYS/
__root__
vercel.json β― Configuration for Vercel deployment.app.py β― Main application file.requirements.txt β― Python dependencies.wsgi.py β― WSGI entry point for the application.
templates
index.html β― Main HTML template for the application.
Check out the live application here.
Before getting started with shortys, ensure your runtime environment meets the following requirements:
- Programming Language: Python
- Package Manager: Pip
Install shortys using one of the following methods:
Build from source:
- Clone the shortys repository:
β― git clone https://github.com/iamjuaness/shortys- Navigate to the project directory:
β― cd shortys- Install the project dependencies:
β― pip install -r requirements.txtGet Connection String.
For the project to work correctly, it is necessary to set up a database in MongoDB. Follow these steps:
-
Log in to MongoDB Atlas and create a new project.
-
In the project, create a Cluster. You can choose the type of cluster that suits your needs.
-
Once the cluster is created, go to the Connection section and select Connect your application.
-
Copy the Connection String, which should have a format similar to:
mongodb+srv://<username>:<password>@cluster.mongodb.net/<dbname>?retryWrites=true&w=majority
Set up the .env file.
-
In the root of the project, create a
.envfile. -
Add the connection string to the
.envfile, replacing<username>,<password>, and<dbname>with the corresponding values:MONGODB_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/<dbname>?retryWrites=true&w=majority
Run shortys using the following command:
Using pip Β
β― python wsgi.pyRun the test suite using the following command:
Using pip Β
β― pytest-
Task 1:Shorten URL's. -
Task 2: Optimization Database.
- π¬ Join the Discussions: Share your insights, provide feedback, or ask questions.
- π Report Issues: Submit bugs found or log feature requests for the
shortysproject. - π‘ Submit Pull Requests: Review open PRs, and submit your own PRs.
Contributing Guidelines
- Fork the Repository: Start by forking the project repository to your github account.
- Clone Locally: Clone the forked repository to your local machine using a git client.
git clone https://github.com/iamjuaness/shortys
- Create a New Branch: Always work on a new branch, giving it a descriptive name.
git checkout -b new-feature-x
- Make Your Changes: Develop and test your changes locally.
- Commit Your Changes: Commit with a clear message describing your updates.
git commit -m 'Implemented new feature x.' - Push to github: Push the changes to your forked repository.
git push origin new-feature-x
- Submit a Pull Request: Create a PR against the original project repository. Clearly describe the changes and their motivations.
- Review: Once your PR is reviewed and approved, it will be merged into the main branch. Congratulations on your contribution!
This project is protected under the MIT License License. For more details, refer to the LICENSE file.
This project would not have been possible without the support of the following tools and resources:
- Flask: Special thanks to the creators and maintainers of Flask, a Python micro-framework that has made web development fast and accessible.
- MongoDB: Thanks to the MongoDB team for providing a flexible and scalable database, perfect for managing and storing URLs.
- Flask and MongoDB documentation: The tutorials and official documentation for both technologies were instrumental in guiding the development of this project.
- Stack Overflow and the Developer Community: We are grateful to the global community of developers and contributors who share their knowledge and provide constant support, making troubleshooting faster and more efficient.