As some of you may know, I’ve begun a new venture building PracticeProbs.com, a platform to teach programming through fun programming challenges with solutions. This is where most of my focus and writing will be over the coming months. What is it? Practice Probs is a collection of programming practice problems with solutions. It’s kind of like StackOverflow questions and answers, except You can’t post your own content and StackOverflow is littered with “Why doesn’t my code work?
In this tutorial, I cover multiple strategies for handling many-to-many relationships using FastAPI with SQLAlchemy and pydantic. I assume you already know of what these things are and how to use them in a basic sense. The code for this tutorial can be found on github. Intro I’m working on a project in FastAPI and I needed to way to store and serve data with a many-to-many relationship. What I thought would take ~15 minutes turned into a week-long affair of investigative research and experimentation.
Intro Hey future me, I knew you’d come crawling back here to re-understand how JWT works. Allow me to refresh your memory.. Premise Suppose we’re building a web application called Hot Donuts Near Me. Picture a server with our code and our database. And then there’s a client who wants to interact with our server over HTTP. In this example, we’ll pretend the client is some guy named Bob who’s accessing our web app from Chrome.
Intro Every week or so I get an idea for an app. Most of them are pretty dumb. For example, “slot market” - an app that looks like a slot machine. You put up a dollar, pull a virtual level, and then the app buys $1 of a random stock, sells it a second later, and returns your profit / loss. But every once in a while I get an idea I really like.
See the code for this project on GitHub. Intro In this tutorial we’ll build a very simple “To Do” list application with FastAPI. Users will be able to Create To Do list items Read To Do list items Update To Do list items Delete To Do list items Create. Read. Update. Delete. “CRUD”. We’re going to build a backend application. So, a REST API with a database only.
See the code for this project on GitHub. In case you have haven’t heard, FastAPI is Python’s new web framework alternative to Django and flask. It prides itself on being fast - both in terms of performance and codeability. (And no, “codeability” is not a word but it should be.) Background I want to a build a SaaS. I have an idea, but I need to build a prototype. Enter FastAPI.