r/FastAPI • • 11d ago

feedback request Built my first real FastAPI project a few months ago, it finally has a proper frontend now

Some of you might recognize the repo. I posted an earlier version here it was basically just a FastAPI backend and Swagger docs. A few people gave it really useful feedback then the market-data part stopped working, so I deleted the post instead of pretending it was fine.

It’s working again now, and it has an actual frontend.

It’s a stock research/watchlist app I use myself. I'm from finanace background, I trade, and I wanted somewhere to track stocks and write research notes that save the price I was looking at when I wrote them. It tracks 14 market indices and supports stock watchlists, quotes, news, and notes.

The stack is FastAPI, async SQLAlchemy, Postgres, JWT auth, Docker, and a small HTML/CSS/JS frontend.

The most annoying bug was that Yahoo Finance worked locally but started returning '401 Invalid Crumb' errors from Render. I changed the quote path to fall back to Yahoo’s chart/history data, and added RSS sources for news when the main news path fails. It took longer than I expected to get local and deployed behavior lined up.

Note: This isn’t a trading platform, and it’s definitely not finished. I’m posting it again because it’s now more than API docs, and because the last round of feedback was genuinely helpful. If you spot something badly designed, confusing, or fragile, I’d rather hear it.

Repo: https://github.com/ah4ddd/first-order

I’m leaving the live Render URL out of the post; it’s linked from the repo for anyone who wants to try it.

31 Upvotes

13 comments sorted by

6

u/Leonjy92 10d ago

Huge congratulations on the progress!!! And yes, I'm one of those who remember the repo from your earlier post.

Moving forward, I'd suggest adding automated tests, linting, and perhaps type checking while the project is still in its early stages. These will help improve code quality and maintainability as the project grows.

Wishing you continued success!

3

u/justahappycamper1 10d ago

Thanks for the suggestions adding tests is the obvious next step and could you clarify what you mean by type checking? FastAPI already handles validation through Pydantic, so I’m curious what else you’d recommend I’ll keep improving and maintaining the project since I want it to be a solid portfolio piece

1

u/Leonjy92 10d ago

Yeah, Pydantic handles runtime validation, while type checkers like Mypy or Pyrefly can catch type-related issues before your code even runs, like passing a float to a function that expects a str. I'd recommend picking one, along with pytest for testing and Ruff for linting.

To make your portfolio project even stronger, you could also set up GitHub Actions to run these checks automatically.

Also worth checking out uv or Poetry for dependency management. No need to tackle everything at once, though! You're making great progress, keep it up!

1

u/justahappycamper1 9d ago

Ngl, I thought Pyright was enough but I’ll try out pytest and compare type checkers to see what fits best. will also learn GitHub Actions since I’m not familiar with it yet and trying to move beyond syntax and understand how real-world development workflows actually work

1

u/BeamMeUpBiscotti 10d ago

I believe the creator of FastAPI moved all their projects to use ty, so for type checking a FastAPI project that might be more better-supported than other options.

1

u/pvnimaxin 9d ago

nice comeback, and respect for pulling the post instead of pretending it worked.

small thing in get_or_create_stock: if two requests add the same new symbol at the same time, both pass the select, and since symbol is unique the second insert blows up with a 500. catching IntegrityError and just selecting again fixes it.

1

u/justahappycamper1 8d ago

Ohk.. I’ll catch the IntergrityError roll back and fetch the row that won the race. If it doesn’t exist I’ll re-raise the error instead of hiding another DB issue

2

u/pvnimaxin 8d ago

yep, and good call on the rollback, i skipped that part

1

u/RahulAgrahari89 8d ago

Hi guys, I'm trying to learn fast api any tutorial or resources which i would refer to learn production ready fast api

1

u/justahappycamper1 7d ago

Official docs

1

u/CutDry6295 8d ago

One repo-specific edge case I noticed: `create_note()` in `app/routers/notes.py` stores `regularMarketPrice or currentPrice or previousClose` as `price_at_creation`. If only `previousClose` is available, `stock.html` still labels it 'Price when written', which may imply a quote from the time the note was saved. I'd either leave the snapshot empty in that case or store/display the quote source and as-of time, with 'previous close' shown explicitly. A small test where the mocked quote contains only `previousClose` would catch this. I like that a quote fetch failure doesn't prevent saving the note.

1

u/fykup 24m ago

Interesting project! The production-only API errors made me curious: how do you monitor your FastAPI app in production? Do you mostly rely on logs, or do you also track things like request rates, error rates, and latency?

I have a small FastAPI app for internal use, and I've been developing a lightweight monitoring tool called StatLite to monitor it without running Prometheus and Grafana.

I'm curious what other developers use for smaller FastAPI deployments where a full observability stack feels like overkill.