ZipLink helps users convert long URLs into short, easy-to-share links. It also tracks visits and lets users manage saved links from a simple dashboard.
- About ZipLink
- Why This Project
- Core Features
- Pages and Routes
- Services and Modules
- Tech Stack
- How ZipLink Works
- Database Design
- Project Structure
- Setup and Run
- User Guide
- Current Limitations
- Future Scope
- Learning Outcomes
- Author
ZipLink is a full-stack URL shortener project. It takes a long website link and creates a shorter link that is easier to share.
In simple words:
- User enters a long URL.
- App creates a short code.
- Short code becomes a short URL.
- User can open the short URL.
- App redirects to the original URL.
- App counts every visit.
- User can delete saved links.
This project is useful because long URLs are hard to share, remember, and manage. ZipLink solves that with a clean dashboard and simple backend logic.
This project shows:
- Flask routing
- Form handling
- SQLite database operations
- Jinja template rendering
- URL redirection
- Visit tracking
- Delete functionality
- Clean frontend UI with Tailwind CSS
| Feature | Simple Explanation |
|---|---|
| Short URL creation | Converts a long URL into a short code |
| URL redirection | Opens the original URL when the short link is clicked |
| Visit tracking | Counts how many times each short link is opened |
| Link dashboard | Shows all saved short links in one place |
| Delete link | Removes a short URL from the database |
| 404 page | Shows a clean error page for invalid short links |
| Local database | Stores all links in SQLite |
| Responsive UI | Works on desktop and smaller screens |
Route: /
What it does:
- Shows the main ZipLink dashboard.
- Contains the URL input form.
- Lists all shortened URLs.
- Shows original URL, short URL, and visit count.
- Provides a delete button for each saved URL.
Route: /
Method: POST
What it does:
- Receives the URL from the form.
- Generates a random short code.
- Saves the original URL and short code in the database.
- Redirects back to the home page.
Route: /<short_code>
Method: GET
What it does:
- Finds the original URL using the short code.
- Increases the visit count.
- Redirects the user to the original URL.
- Shows the 404 page if the short code is not found.
Route: /delete/<short_code>
Method: POST
What it does:
- Deletes the selected short URL from the database.
- Sends the user back to the home page.
Route: /about
Method: GET
What it does:
- Returns a simple about message.
Template: templates/404.html
What it does:
- Shows a user-friendly error screen.
- Helps users return to the main app.
- Appears when a short code does not exist.
Main Flask application file.
Responsibilities:
- Starts the Flask app.
- Defines all routes.
- Handles form submissions.
- Generates short codes.
- Connects routes with database functions.
- Redirects users to original URLs.
- Renders HTML templates.
Main functions:
| Function | Work |
|---|---|
generate_short_code() |
Creates a random short code |
index() |
Handles home page and URL creation |
redirect_url() |
Redirects short URL to original URL |
delete_short_url() |
Deletes a saved short URL |
about() |
Returns about page text |
Database service file.
Responsibilities:
- Creates the database table.
- Inserts new URLs.
- Reads saved URLs.
- Updates visit count.
- Deletes URLs.
Main functions:
| Function | Work |
|---|---|
init_db() |
Creates the urls table if it does not exist |
insert_url() |
Saves original URL and short code |
get_url() |
Gets original URL using short code |
increment_visit_count() |
Adds 1 to the visit count |
get_all_urls() |
Gets all saved URLs |
delete_url() |
Deletes one URL by short code |
Main frontend page.
Responsibilities:
- Shows project title.
- Shows input form.
- Displays saved short links.
- Displays visit counts.
- Provides delete buttons.
- Uses Tailwind CSS for styling.
Error page.
Responsibilities:
- Shows message for invalid links.
- Provides a link back to the home page.
- Keeps the UI clean and consistent.
| Tech | Use |
|---|---|
| Python | Main programming language |
| Flask | Web framework and routing |
| Jinja2 | Template rendering through Flask |
| SQLite3 | Database support using Python standard library |
| Random module | Short code generation |
| String module | Characters used in short code generation |
| Tech | Use |
|---|---|
| HTML5 | Page structure |
| Tailwind CSS | Styling and responsive layout |
| Jinja syntax | Dynamic data display in HTML |
| Browser forms | URL input and delete actions |
| Tool | Use |
|---|---|
| Git | Version control |
| GitHub | Source code hosting |
| VS Code | Development editor |
| Markdown | Project documentation |
User enters URL
|
v
Flask receives form data
|
v
App creates random short code
|
v
SQLite stores original URL and short code
|
v
Home page shows the new short URL
User clicks short URL
|
v
Flask reads short code from route
|
v
SQLite finds original URL
|
v
Visit count increases
|
v
User is redirected to original website
User clicks Delete
|
v
Flask receives delete request
|
v
SQLite removes the matching short code
|
v
Home page refreshes
Database file:
database.db
Table name:
urls
| Column | Type | Purpose |
|---|---|---|
id |
INTEGER | Unique ID for every record |
original_url |
TEXT | The full destination URL |
short_code |
TEXT | The generated short code |
visit_count |
INTEGER | Number of times the short link was opened |
- Insert a new URL.
- Find URL by short code.
- Increase visit count.
- Get all URLs.
- Delete URL by short code.
ZipLink/
+-- app.py
+-- model.py
+-- database.db
+-- README.md
+-- templates/
| +-- index.html
| +-- 404.html
+-- .gitignore
| File | Purpose |
|---|---|
app.py |
Main Flask app and route handling |
model.py |
SQLite database functions |
database.db |
Local SQLite database file |
templates/index.html |
Main dashboard UI |
templates/404.html |
Not found page |
.gitignore |
Files ignored by Git |
README.md |
Project documentation |
git clone https://github.com/ggauravky/ZipLink.git
cd ZipLinkpython -m venv .venvWindows:
.venv\Scripts\activatemacOS or Linux:
source .venv/bin/activatepip install flaskpython app.pyhttp://127.0.0.1:5000
- Open the home page.
- Paste a full URL.
- Click
Shorten URL. - Copy or open the generated short URL.
- Click the short URL from the table.
- The app redirects to the original website.
- The visit count increases automatically.
- Click
Deletefor a saved URL. - Confirm the delete action.
- The link is removed from the dashboard.
- If the short code does not exist, the app shows the 404 page.
- User can return to the home page.
- Short codes are generated randomly.
- Custom short codes are not available yet.
- No user login system yet.
- All users share the same local database.
- No expiry date for links yet.
- No copy button yet.
- Add copy-to-clipboard button.
- Add custom short URL option.
- Add user login and personal dashboards.
- Add link expiry date.
- Add search and filter.
- Add analytics charts.
- Add QR code generation.
- Add deployment support.
- Add REST API endpoints.
This project helps understand:
- How Flask routes work.
- How HTML forms send data.
- How SQLite stores records.
- How backend and frontend connect.
- How URL redirection works.
- How visit tracking can be implemented.
- How clean project documentation is written.
Full-stack developer focused on building useful, clean, and practical web projects.