Embracing the FARM Stack

After stumbling on a FastAPI article I decided to give it a go and have been having fun using it for a backend. I know I said I loved Go and would be doing all my personal things in Go moving forward, but running with Pydantic and the auto documentation has added some of what I’ve liked with Go back into Python. In fact, a couple work services that are running in Django might end up going to FastAPI, solely for the purpose of not needing to do weird things in development going from the dev server to gunicorn but still having awesome support for excel files and data visualization.

I honestly haven’t noticed too many benefits of asynchronous Python using an ASGI framework, but I’m sure they’re out there. One thing that does annoy me a bit has been with databases – I feel like I spend so much time going from SQL rows to dicts and JSON, and FastAPI does a wonderful job of abstracting that away with the models. SQLite plays really nice, creating and tearing down test databases with SQLAlchemy as the “query language”

On the database front, I’ve taken another look at MongoDB and using a nosql database for certain things. There aren’t too many applications I actually need to be relational, and being able to just throw a list as a field into a data object instead of creating another table is kind of satisfying. I also used to use mlab with their generous free tier (now MongoDB.com, still epic free tier) to have a managed database instance, and that has been seamless too. When I used to use pymongo now I use motor to add async support – super easy change in the db config.

While researching creating async connections to MongoDB with FastAPI I stumbled on the “stack” that people have coined, and it’s the FARM stack. FastAPI, React, MongoDB. So many tools do so many similar things in so many ways, so why not think of baby goats while writing code?

Featured Photo by Andrew Peluso on Unsplash

Leave a comment