About This Project
Welcome to the Python URL Shortener Pro. This project serves as a showcase for a 100% Python-based monolithic architecture. It is built to demonstrate how to transition from a Node.js/MERN stack mindset to modern Python web development.
How It Works
Unlike modern Single-Page Applications (SPAs) that require a separate frontend (like React or Vue), this application relies on Server-Side Rendering (SSR).
- The backend is powered by FastAPI, a highly performant Python web framework.
- HTML is dynamically generated on the server using the Jinja2 templating engine.
- Instead of writing custom JavaScript to handle form submissions and UI updates, we use HTMX. HTMX allows us to make AJAX requests directly from HTML attributes (like
hx-post) and swap specific parts of the page, giving the app a snappy, SPA-like feel without writing a single line of JavaScript. - Data is persisted in a PostgreSQL database, managed via the SQLAlchemy ORM.
Premium Features
- Custom Aliases: Claim your own unique URL paths instead of random characters.
- Password Protection: Secure sensitive destination links with bcrypt-hashed passwords.
- Link Expiration: Set links to automatically expire (returning a 410 Gone status).
- Inline QR Modals: Automatically generate scannable QR codes for every shortened URL, displayed in an HTMX-powered modal.
- Rate Limiting: IP-based request throttling using
slowapito prevent spam. - Component Architecture & DRY Templates: Built using reusable Jinja2 macros (like
ui_button,ui_input) and a masterbase.htmllayout to mimic a React component structure and maintain absolute UI consistency without the JS bloat. - Sleek Shadcn UI: Styled fully with Tailwind CSS using the premium, high-contrast monochrome Zinc theme and Inter typography.