System_Architecture - SpecialAir123/Autio GitHub Wiki
This page describes the end-to-end architecture for Autioβs MVP:
- Frontend: React SPA for login & chat
-
Backend: FastAPI service exposing
/auth/*
and/chat/*
- Database: SQLite (dev) β PostgreSQL (prod)
- AI Service: OpenAI Chat Completions API
- Framework: React (Create React App)
-
Routes:
-
/login
β email/password form, stores JWT inlocalStorage
-
/chat
β chat UI, sends messages with Bearer token
-
- Responsibilities: UI state, input validation, message rendering.
- Purpose: TLS termination, routing to backend instances.
- Examples: Nginx, AWS ALB, Cloudflare.
-
Routers:
-
Auth:
/auth/signup
,/auth/login
-
Chat:
/chat/
(protected)
-
Auth:
- Security: OAuth2 password flow + JWT (python-jose, PassLib)
- DB Access: SQLAlchemy sessions via dependency injection
-
AI Integration: calls OpenAI ChatCompletion in
services/openai_client.py
- Dev: SQLite (file-based, no config)
- Prod: PostgreSQL (managed service)
-
Tables:
-
users
(id, email, hashed_pw, is_active) - (future)
messages
(id, user_id, role, text, timestamp)
-
- Service: OpenAI Chat Completions API
-
Model:
gpt-3.5-turbo
(or newer) - Config: temperature 0.7, system prompt βYou are Autio, recommending cars.β
-
User Login
- Frontend
POST /auth/login
with{email,password}
- Backend verifies or creates user β issues JWT
- Frontend stores JWT
- Frontend
-
Chat Interaction
- User sends message via React β
POST /chat/
+Authorization: Bearer <JWT>
- Backend validates JWT β extracts user
- Backend calls OpenAI β receives AI reply
- (Optional) Store user message & AI reply in DB
- Backend returns
{ reply: "..." }
- Frontend appends messages to chat window
- User sends message via React β
- Containerization: Dockerize both frontend & backend
-
Hosting:
- Frontend β Vercel, Netlify, S3+CloudFront
- Backend β AWS ECS/Fargate, Heroku, DigitalOcean App Platform
- Database: Migrate to managed Postgres (AWS RDS, Cloud SQL)
-
Scaling Strategies:
- Auto-scale backend instances behind load balancer
- Introduce Redis for rate-limiting or caching
- Use a queue (e.g. RabbitMQ, AWS SQS) for heavy processing or batching AI calls
This Wiki page captures Autioβs core system architecture for the MVP. Expand with network diagrams, security considerations, and operational runbooks as the project evolves.