HYBRID (SYNC + ASYNC)
- Bisa synchronous atau asynchronous
- Best flexibility + best developer experience
Framework
- FastAPI
- paling direkomendasikan
- async-first
- super cepat (lebih cepat daripada Node.js dan Go dalam beberapa benchmark)
- built on Starlette + Pydantic
- automatic docs (Swagger + Redoc)
- modern python (type hint, async/await)
- use case:
- Microservices
- REST API
- ML APIs
- Authentication service
- Integration service
- Django
- bisa sync atau async
- sangat mature
- punya ORM bawaan
- punya admin panel bawaan
- cocok untuk monolith app
- use case
- website besar
- backend lengkap (ORM, admin panel, auth, template)
- CMS, eCommerce, social sites
- Flask
- synchronous secara default
- bisa async dengan extension
- super simple
- cocok untuk project kecil atau custom service
- use case
- microservices kecil
- API sederhana
- prototyping
Pilhan yang tepat
- FastAPI: untuk API modern, scalable, mirip express versi pythonic
- Flask: untuk mengerti barebone web framework
- Django: ORM, admin, templating, ecosystem sangat kuat
Framework lain seperti Tornado, Sanic, aiohttp - belajar jika butuh performa ekstrem atau ingint tahu sejarah benchmarking
Roadmap Belajar
- Bisa kuasai asyncio dasar dulu, karena FastAPI sangat heavily async
- Bikin CRUD API di FastAPI: GET, POST, PATCH, DELETE
- Connect ke database (SQLAlchemy): SQLite, PostgreSQL, Asnyc ORM via SQLModel atau SQLAlchemy
- Middleware & dependencies
- Authentication (JWT)
- Background Tasks
- Caching (Redis)
- Deploy (Docker, Railway/Render/Fly.io/DigitalOcean)