A link shortener web application, featuring user authentication, link management, and detailed statistics. The app supports both regular users and admins, allowing for efficient link creation, monitoring, and user management.
python3 -m pip install -r dependencies.txtEdit config.ini:
[database]
database_uri = sqlite:///database.dbor set the DATABASE_URI environment variable.
For MySQL/PostgreSQL, use the corresponding SQLAlchemy URI.
Edit config.ini:
[server]
host = 0.0.0.0
port = 5050or set the HOST and PORT environment variables.
python3 main.pyA default root user is created on first start with the password root. You will be prompted to change it on first login.
- Create short links with optional expiry and click limits
- Search links by short code, target URL, or owner (admin)
- Activate/Deactivate links without deleting them
- Delete links with confirmation dialog
- Set a time-to-live (in days) when creating a link — expired links return HTTP 410
- Set a max click limit — links stop redirecting once the limit is reached
- Status badges show the current state:
Active,Inactive,Expired,Max clicks
- Detailed stats page per link with:
- Click count and usage percentage
- Creation date, expiry date, and remaining time
- Link owner
- Quick actions (activate/deactivate, delete)
- Manage users
- Search users by username or ID
- Toggle admin rights and active status
- Reset user passwords
- Backend: Python, Flask, SQLAlchemy
- Frontend: Jinja2, Bootstrap 5 (dark theme), Bootstrap Icons
- Auth: Flask-Login with Argon2 password hashing
| Route | Method | Auth | Description |
|---|---|---|---|
/ |
GET | - | Redirect to dashboard or login |
/login |
GET/POST | - | Login page |
/register |
GET/POST | - | Registration |
/s/<code> |
GET | - | Redirect short link |
/dashboard |
GET/POST | User | Create new links |
/my_links |
GET/POST | User | View own links with search & pagination |
/link_stats/<id> |
GET | User | Link statistics page |
/toggle_link_active/<id> |
POST | User | Activate/deactivate link |
/delete_link/<id> |
POST | User | Delete own link |
/all_links |
GET/POST | Admin | View all links with search |
/manage_users |
GET/POST | Admin | User management with search |
/toggle_user_active/<uuid>/<active> |
POST | Admin | Enable/disable user |
/toggle_admin/<uuid>/<admin> |
POST | Admin | Grant/revoke admin |
/reset_user_password/<uuid> |
POST | Admin | Reset user password |
- Github Copilot: Used in PyCharm for small code suggestions
- Claude: Used for polishing the frontend templates
Note: Every code snippet generated by AI was reviewed and modified if needed.