How samanwaya938/fastapi_tutorial works
This repository is a collection of small FastAPI tutorial examples rather than one integrated service: a greeting/student API, two book APIs, and an authentication API. The user-facing workflows are HTTP requests handled by each example; book operations either mutate an in-memory catalog or use SQLAlchemy, while authentication supports signup, login, bearer-token validation, and role-restricted routes. The graph keeps these examples separate. Source excerpts show the principal calls and persistence setup; the README provides no additional capability detail.
Main entry points: main.py Auth and access routes · project.py SQL book API · crud.py Book CRUD API · auth_database.py Auth database setup
Components 13
Basic API
- Greeting and student API
main.py
Book APIs
- Book CRUD API
crud.py - In-memory catalog
crud.py - SQL book API
project.py
Authentication
- Auth and access routes
auth/main.py - User schemas
auth/schemas.py - User model
auth/models.py - Password hashing
auth/utils.py - Auth database setup
auth/auth_database.py
Persistence
- Book model
model.py - SQL database setup
database.py
Other components
- API caller
- MySQL database
Connections 13
- API caller → Greeting and student API: sends requests
main.py - API caller → Book CRUD API: sends requests
crud.py - API caller → SQL book API: sends requests
project.py - API caller → Auth and access routes: sends requests
auth/main.py - Book CRUD API → In-memory catalog: reads and mutates
crud.py - SQL book API → SQL database setup: gets sessions
project.py - SQL book API → Book model: queries and creates
project.py - SQL database setup → MySQL database: connects to
database.py - Auth and access routes → User schemas: validates input
auth/main.py - Auth and access routes → User model: queries and saves
auth/main.py - Auth and access routes → Password hashing: hashes and verifies
auth/main.py - Auth and access routes → Auth database setup: gets sessions
auth/main.py - Auth database setup → MySQL database: connects to
auth/auth_database.py