Introduzione | Introduction
Italiano: Questo articolo è disponibile sia in italiano che in inglese. Scrolla verso il basso per la versione in inglese.
English: This article is available in both Italian and English. Scroll down for the English version.
🇮🇹 Italiano
Dopo aver studiato Django per mesi, ho deciso di dare un’occhiata a FastAPI, un framework sempre più popolare nel mondo Python.
Non ho ancora usato FastAPI in progetti reali, ma ho cominciato a esplorarlo per capirne la filosofia e le differenze rispetto a Django.
Questo articolo raccoglie i miei primi appunti, impressioni e confronti — pensato soprattutto per chi, come me, arriva da Django.
🧠 1. Approccio minimalista (ma potente)
La prima cosa che colpisce è quanto FastAPI sia snello. Niente ORM integrato, niente admin, niente sistema di template: solo ciò che serve per costruire API in modo rapido e moderno.
In Django sei abituato ad avere tutto preconfigurato. In FastAPI, invece, sei tu a decidere cosa usare e come integrarlo.
🚀 2. Le performance sono davvero notevoli
FastAPI si basa su Starlette e supporta nativamente async/await.
Questo significa prestazioni molto elevate, soprattutto per API ad alta concorrenza. Anche solo lanciare l’app con uvicorn
ti dà subito la sensazione di velocità.
🧪 3. La tipizzazione è protagonista
Una delle cose più interessanti è l’uso dei type hints Python per generare automaticamente:
- validazioni
- documentazione OpenAPI/Swagger
- suggerimenti editor
Questo è un punto di forza enorme rispetto a Django, dove la tipizzazione è molto più limitata.
📁 4. Manca l'admin, ma puoi costruirlo
In Django è facilissimo usare l’admin per gestire i modelli. FastAPI non ha nulla del genere integrato.
Ma puoi collegarlo a Tortoise ORM, SQLModel o altri tool, e persino creare una tua interfaccia admin con un frontend custom.
👨💻 5. La curva di apprendimento è strana (facile e difficile allo stesso tempo)
FastAPI sembra semplice all’inizio: poche righe e l’API funziona.
Ma quando cerchi di costruire un'app completa, ti accorgi che serve strutturare bene il codice, scegliere ORM, strumenti di migrazione, gestione delle rotte... È un po’ come partire con Flask, ma moderno.
🧭 Conclusione
FastAPI mi ha colpito per la velocità, flessibilità e modernità.
Non è un sostituto diretto di Django (soprattutto per progetti fullstack), ma è perfetto per microservizi, API REST e architetture moderne.
Il mio prossimo obiettivo? Creare un piccolo progetto API con autenticazione e database per metterlo alla prova sul campo.
🇬🇧 English
After months of studying Django, I decided to take a look at FastAPI, a framework that's becoming increasingly popular in the Python world.
I haven’t used FastAPI in real-world projects yet, but I’ve started exploring it to understand its philosophy and how it compares to Django.
This post summarizes my first notes, impressions, and comparisons — especially for those coming from Django like me.
🧠 1. A minimalist (yet powerful) approach
The first thing that struck me was how lightweight FastAPI is.
No built-in ORM, no admin interface, no template engine — just the essentials for building APIs quickly and cleanly.
With Django, everything is preconfigured. With FastAPI, you get to decide what to use and how to structure your project.
🚀 2. Performance really stands out
FastAPI is built on Starlette and supports async/await out of the box.
This leads to excellent performance, especially for concurrent API calls.
Even just launching the app with uvicorn
feels fast.
🧪 3. Type hints play a central role
One of the coolest things is the use of Python type hints to automatically generate:
- validation
- OpenAPI/Swagger docs
- editor autocomplete
This is a huge plus compared to Django, where typing is more limited.
📁 4. No admin panel, but you can build it
Django’s admin is incredibly convenient. FastAPI doesn’t have one.
However, you can integrate it with Tortoise ORM, SQLModel, or even build your own custom admin interface.
👨💻 5. The learning curve is weird (easy and hard at once)
FastAPI feels easy at first: a few lines and your API is working.
But when you try building a complete app, you quickly realize you need to structure things well, choose your ORM, set up migrations, route management…
It feels a bit like Flask, but more modern.
🧭 Conclusion
FastAPI impressed me with its speed, flexibility, and modern design.
It’s not a 1-to-1 replacement for Django, especially for fullstack apps, but it’s ideal for microservices, REST APIs, and modern architectures.
My next goal? Build a small API project with auth and a database to test it in the real world.
Traduzione:
Questo articolo è stato tradotto con l'ausilio di strumenti di traduzione professionali.
This article was translated with the help of professional translation tools.
Top comments (0)