
Pinned Tweet
Two years after publishing the FastAPI Best Practices, I started to dislike some sections and wanted to make changes.
Today, I have made significant updates to its structure and key points:
• Organized content into clear chapters for better navigation, with sections sorted by importance.
• The section on sync routes only mitigated the problem with blocking I/O calls and didn't encourage the use of `async` routes. Now, the trade-offs are explicitly mentioned (thanks to tips by @marcelotryle).
• Removed unnecessary sections unrelated to FastAPI.
• Replaced Pydantic's BaseSettings recommendation with a practice of decoupling them, as it is widely used anyway.
• Upgraded code examples to Pydantic v2.
• The only linter recommended is Ruff by @astral_sh.
Check it out at github.com/zhanymkanov/fasta…
My article on @FastAPI Best Practices has just been updated with a Chinese translation.
It’s great to see community contributions helping spread clean code practices around the world.
Link is below 👇
1
3
468
The FastAPI Production Template is now actually useful:
github.com/zhanymkanov/fasta…
For some reason, I named it as a template, but the repo became an example project rather than something that can be easily forked and used to create new projects.
Now, it is truly a template and as lean as possible:
- Dropped `auth` module
- Dropped example external service module
- Dropped tests
- Dropped all linters, but ruff
- Dropped redis
- Added poetry
- Added ruff hooks for alembic migrations
- Added instructions to use `just`
- Refactored Dockerfile to use poetry
- Added docker compose file for prod
- Upgraded all dependencies
- Moved ruff configs to `ruff.toml`
- Refactored `gunicorn` conf to use Pydantic Settings
- Added SQLAlchemy methods for connection management
6
541
Just replaced black with `ruff format` at my template repo
Use it with either:
- `docker compose exec app format`
- `just lint` if you have installed `just`
github.com/zhanymkanov/fasta…
3
653
A month ago, I didn't know Solidity.
I had a good understanding of web3 development, but I couldn't write smart-contracts.
Now, I feel comfortable finding vulnerabilities on First Flights by @CodeHawks and have a couple of deployed contracts on the mainnet.
Solidity docs were overkill. They drowned me in unnecessary details. I wanted a faster way to learn.
Luckily, @realgmhacker had open DMs and he guided me towards this learning path:
1. "Solidity by Examples" by @ProgrammerSmart. I skimmed it once, but didn't feel confident in my Solidity skills. Then @realgmhacker recommended the paid subscription and it changed the game for me!
I thought I could skim the syntax and then immediately start working on projects, but it wasn't productive because the local environment is a pain if you don't know what you are doing.
Starting small and practicing with bite-sized tasks is key. It's the perfect way to put newfound knowledge to the test. The same way I learned Rust after doing rustlings, not after reading The Book.
2. Secureum by @0xRajeev. It's a no-brainer since the entire web3sec community praises it. I haven't finished it yet, but every video seems fundamental for learning auditing.
3. Contests. I was lucky that @CodeHawks launched First Flights right after I started learning, so I joined the contests. The first challenge was simple, but the second one is fun! Participating in real-world contests is an ultimate goal for me, but I would prefer starting in this sandbox first.
This path is simple, but every piece of it is highly productive, and it forces me to focus on web3sec without drowning in Solidity syntax.
Finally! Will use it even if 90% of black rules are covered.
Announcing the Ruff formatter: an extremely fast, Black-compatible Python formatter.
Over 30x faster than Black -- and over 99.9% compatible.
Try it now with `pip install ruff` and `ruff format`.
astral.sh/blog/the-ruff-form…
4
627
Me as a first time tech founder:
- 3 VPCs, 12 servers
- Separate VPN server for each VPC and private domains
- Perfect self-signed certs for smooth HTTPS with no big red chrome's warnings
Me as a seasoned founder:
- 1 biz server, 1 VPN server
- no domains, no https for internal
2
394
When I lacked real-world experience, questions like this would leave me in doubt:
- Why did you choose Python? It's slow!
- Why did you build a monolith? It's not scalable!
Now I understand - people asking this have never scaled apps themselves.
2
311
I don't like using repository patterns for CRUD because almost always I have to write custom biz logic for services.
It feels like Python codebases thrive when no abstract classes are created, but functions are pure.
1
1
348
Stop using `resp.json()`, if you have Pydantic v2 in your project.
Use `BaseModel.model_validate_json(response.read())` instead.
It's powered by Rust for fast data serialization and doesn't create unnecessary objects. In Python, CPU work and objects are expensive.
Prefect is cool, but it would be really nice if the docs mentioned that each async task running in an async flow would be created in a different thread, smh.
What are the benefits of doing so if your v0 was already built with async in mind?
github.com/PrefectHQ/prefect…
265
Starting a startup for video streaming was hard because of the large number of unknown unknown buzzy words.
Though this article focuses on the architecture of video processing, it's gold for beginners wishing to learn hard things about video.
alexandreolive.medium.com/vi…
ClickHouse is ridiculously good:
- It is extremely fast.
- It loads data from Postgres with 1 SQL command.
- Backup to S3 with a single SQL line, and restore with another.
- Data compression is in a different league.
It feels like if I read "Zero to One" before starting a startup, I would read a completely different book.
1
2
404
Bad founders release one large product no one wants.
Better founders release a series of shitty products no one wants.
3
331





