URL Shortener with Rust, Svelte, & AWS (1/): Intro + Setup
Tags: rust, aws, svelte, docker
Published: 2021-09-20 20:31:53

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

### Rust

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:

{% youtube DnT-LUQgc7s %}

If you haven't previously used Rust before, then I **strongly** recommend you spend some time reading through the [Rust book](https://doc.rust-lang.org/stable/book/) before attempting to do any of this yourself.

![Rust learning curve](https://camo.githubusercontent.com/1d24e64022fd725f1896890b3ce14c560f075dc1f80f0b0baae3ece8981c882a/68747470733a2f2f70617065722d6174746163686d656e74732e64726f70626f782e636f6d2f735f353445314239364546464546443239343536323930324443354239393731443335434436423635304243383744313230303341333041343635313737363230315f313538363531343237353631385f696d6167652e706e67)

### Svelte

[Svelte](https://svelte.dev/) 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.

{% youtube AdNJ3fydeao %}

### AWS

[Amazon Web Services](https://aws.amazon.com/) (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.

{% youtube -xanQ3aUWms %}

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](https://aws.amazon.com/free/), 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](https://youtu.be/MKNtSOQXFrY) to minimize any surprise bills.

### Before moving on...
1. Install the latest stable Rust version by following [these instructions](https://doc.rust-lang.org/book/ch01-01-installation.html)
2. Create a Github repo for storing your code (commit + push whenever you see fit)
3. Use `cargo init --bin` to create a new Rust project, and check it works with `cargo run`
4. Install [Node.js](https://nodejs.org/en/)
5. Install Yarn with `npm install --global yarn`

If you have any issues, compare your code with the [part-1 tag](https://github.com/mileswatson/url-shortener/tree/part-1) 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!

#### Footnote

If you enjoyed reading this, then consider dropping a like or following me:
 - [DEV](https://dev.to/mileswatson)
 - [LinkedIn](https://www.linkedin.com/in/watsonmiles)
 - [Twitter](https://twitter.com/miles__watson)
 - [Github](https://github.com/mileswatson)

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!*