Simple URL shortener written in Rust as a learning experience. Feel free to use it for your own purposes.
It uses:
- Redis as the backend database
- Rocket web framework
- Tailwind CSS for some styling
- Docker for running redis and deploying the URL shortener as a docker container cross-compiled to run on a Raspberry Pi
- Install rust. This project was tested using the stable channel which at the time of writing installed rustc 1.70.0
- Install the standalone Tailwind CSS CLI. You could also use npm but I didn't want a package.json or node_modules when this was mainly for me to learn some rust development
Once you have the tools installed, clone this repo using your preferred method. For example...
gh repo clone johnvanham/url-shortener-rust
- Start up redis using Docker:
docker run -p 6379:6379 -v redis_data:/data -it redis:latest
- Use cargo in the project directory:
cargo run
- Run tailwindcss to build the css file and (optionally) watch changes:
tailwindcss -i css/style.css -o public/style.css --watch
If editing any of the rust code you will need to stop and re-start cargo.
TODO: Add instructions on how to deploy as a docker container cross-compiled to run on a Raspberry Pi