URL Shortener with Rust, Svelte, & AWS (1/): Intro + Setup
In this series of posts, I aim to guide you through the process of creating and deploying a public API. Over the course of the series, you will learn how to use the following technologies:
- Rust with Rocket web framework – for handling API requests
- Docker and Docker Compose – for containerizing your application
- Svelte and Bulma – for creating a simple frontend
- Elastic Beanstalk – for hosting your service
- IAM and GitHub Actions – for automating testing + deployment
Explaining fully the reasons for choosing Rust would be a blog post in itself – instead, I recommend you watch the following video by Jon Gjengset:
If you haven’t previously used Rust before, then I strongly recommend you spend some time reading through the Rust book before attempting to do any of this yourself.
Svelte is a different kind of web framework – instead of being a library like React or Vue, it is actually a compiler under the hood. This enables you to write really clean, concise, and performant code (it does surgical DOM updates instead of using VDOM diffing+reconciliation).
If you want to learn more (or even if you don’t), I can highly recommend watching this excellent presentation by the creator of Svelte.
Amazon Web Services (AWS) is the world’s biggest cloud service provider. They provide over 200 services that allow organizations and individuals to rent resources from one of AWS’ many data centers.
Cloud computing is becoming increasingly popular, as more and more companies prioritize agility and elasticity (which cloud platforms offer) over control and cost-efficiency (which traditional, managed infrastructure provides).
For beginners, AWS offer a free tier, which should allow you to complete this tutorial without spending any money. However, accidentally spending money is an easy mistake for beginners to make – I recommend following this video to minimize any surprise bills.
Before moving on…
- Install the latest stable Rust version by following these instructions
- Create a Github repo for storing your code (commit + push whenever you see fit)
cargo init --binto create a new Rust project, and check it works with
- Install Node.js
- Install Yarn with
npm install --global yarn
If you have any issues, compare your code with the part-1 tag of my repo.
That’s all for this post! In the next post, we will create a simple HTTP API with the Rocket web framework. Make sure to click the “Follow” button if you want to be alerted when the next part is available!
If you enjoyed reading this, then consider dropping a like or following me:
I’m just starting out, so the support is greatly appreciated!
Disclaimer – I’m a (mostly) self-taught programmer, and I use my blog to share things that I’ve learnt on my journey to becoming a better developer. Because of this, I apologize in advance for any inaccuracies I might have made – criticism and corrections are welcome!
Source: DEV CommunitySeptember 20, 2021