Backend API Tech Stack

FastAPI

The backend API is a REST API written using the FastAPI framework. FastAPI is amazing. The main REST API frameworks in Python are Django, Flask, and FastAPI. FastAPI is the youngest of the three, but is has become insanely popular in a short amount of time.

It's become the go-to standard for REST APIs for data science apps. It is super easy to learn and use, and it is very powerful. I think I should let the documentation speak for itself. I have learned so much about how the internet works from this documentation.

To learn FastAPI, I recommend reading the Tutorial - User Guide section from start to finish like it's novel. It's very well written and pretty to look at. As you go, I recommend following along using VS Code or PyCharm. The code you write as you do this will serve as an extra set of documentation personalized for the way you understand it.

FastAPI

SQLAlchemy ORM

A Python library that makes it really easy to query, insert, and update data from our PostgreSQL database. A cool feature of SQLAlchemy is that you don't have to make any code changes to work with tons of different SQL databases.

We could move all of our data from Postgres to MySQL and we wouldn't have to make any code changes because we are using SQLAlchemy to abstract the logic that actually writes SQL statements.

I'm not going to lie, the official SQLAlchemy documentation is dense to the point that it's not very useful for beginners to read. I'd recommend reading this blog post about it:

SQLAlchemy ORM Tutorial for Python Developers

You'll probably still have lots of questions after reading this article. That's okay.

Untitled

typing

We use the Python 3 typing library a lot. These are things like List, Union, Any. This is something that pylint doesn't check for, but is really important as it makes code a lot more readable. The philosophy behind this is similar to the reasoning behind using TypeScript and not plain JavaScript for the frontend.

Declaring your types as you code is a sign of maturity as a Python 3 software engineer (my opinion).

Pydantic