An illustrative demonstration showcasing the use of Rust to create a simple and lightweight URL shortener.
- Rust: (can you believe it?)
- Axum: To serve static assets and power the backend API
- Askama: For HTML templating, facilitating shared layouts, scripts, CSS, etc.
- htmx: For reactivity on the UI.
- Tailwind: To have a simpler CSS management
- Rust: Yes, I understand it might sound repetitive, but it's the language I'm passionate about, so I'll continue to embrace it!
- Axum: If you've read my previous article, you might already be aware that it's my preferred tool for backend development.
- SQLx: To manage Postgres, I prefer, whenever feasible, to bypass ORMs and their associated overhead. Instead, I opt for solutions that allow me to utilize SQL directly
- PostgreSQL: This will serve as the database where we store our URLs, along with potential analytics-related data.
- Docker: Even though it might not be the optimal choice for production, I've opted to use it because, for teaching purposes, it significantly accelerates the setup phase.
- Askama: Though I've heard there are faster alternatives, given my time constraints, I'll stick with it for now for templating.
- htmx: I've had a positive experience with it in my previous tutorial, so I'd like to delve deeper into it this time to give my frontend reactivity.
- Bootstrap: To avoid too much similarity with my previous tutorial, I've decided to switch from Tailwind to Bootstrap for styling the frontend.
For a comprehensive guide on this project, please refer to the following two articles on medium.com:
If you encounter any issues with the code, please don't hesitate to open an issue. While I've provided guidance in my posts, there's always room for improvement, and I'm here to help address any concerns.