How cfa-huddle/huddle-api works
Huddle is a backend API for restaurant-team accounts, location memberships and roles, posts, and push notifications. The main workflow is a mobile client calling the FastAPI routes: requests are authenticated into a user context, then domain services enforce permissions and persist or retrieve data; creating a post also finds location members and dispatches push notifications. User management additionally coordinates identity-provider accounts with location memberships. The README mentions training and feedback, but the supplied tree and sampled source do not expose their implementation, so those capabilities are not mapped. Some route and service wiring is inferred only from filenames and remains unexpanded.
Main entry points: main.py FastAPI entry · context.py Request context · post_service.py Team posts · notification_service.py Push delivery
Components 21
API and identity
- FastAPI entry
app/main.py - User routes
app/api/v1/users.py - Membership routes
app/api/v1/memberships.py - Post routes
app/api/v1/posts.py - Notification routes
app/api/v1/notifications.py - Request context
app/core/context.py - Token validation
app/core/auth.py
Team workflows
- User management
app/service/user_service.py - Location memberships
app/service/membership_service.py - Team posts
app/service/post_service.py - Push delivery
app/service/notification_service.py - Push token registry
app/service/push_token_repository.py
Data access
- DynamoDB adapter
app/db.py - Roles and memberships
app/model/membership_model.py - User records
app/model/user_model.py - Post records
app/model/post_model.py
External services
- DynamoDB
- Cognito identity
- JWKS endpoint
- Expo push service
Other components
- Mobile client
Connections 26
- Mobile client → FastAPI entry: calls API
- FastAPI entry → User routes: dispatches
- FastAPI entry → Membership routes: dispatches
- FastAPI entry → Post routes: dispatches
- FastAPI entry → Notification routes: dispatches
- User routes → Request context: resolves identity
- Membership routes → Request context: resolves identity
- Post routes → Request context: resolves identity
- Notification routes → Request context: resolves identity
- Request context → Token validation: validates token
- Token validation → JWKS endpoint: fetches keys
- User routes → User management: invokes
- Membership routes → Location memberships: invokes
- Post routes → Team posts: invokes
- Notification routes → Push token registry: manages tokens
- User management → Cognito identity: creates and lists users
- User management → Location memberships: assigns memberships
- Team posts → Location memberships: finds recipients
- Team posts → Push delivery: notifies members
- Location memberships → DynamoDB adapter: reads and writes
- Team posts → DynamoDB adapter: reads and writes
- Push token registry → DynamoDB adapter: reads and writes
- DynamoDB adapter → DynamoDB: accesses tables
- Push delivery → Push token registry: loads tokens
- Push delivery → Push token registry: deactivates invalid tokens
- Push delivery → Expo push service: publishes pushes