How matthew-dz/dx-authengine works
DX-AuthEngine is a FastAPI business-operations and decision-support backend. Its main workflow authenticates staff, accepts refund requests, enforces refund-state transitions, records audit data, and exposes operational results; separate branches cover people, orders, analytics, and AI assistance. The README documents the H-P-D-I capabilities, while the source index and excerpts substantiate selected implementation links. Some README-described capabilities, such as role/policy administration and AI human-in-the-loop controls, are retained without speculative wiring where source evidence is limited.
Main entry points: main.py API application · refund_service.py Refund workflow · refunds.py Refund API · database.py Database sessions
Components 30
Identity and access
- Authentication API
app/api/v1/auth.py - JWT security
app/security.py - Users and employees
app/api/v1/employees.py - User management
app/api/v1/users.py - Employee schemas
app/schemas/employee.py
Refund workflow
- API application
app/main.py - Refund API
app/api/v1/refunds.py - Refund workflow
app/services/refund_service.py - Event dispatch
app/events/event_bus.py - Refund event handler
app/events/handlers/refund_handler.py - Email notifications
app/email_service.py
Business data
- Audit records
app/models.py - Order API
app/api/v1/orders.py - Order access
app/repositories/order_repository.py - Analytics API
app/api/v1/analytics.py - Analytics
app/services/analytics_service.py - Analytics queries
app/repositories/analytics_repository.py - Business entities
app/models.py - Database sessions
app/database.py - API schemas
app/schemas/__init__.py - Response envelope
app/schemas/common.py
AI assistance
- AI API
app/api/v1/ai.py - AI assistant
app/services/ai_service.py - Business data tools
app/services/ai_tools.py - AI data access
app/services/ai_data_service.py - RAG retrieval
app/services/rag_service.py - Knowledge base
app/services/knowledge_service.py - Refund content assistant
app/agent.py - AI schemas
app/schemas_ai.py
Other components
- Staff user
Connections 35
- Staff user → API application: uses API
README.md - API application → Authentication API: registers route
app/main.py - API application → Users and employees: registers route
app/main.py - API application → User management: registers route
app/main.py - API application → Refund API: registers route
app/main.py - API application → Order API: registers route
app/main.py - API application → Analytics API: registers route
app/main.py - API application → AI API: registers route
app/main.py - Authentication API → JWT security: uses authentication
app/api/v1/auth.py - Users and employees → JWT security: checks identity
app/api/v1/employees.py - User management → JWT security: checks identity
app/api/v1/users.py - Refund API → JWT security: checks identity
app/api/v1/refunds.py - Refund API → Refund workflow: delegates workflow
app/api/v1/refunds.py - Refund workflow → Business entities: updates entities
app/services/refund_service.py - Refund workflow → Database sessions: commits changes
app/services/refund_service.py - Refund workflow → Event dispatch: publishes event
app/services/refund_service.py - Event dispatch → Refund event handler: dispatches event
app/events/event_bus.py - Refund event handler → Email notifications: sends notification
app/events/handlers/refund_handler.py - Refund workflow → Audit records: writes audit log
app/services/refund_service.py - Refund workflow → Refund content assistant: generates content
app/services/refund_service.py - Order API → Business entities: queries orders
app/api/v1/orders.py - Order access → Database sessions: reads and writes
app/repositories/order_repository.py - Analytics API → Analytics: delegates analysis
app/api/v1/analytics.py - Analytics queries → Database sessions: queries metrics
app/repositories/analytics_repository.py - AI API → AI assistant: delegates assistant
app/api/v1/ai.py - AI assistant → RAG retrieval: retrieves knowledge
app/services/ai_service.py - AI assistant → Business data tools: uses business tools
app/services/ai_service.py - Business data tools → AI data access: requests data
app/services/ai_tools.py - Business data tools → Refund workflow: invokes workflow
app/services/ai_tools.py - RAG retrieval → Knowledge base: loads knowledge
app/services/rag_service.py - AI API → AI schemas: validates payloads
app/api/v1/ai.py - Refund API → API schemas: validates requests
app/api/v1/refunds.py - API schemas → Response envelope: uses envelope
app/schemas/__init__.py - Authentication API → Employee schemas: uses employee schemas
app/api/v1/auth.py - Database sessions → Business entities: maps entities
app/models.py