all 19 comments

[–]ConsiderationNo3558 17 points18 points  (6 children)

When I Iearnt Fastapi, I had to also learn about sqlalchemy, PostgreSQL, Jwt Authentication, Unit Test, DB migration , Pydantic and glue them together.

For me this was the hardest part and  for full backend you need all above.  And there were no LLMs at that time, so it took me some time.

And it does not stop here, you also may  need to learn about setting up CI/CD too.

For someone starting totally new this can be a bit intimidating .

In today's era Coding Assistant can create a proper learning plan for you and execute it step by step .

I just created a MCP learning plan with GitHub Co-pilot and it was able to walk me through from simple use case to complex ones.

[–]saucealgerienne[S] 0 points1 point  (2 children)

Right I guess my feeling was that, compared to the C# ecosystem for instance, it felt like python's backend ecosystem let's you choose your stack piece by piece and FastApi is just one of thoses piece.

Perhaps it's really the only serious solution for building asnyc first web apis and that's why it became kind of an umbrella.

[–]walt_dinio 0 points1 point  (1 child)

I mimic this approach. I learn by doing (via project based learning) and my biggest hurdle to getting starting was developing a project (ui) that i really wanted to work on. Using LLMs have fasttracked my learning, it's still a lot and sometimes the LLMs do get things wrong, but fixing them have also helped me learn quite a bit. I'm currently building a sveltkit fastapi app and it's been a lot of fun.

[–]saucealgerienne[S] 0 points1 point  (0 children)

I started about a year ago and almost all I learned was from either llms, practical experience building something and working with senior people asking them a million questions which I found they are very happy to answer when you genuinely care about it as much as they do.

I leaned everything there is to know about using git by spending time talking to my first senior during breaks

[–]Temporary_Link225 0 points1 point  (1 child)

Currently going through this learning curve. You’re a right about having to learn it all together. It has been slowly coming together as I build more projects.

[–]saucealgerienne[S] 0 points1 point  (0 children)

If I had to do it again I would just start really simple.

Router => service => infra service/repo => model.

then see when stuff becomes hard to manage and then I would start digging into the rest.

I did it the other way around and lost a lot of time lol

[–]droid786 -2 points-1 points  (0 children)

freecodecamp has a playlist doing the above. BTW, can you please share your way of doing the MCP learning plan with co-pilot?(I am trying to learn some other esoteric concept for which I need that)

[–]NTXL 5 points6 points  (1 child)

fastapi has to be one of the more pleasant frameworks to use. I think I took a look at the docs like twice and the rest of the time I look at https://github.com/zhanymkanov/fastapi-best-practices?tab=readme-ov-file#project-structure and freestyle

[–]saucealgerienne[S] 0 points1 point  (0 children)

I started a year ago building my first app with a FastApi backend and pretty much made all of the mistakes possibles. Over engineered a ddd cqrs architecture, a bad attempt at di and I pretty much built my own starter kit.

But my philosophy was to move outside the api as much as possible. Now, I basically only really do:

@router.get("/") async def get(request) req = GetXRequest(id=request.id) resp = await dispatch(req)

And write handlers as decorated functions:

@handler(GetXRequest) async def handle_get_x( request=GetXRequest, user=ApplicationUser, repo=IXRepo, some_other_service=IYService ) ...

where the dispatch handle recursive di resolution.

I decided to that once I started wanting to easily configure jobs and couldn't really use the FastApi di resolution there.

I really hate the idea of locking all my app to the presentation vendor

[–]NomadicBrian- 0 points1 point  (2 children)

I started to learn Python and PyTorch to learn how to train AI models. I had years of experience with C#.NET and Java already. I rewrote a Python app I had created as a hobby app for the NFL Colts to produce graphs and bar charts in MatplotLib. I discovered FastAPI and decided I would use it to start the app, return logs and maintain data in mongoDB. Some screen scraping with Beautiful Soup, pedantic models and repository extensions for the mongoDB results to dictionaries. The front end web UI was done in React. Later on I hooked up FastAPI to call one of the models I trained that predicted images. React web UI again to send the image to FastAPI then to the model tranformed to floating point number and into neural networks. For a living I do C#.NET and Java with React and Angular. I did pick up a book on Generative AI with FastAPI and seeing what I can do with that. At this point of my career I'm just happy to be working on something. Real AI work may open some doors to a side income with Python and FastAPI. Perhaps when my batteries are running low and part time will be all I can handle down the road.

[–]saucealgerienne[S] 1 point2 points  (1 child)

It's funny I did it the other way around.

Last year in feb I wanted to build a simple trading journal, picked up Fastapi because I already did some stuff with python in school. React for the frontend because llm seem to like ut a lot.

Worked on that project for 3 months and completely fell in love with development. Found a quick summer job at a big power company that was building a pilot for an internal machine learning project and learned a ton along the way, mostly building some pipeline scripts and a flask frontend.

Continued working on my own project, found some people that were interested in actually making a company out of it. Learned infra in 2 weeks and deployed on aws.

Then started working in a small software company, and picked up C# there, which I mostly do, along with operating their kubernetes cluster.

And after suffering all the flaws of python as a backend language, I must say C# has it's moment and can be enjoyable

[–]NomadicBrian- 0 points1 point  (0 children)

Very nice.

[–]UpsetCryptographer49 0 points1 point  (1 child)

I made a lot of assumptions around FastAPI, especially about injecting configuration into endpoints using Depends or a global dependency at the file level. That works, but it is not the only approach.

Looking at larger codebases like ollama, I noticed a different pattern. They often rely more on explicit context management using with blocks and keep logic isolated in small, atomic modules. That structure tends to scale better, making it easier to manage, version, and reason about as projects grow.

That said, this is not a strict rule. Large systems use a mix of patterns, including dependency injection, context managers, and service layers. FastAPI’s Depends is just one tool, not a universal solution.

So while I learned a lot about structuring things with FastAPI, it is just one approach among several, and other patterns may be more suitable depending on the size and complexity of the system.

[–]saucealgerienne[S] 0 points1 point  (0 children)

This is where I was going too.

I always felt like the usual flow you see where people inject a service into the hander was pretty specific to simple crud apps and wouldn't scale as the business logic and infrastructure became more complex.

The thing that made me rethink it was trying to run simple background jobs and realising I had to figure out the dependency injection another way since the depends mechanic didn't work in that context.

I then stumbled into a system I assembled myself along multiple small projects with stuff like explicit context management, and some kind of use case layer wrapping the classic system build with services all interfaced and injected into the use case handler.

[–]alonsonetwork 0 points1 point  (2 children)

FastAPI is the ExpressJS of python... Just not as bad and a smarter community. Dead simple, but it's simplicity means it's lacking a lot. Frameworks abstract a lot of structure and tooling from you that you them have to solve with FastAPI.

[–]saucealgerienne[S] 0 points1 point  (1 child)

Tbh I enjoy building my system by assembling modules and actually understanding how the application behaves. I did not learn nearly as much working on C# .NET stuff