How reminia/ticket-system works
Project Type & Purpose
• This is a backend-only RESTful microservice (“ticket system”) that lets clients create, query, and manually trigger processing of support tickets.
• It enqueues new tickets into Redis via RQ for asynchronous AI-driven categorization, prioritization, and initial responses.
Top-Level Components
From the file tree and README we see:
– API Layer: FastAPI routes in src/api/v1/ticket_api.py
– Business Logic / Workers: src/core (ai.py, worker.py, utils.py, config.py)
– Data Layer: src/models (SQLAlchemy + Pydantic models, SQLite database)
– Queueing: Redis + RQ (jobs queued and consumed by an RQ worker)
– External Services: LLM providers via LangChain (Anthropic/OpenAI or proxy)
Relationships & Data-Flow
Interactions:
a. Client → FastAPI HTTP server (uvicorn)
b. “Create Ticket” endpoint
• Validates payload via Pydantic schemas
• Persists initial ticket record in SQLite
• Enqueues a processing job to Redis/RQ
c. RQ Worker
• Pulls job from Redis
• Uses core.ai → LangChain → LLM provider
• Receives category/priority/response
• Updates ticket record in SQLite
d. Query endpoints read directly from SQLite
e. Manual trigger endpoint enqueues jobs similarly
Architectural Patterns & Principles
• Layered separation:
– Presentation/API
– Business/Worker logic
– Data/persistence
• Asynchronous processing via work queue
• Dependency injection via config.py (environment variables, proxies)
• Single-process DB (SQLite) – suitable for lightweight deployments
– Notes on environment/config (e.g., .env settings, proxy URLs)
Putting it all together:
Inside FastAPI, annotate src/api/v1.