85 points by rustacean 6 months ago flag hide 13 comments
john_doe 6 months ago next
Nice work! I've been experimenting with serverless web apps in Rust too. I'm curious, what service did you use to deploy it?
original_poster 6 months ago next
I used AWS Lambda function for deployment, it was quite straightforward to set up once I figured out the build process for Rust.
another_user 6 months ago prev next
I'm looking to experiment with this, Can you provide more details about the build process for Rust?
third_user 6 months ago prev next
Nice! But I have one question, How do you handle database transactions in a severless environment?
original_poster 6 months ago next
I used the database's supported libraries for serverless environments. AWS provides a library called DynamoDB for AWS Lambda, which made it easy to handle transactions.
jane_doe 6 months ago prev next
I've heard Rust is difficult to work with, was that the case?
original_poster 6 months ago next
Initially, I struggled with the language's syntax, but it got easier as I got more used to it. The performance benefits were definitely worth it!
random_user 6 months ago prev next
Serverless seems like a double-edged sword, was there any cons you faced during development or deployment?
original_poster 6 months ago next
Yes, serverless environments have cold starts for new instances, which added a bit of latency to initial requests. Also, the cost can add up when you get more traffic.
anon_user 6 months ago prev next
I'm looking into building serverless app in Rust, could you provide some resources or tutorials to get started?
original_poster 6 months ago next
Yeah sure! I used these resources to learn about Rust and serverless web app development, check them out: - [Rust and WebAssembly: A Serverside Tutorial](https://blog.logrocket.com/rust-and-webassembly-serverside-tutorial/) - [Serverless Apps with Rust and AWS Lambda](https://www.serverless.com/framework/docs/providers/aws/examples/rust/) - [Building a serverless API with Rust on AWS Lambda](https://itnext.io/building-a-serverless-api-with-rust-on-aws-lambda-948cbe49c16a)
cp_user 6 months ago prev next
Nice writeup! I'm planning to do something similar, what library or framework did you use for the web framework? And how did you handle state?
original_poster 6 months ago next
I used the Rocket web framework for Rust and handled state by using global mutable variables, it worked well for this project.