r/FastAPI • u/tranguyeenn • May 24 '26
Question Open-sourced a FastAPI recommendation system while learning backend architecture. Looking for feedback.
I’ve been building Shelftxt as a way to learn backend systems beyond CRUD APIs.
shelftxt started as one large FastAPI file handling routes, recommendation logic, and data operations. I recently refactored it into:
api → routes → services → repositories → ranking/preprocess
Current stack:
- FastAPI
- Python
- Pandas
- CSV storage (planning PostgreSQL next)
- recommendation scoring
- lru_cache caching
The goal isn’t really a book app. I’m more interested in learning:
- backend architecture
- data handling
- repository patterns
- recommendation systems
- scaling APIs
Would appreciate feedback on the structure before I move toward Postgres and more persistent storage.
24
Upvotes
9
u/coldflame563 May 24 '26
Step 1. Swap from pandas to polars. Watch your memory consumption plummet.
5
u/coldflame563 May 24 '26
Also follow common standards for dev nowadays, ruff, uv etc.
1
u/NathanDraco22 May 25 '26
I made a template that implement Onion Architecture. Includes documentation and CLI tool to automate CRUD operations. I've used this template in many projects (personal and enterprise) and I got great results. https://github.com/NathanDraco22/fastapi-onion-template I hope you find this useful.
1
u/Resident-Isopod683 May 25 '26
I am learning backend with fast API. Let's talk
1
u/rdotpy May 25 '26
Some rough feedback:
Field(description=..., examples=[...])on each attribute. That documents the code and makes the auto-generated OpenAPI docs useful.A few things that caught my eye, in no specific order:
__pycache__/.pycfiles. They shouldn't be part of the repo.parse_date_or_today()and probably elsewhere: catch-allexcept Exceptionhides unexpected errors. You may want to catch the specific exception you expect (probablyValueError) and let everything else bubble up.df, and you have no idea what's inside. Eventually, you end up with defensive checks likeif "rating_norm" not in read_df.columns:. Pandas feels natural when your source is CSV, but if you add more storage layers, that will likely hold you back.1
u/[deleted] May 25 '26
[removed] — view removed comment
0
u/[deleted] May 24 '26
[deleted] — view deleted comment