Menu

FastAPI in production · 3. A project structure that survives fifty endpoints
📰

FastAPI in production · 3. A project structure that survives fifty endpoints

DEV Community: backend·Amit chakraborty·2 days ago
#civGeqjO
#devtobackend#devto#dev#endpoints#services
Reading 0:00
15s threshold

FastAPI in production · Chapter 3 of 12 · Backend · new chapter every Wednesday night

By the end of this chapter: Lay out routers, services and schemas so the codebase stays navigable.

The problem

Say you are a backend engineer tasked with building a new API that will eventually have around fifty endpoints. You've already completed the first two chapters of this course, where you learned to get a typed, documented API running with FastAPI and use validation as the boundary between the outside world and your code using Pydantic. You've successfully exposed a few endpoints, but as the number of endpoints grows, you're starting to feel overwhelmed by the complexity of your codebase. You're worried that if you don't get the project structure right now, it will become unmaintainable and difficult to navigate.

You've been using a simple structure, with all your endpoints defined in a single main.py file. However, as the number of endpoints increases, this file is becoming increasingly large and unwieldy.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.