https://github.com/vishapp/safe-shrink
A lightweight URL shortening application built using Flask, SQLAlchemy, SQLite, and Docker. This simple, intuitive project lets users shorten long URLs and easily redirect to the original URL.
https://github.com/vishapp/safe-shrink
Last synced: 8 months ago
JSON representation
A lightweight URL shortening application built using Flask, SQLAlchemy, SQLite, and Docker. This simple, intuitive project lets users shorten long URLs and easily redirect to the original URL.
- Host: GitHub
- URL: https://github.com/vishapp/safe-shrink
- Owner: VishApp
- Created: 2025-03-17T08:37:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-17T15:13:35.000Z (over 1 year ago)
- Last Synced: 2025-03-17T15:41:56.074Z (over 1 year ago)
- Language: Python
- Size: 2.29 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Safe Shrink
A simple URL shortening web app built using Flask, featuring malware URL checking via VirusTotal API.
## 🔗 Demo
Check out the live demo: [Safe Shrink](https://safe-shrink.onrender.com/)
## 🎯 Features
- **Easy URL Shortening:** Convert long URLs into short, shareable links.
- **SQLite Database:** Efficient storage and retrieval using SQLAlchemy.
- **Simple Web UI:** Minimalist, user-friendly interface.
- **RESTful API:** Programmatically shorten URLs via an API endpoint.
- **VirusTotal Integration:** Checks URLs for malicious content before shortening.
- **Docker Support:** Easily containerized and deployable anywhere.
## 🚀 Tech Stack
- **Flask**
- **SQLite & SQLAlchemy**
- **VirusTotal API**
- **Docker**
## ⚙️ Installation
### Using Docker
```bash
docker-compose up --build
```
Visit [http://localhost:5000](http://localhost:5000)
### Manual Setup
```bash
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate
pip install -r requirements.txt
export FLASK_APP=app
export FLASK_RUN_HOST=localhost
flask run
```
## 🌐 API Usage
### Shorten URL
Make a POST request to `/api/shorten`:
```json
{
"url": "https://example.com"
}
```
### Example Response
```json
{
"short_url": "http://localhost:5000/abc123",
"malicious": false,
"vt_result": {}
}
```
If a URL is detected as malicious:
```json
{
"error": "URL detected as malicious",
"malicious": true,
"vt_result": {}
}
```
## 📁 Project Structure
```
flask-url-shortener/
├── app/
│ ├── __init__.py
│ ├── models.py
│ ├── routes.py
│ ├── templates/
│ └── static/
├── Dockerfile
├── docker-compose.yml
├── requirements.txt
└── README.md
```
## 📸 Screenshot


## ⚡ Future Enhancements
- Custom URL aliases
- Analytics and click tracking
- User authentication
- URL expiration dates
## 🤝 Contributions
Feel free to fork this repository, submit pull requests, or suggest improvements!