A full-stack URL shortener web application inspired by Bitly, built using Python, Flask, PostgreSQL, SQLAlchemy, Jinja2, and Tailwind CSS.
The app supports user authentication, short-link tracking, and a personal dashboard to manage URLs.
- pagination
- server based
- cursor based
- normal
- client based
- server based
- super admin
- admin (ORG) i.e CDA
- Haron
- Usman
- RBAC / ABAC
- flask compress and minify
- middleware
- regex
- sort by: (filter on table headers)
- 🔐 User Authentication (Sign up / Login / Logout)
- ✉️ Email-based user accounts
- 🔗 Short URL generation (3-character - Random based)
- 📊 Click tracking for each shortened link
- 👤 User-specific dashboards
- 🔒 Protected routes (only logged-in users can manage links)
- 🎨 Responsive UI using Tailwind CSS
- 🗄 PostgreSQL database with Alembic migrations
| Layer | Technology |
|---|---|
| Backend | Python, Flask |
| Database | PostgreSQL |
| ORM | SQLAlchemy |
| Migrations | Flask-Migrate (Alembic) |
| Frontend | HTML, Jinja2, Tailwind CSS |
| Auth | Flask-Login |
| Versioning | Git & GitHub |
bitly_clone/
│
├── app/
│ ├── controllers/
│ │ ├── __init__.py # App factory (controllers)
│ │ ├── admin.py # Admin routes
│ │ ├── auth.py # Authentication routes
│ │ └── routes.py # Dashboard & redirect routes
│ │
│ ├── templates/
│ │ ├── admin_dashboard.html
│ │ ├── admin_user_links.html
│ │ ├── base.html
│ │ ├── index.html
│ │ ├── login.html
│ │ ├── signup.html
│ │ └── dashboard.html
│ │
│ ├── models.py # User & Link models
│ ├── __init__.py # App factory
│
├── migrations/ # Alembic migrations
├── config.py # App configuration
├── run.py # Entry point
├── requirements.txt # Project requirements
├── .gitignore
└── README.md
- User signs up using email & password
- User logs in and accesses the dashboard
- Shortens URLs from the dashboard
- Each short link tracks click count
- Redirects increment clicks uniquely per click
git clone https://github.com/mananurrehman/bitly_clone.git
cd bitly_clonepython -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windowspip install -r requirements.txtUpdate config.py with your PostgreSQL database URL.
Example:
SQLALCHEMY_DATABASE_URI = "postgresql://user:password@localhost/bitly_clone"flask db init
flask db migrate
flask db upgradepython run.pyVisit:
http://127.0.0.1:5000
- Passwords are hashed securely
- Sessions manage authentication state
- Users can only view/manage their own links
- 🔗 Custom short URLs
- 📈 Advanced analytics (daily / monthly clicks)
- ⏳ Link expiration
- 📋 Copy-to-clipboard button
- 🐳 Docker support
- ☁️ Cloud deployment (AWS / Render / Railway)
Built by Manan ur Rehman
Learning by building real-world backend systems.
If you like this project:
- ⭐ Star the repo
- 🍴 Fork it
- 🧠 Improve it
Happy Coding! 🚀