How vandanabasavarajpatil/fastapi works
This is a FastAPI backend for user accounts, authenticated post management, and post voting. A client sends requests through the application’s mounted routers; account creation stores a password hash, login verifies credentials and issues a JWT, and protected post and vote operations resolve that token to a user before accessing PostgreSQL. Post listings include vote counts, and post mutations enforce ownership. The source excerpts show the main routers and persistence/authentication layers; no README capabilities were available to verify beyond them.
Main entry points: database.py Session provider · auth.py Login endpoint · oauth2.py JWT authentication · models.py ORM models
Components 13
API routing
- Application entry
app/main.py
Identity and access
- Login endpoint
app/routers/auth.py - User endpoints
app/routers/user.py - JWT authentication
app/oauth2.py - Password hashing
app/utils.py
Posts and voting
- Post endpoints
app/routers/post.py - Vote endpoint
app/routers/vote.py
Persistence and contracts
- Request responses
app/schemas.py - ORM models
app/models.py - Session provider
app/database.py - Runtime settings
app/config.py
Other components
- API client
- PostgreSQL
Connections 28
- API client → Application entry: sends requests
- Application entry → Post endpoints: mounts router
- Application entry → User endpoints: mounts router
- Application entry → Login endpoint: mounts router
- Application entry → Vote endpoint: mounts router
- Login endpoint → Session provider: requests session
- Login endpoint → ORM models: queries users
- Login endpoint → Password hashing: verifies password
- Login endpoint → JWT authentication: creates token
- User endpoints → Session provider: requests session
- User endpoints → ORM models: stores user
- User endpoints → Password hashing: hashes password
- Post endpoints → JWT authentication: resolves user
- Vote endpoint → JWT authentication: resolves user
- JWT authentication → Session provider: requests session
- JWT authentication → ORM models: loads user
- Login endpoint → Request responses: uses token schemas
- User endpoints → Request responses: validates and formats
- Post endpoints → Request responses: validates and formats
- Vote endpoint → Request responses: validates vote
- Post endpoints → Session provider: requests session
- Post endpoints → ORM models: queries and mutates
- Vote endpoint → Session provider: requests session
- Vote endpoint → ORM models: queries and mutates
- Session provider → ORM models: provides base
- Session provider → Runtime settings: reads settings
- JWT authentication → Runtime settings: reads settings
- Session provider → PostgreSQL: connects and persists