How nathan-au/rpg-mini works
Project type and purpose
• This is a standalone backend microservice (likely built with a web framework like FastAPI or Flask) that ingests documents, classifies them, and extracts data before persisting results in a local database.
• Key features (inferred from filenames):
– “endpoints/…”: REST API layer
– “logic/…”: business logic (classification, extraction)
– “database/…”: data access and ORM models
– “main.py”: application entry point
File structure
• Top-level files:
– constants.py, enums.py: shared configurations and types
– main.py: kicks off the web server and routes
– database.db (& database/database.db): SQLite database file
• Directories:
– endpoints/: REST handlers grouped by domain (clients, documents, intakes)
– logic/: core processing modules (classification.py, extraction.py)
– database/: DB layer (models.py defines ORM, database.py handles connections)
– tests/: sample docs and test suite
README
• No architecture details provided. We rely entirely on file structure.
a. Main components
1. API Gateway / Web Framework (main.py + endpoints/)
2. Business Logic Layer (logic/classification.py, logic/extraction.py)
3. Data Access Layer (database/database.py, database/models.py)
4. Persistence Store (SQLite database file)
5. External Clients (CLI, web UI, or upstream services consuming the API)
b. Relationships & data flows
• External Clients → HTTP requests → API Gateway
• API Gateway → invokes → Endpoint Handlers (clients.py, documents.py, intakes.py)
• Endpoint Handlers → call → Business Logic functions
• Business Logic → uses → Data Access Layer to read/write models
• Data Access Layer → persists → SQLite database
• Optionally: Business Logic may return results directly to clients or enqueue follow‐up tasks
c. Architectural patterns
• Layered architecture (Presentation/API → Business Logic → Data Access → Persistence)
• Separation of concerns: endpoints only handle HTTP, logic modules only handle processing
d. Key technologies & libraries
• Web framework (FastAPI/Flask) in main.py
• SQLAlchemy (or similar) in database/models.py
• SQLite (database.db)
Detailed separation of components
1. “Clients” at the left.