How wuleibo9981/fastapim works
This repository is a FastAPI user-management service framework intended to run across multiple nodes. The main workflow is an HTTP request entering the application, passing middleware and API routing, then reaching authentication, user-management, or health handlers; handlers use dependencies and database models before returning schema-shaped responses. It also includes Redis-backed rate limiting, Consul-style service discovery, and deployment/monitoring configuration. Some README capabilities, such as Grafana dashboards and detailed metrics collection, are documented but not evident as runtime modules in the sampled sources.
Main entry points: main.py Application entry · dependencies.py Auth and request dependencies · auth.py Authentication routes · schemas Request and response schemas
Components 24
API and requests
- Application entry
app/main.py - Request middleware
app/middleware.py - API router
app/api/main.py - Health routes
app/api/routes/health.py
Identity and users
- Authentication routes
app/api/routes/auth.py - User routes
app/api/routes/users.py - Request and response schemas
app/schemas - User model
app/models/user.py - Security utilities
app/utils/security.py - Validation utilities
app/utils/validation.py
Data and dependencies
- Auth and request dependencies
app/dependencies.py - Base model
app/models/base.py - SQL database manager
app/database.py - Redis cache and counters
app/database.py - Date and time utilities
app/utils/datetime.py
Scaling and operations
- Application settings
app/config.py - Service discovery
app/services/discovery.py - Notification service
app/services/notification.py - Nginx load balancing
docker/nginx.conf - Kubernetes service
k8s/service.yaml - Kubernetes autoscaling
k8s/hpa.yaml
Other components
- HTTP client
- Consul discovery
- Prometheus monitoring
Connections 36
- HTTP client → Application entry: sends requests
README.md - Application entry → Request middleware: sets up
app/main.py - Application entry → API router: mounts routes
app/main.py - API router → Authentication routes: routes to
app/api/main.py - API router → User routes: routes to
app/api/main.py - API router → Health routes: routes to
app/api/main.py - Authentication routes → Auth and request dependencies: uses auth
app/api/routes/auth.py - User routes → Auth and request dependencies: uses auth
app/api/routes/users.py - Health routes → Auth and request dependencies: uses checks
app/api/routes/health.py - Authentication routes → User model: authenticates users
app/api/routes/auth.py - User routes → User model: manages users
app/api/routes/users.py - Authentication routes → Request and response schemas: validates and responds
app/api/routes/auth.py - User routes → Request and response schemas: validates and responds
app/api/routes/users.py - Health routes → Request and response schemas: formats health
app/api/routes/health.py - Auth and request dependencies → SQL database manager: gets sessions
app/dependencies.py - Auth and request dependencies → Redis cache and counters: checks rate limits
app/dependencies.py - Auth and request dependencies → User model: loads current user
app/dependencies.py - User model → Base model: extends
app/models/user.py - Base model → SQL database manager: uses ORM base
app/models/base.py - Application entry → SQL database manager: initializes and closes
app/main.py - Application entry → Service discovery: registers service
app/main.py - Service discovery → Consul discovery: registers services
README.md - Application entry → Application settings: reads settings
app/main.py - SQL database manager → Application settings: reads connection settings
app/database.py - Request middleware → Application settings: reads settings
app/middleware.py - Authentication routes → Security utilities: uses security helpers
app/api/routes/auth.py - User model → Security utilities: hashes passwords
- Request and response schemas → Date and time utilities: uses date values
app/schemas/user.py - Request and response schemas → Validation utilities: validates inputs
- Prometheus monitoring → Application entry: monitors service
README.md - HTTP client → Nginx load balancing: may route through
README.md - Nginx load balancing → Application entry: balances requests
README.md - HTTP client → Kubernetes service: may route through
README.md - Kubernetes service → Application entry: balances requests
README.md - Kubernetes autoscaling → Kubernetes service: scales replicas
README.md - Auth and request dependencies → Notification service: provides service
app/dependencies.py