How pycodebr/car_api works
Car API is a FastAPI REST service for accounts, authentication, vehicle brands, and users’ cars. A client sends requests through the application’s registered routers; the handlers validate request and response data, apply domain rules, and use an async SQLAlchemy session to access persisted records. Authentication issues and refreshes JWTs, while protected operations resolve the current user. The README identifies SQLite as the database. The graph reflects sampled handlers and documented capabilities; unsampled settings and migration wiring are not inferred.
Main entry points: database.py Async database sessions · cars.py Car management · security.py JWT and password security · app.py FastAPI application
Components 15
API routing
- FastAPI application
car_api/app.py
Identity and access
- Authentication routes
car_api/routers/auth.py - JWT and password security
car_api/core/security.py - User management
car_api/routers/users.py - User records
car_api/models/users.py - User schemas
car_api/schemas/users.py
Vehicle catalog
- Brand management
car_api/routers/brands.py - Car management
car_api/routers/cars.py - Cars and brands
car_api/models/cars.py - Car schemas
car_api/schemas/cars.py - Brand schemas
car_api/schemas/brands.py
Persistence and contracts
- Async database sessions
car_api/core/database.py - Application settings
car_api/core/settings.py - SQLite database
Other components
- API client
Connections 29
- API client → FastAPI application: sends requests
README.md - FastAPI application → Authentication routes: registers routes
car_api/app.py - FastAPI application → User management: registers routes
car_api/app.py - FastAPI application → Brand management: registers routes
car_api/app.py - FastAPI application → Car management: registers routes
car_api/app.py - Authentication routes → JWT and password security: authenticates and issues
car_api/routers/auth.py - Authentication routes → User schemas: validates tokens
car_api/routers/auth.py - Authentication routes → Async database sessions: gets session
car_api/routers/auth.py - Authentication routes → User records: uses current user
car_api/routers/auth.py - JWT and password security → Async database sessions: gets session
car_api/core/security.py - JWT and password security → User records: queries users
car_api/core/security.py - User management → JWT and password security: hashes passwords
car_api/routers/users.py - User management → Async database sessions: gets session
car_api/routers/users.py - User management → User records: reads and writes
car_api/routers/users.py - User management → User schemas: validates and serializes
car_api/routers/users.py - Brand management → JWT and password security: checks access
car_api/routers/brands.py - Brand management → Async database sessions: gets session
car_api/routers/brands.py - Brand management → Cars and brands: queries brands and cars
car_api/routers/brands.py - Brand management → Brand schemas: validates and serializes
car_api/routers/brands.py - Car management → JWT and password security: checks access
car_api/routers/cars.py - Car management → Async database sessions: gets session
car_api/routers/cars.py - Car management → Cars and brands: reads and writes
car_api/routers/cars.py - Car management → User records: uses current user
car_api/routers/cars.py - Car management → Car schemas: validates and serializes
car_api/routers/cars.py - Async database sessions → Application settings: loads database URL
car_api/core/database.py - Async database sessions → SQLite database: connects via engine
README.md - Car schemas → Brand schemas: embeds brand data
car_api/schemas/cars.py - Car schemas → User schemas: embeds user data
car_api/schemas/cars.py - Cars and brands → User records: relates car owner
car_api/models/cars.py