How I Start: Rust
One thing I wish was covered in these is how to go past &#x27;hello world&#x27;, especially things like error responses and serialization models. It took me a while before I got to the point where I think I can be productive in both querying the data from the front-end and getting back the shape that I wanted. Couple of lessons learned:<p>- Start with separating your API models and DB models out early, you&#x27;ll be thankful later. You can also help yourself out by implementing From&#x2F;Into for your database models to your API models. Obvious lesson from CQRS but since rust doesn&#x27;t allow easily for ad-hoc structs this is a must, especially since there are a lot of examples out there that put a Serialize&#x2F;Deserialize onto the database object.<p>- If you have deeply nested objects, look into JSON:API or Juniper. There are a couple of crates that implement the jsonapi spec and I&#x27;m hacking on one of them to make it a bit more usable for my personal pet project, but Juniper will make your life easier especially if you&#x27;re starting with a React frontend.<p>- Understand that there&#x27;s still a tracking issue for a few items such as multipart data, although there&#x27;s a third party crate that integrates the multipart crate into rocket. However if you need an upload you could probably get away with just returning a signed S3 endpoint to the user, which is what I ended up doing<p>- If integrating with redis or some other database that&#x27;s not application critical, there is no (as far as I&#x27;m aware) graceful degredation that comes out of the box with rocket_contrib, unless there was some config value I was missing. This is usually fine, since you can easily declare an ad-hoc fairing that connects to redis and falls back to an Option::None in the case where it couldn&#x27;t connect.<p>And finally, if you want to support different error status codes yourself based off of mappings from internal errors (such as 409 conflict when inserting the same data), your best bet is an enum that&#x27;s wrapped by a responder derive like so:<p><pre><code>    #[derive(Responder, Debug)]
    pub enum UserApiError {
        #[response(status = 500, content_type = &quot;json&quot;)]
        Unavailable(Json&lt;UserApiErrorMessage&gt;),
    }

    impl UserApiError {
        fn wrap_body(message: &amp;str) -&gt; Json&lt;UserApiErrorMessage&gt; {
            Json(UserApiErrorMessage {
                status: &quot;error&quot;.to_string(),
                message: message.to_string(),
            })
        }

        pub fn unavailable(message: &amp;str) -&gt; Self {
            Self::Unavailable(Self::wrap_body(message))
        }
    }
</code></pre>
Which can be called like:<p><pre><code>    Err(UserApiError::unavailable(&quot;The database is gone!&quot;))
</code></pre>
Most of my other lessons learned come from diesel, both are an absolute pleasure to work with and have given me incredible confidence while coding.