Axon is a full-stack AI workspace that lets users upload documents and databases, explore schema and data, and chat with an agent that uses conversation history plus local tools (document context and safe SQL context) to produce grounded answers.
The backend is FastAPI + SQLAlchemy (async) with Alembic migrations for schema management. The frontend is React 19 + TypeScript + Vite 7 with TailwindCSS 4 for styling.
| Layer | Technologies | Version |
|---|---|---|
| Backend Runtime | FastAPI, Uvicorn, ASGI | FastAPI 0.116+, Uvicorn 0.35+ |
| Database & ORM | SQLAlchemy (async), Alembic, aiosqlite, asyncpg | SQLAlchemy 2.0+, Alembic 1.16+ |
| Authentication | python-jose (JWT), passlib (bcrypt), email-validator | python-jose 3.3+, passlib 1.7+ |
| AI/Agent Pipeline | LangGraph (StateGraph), provider routing (Gemini/OpenAI) | LangGraph 0.2+ |
| Frontend Runtime | React, React Router, Zustand (state) | React 19.1+, React Router 7.14+, Zustand 5.0+ |
| Frontend Tooling | Vite, TypeScript, ESLint, TailwindCSS | Vite 7.1+, TypeScript 5.8+, TailwindCSS 4.1+ |
| Frontend UI | Monaco Editor, Framer Motion, Lucide Icons | Monaco Editor 0.52+, Framer Motion 11.11+ |
| Database Support | SQLite (default via aiosqlite), PostgreSQL-compatible | sqlite+aiosqlite, asyncpg 0.30+ |
| Export | DOCX/ZIP/XLSX via openpyxl | openpyxl 3.1+ |
| Deployment | Terraform, Ansible, Nginx, Docker | (In infra/ and monitoring/) |
- LangGraph-driven node pipeline (
collect_context→build_prompt→generate_answer) - Conversation-aware responses (history included in prompt)
- Model preference routing (Gemini, GPT-4, etc.)
- Graceful fallback when no provider API key is configured
- Tool-assisted context:
- Document excerpt context from attached files
- Database schema snapshot for schema-oriented queries
- Safe read-only SQL sampling with query validation
- Upload and attach documents to messages
- Conversation history with message threading
- Conversation export to DOCX/ZIP formats
- Message feedback submission (helpful/unhelpful/report)
- Conversation organization and search
- Save and test DB connection settings
- Schema inspection and visualization
- Query execution for SQLite/PostgreSQL databases
- Query suggestion endpoint powered by LLM
- Query results export to Excel/CSV
- Python 3.10 or higher (tested on 3.13+)
- Node.js 18 or higher (npm 9+)
- Git
git clone https://github.com/vedantlahane/Axon.git
cd Axoncd backend
python3 -m venv venv
source venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install -r requirements.txtcd backend
python -m venv venv
.\venv\Scripts\Activate.ps1
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txtIf script execution is blocked, run this once in the current PowerShell session:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy BypassThen re-run the Activate script above.
Create or update root .env (project root) with:
# Backend core
APP_NAME=Axon AI Platform
API_PREFIX=/api
SECRET_KEY=change-me-in-production
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=60
DATABASE_URL=sqlite+aiosqlite:///./backend/axon.db
CORS_ORIGINS=["http://localhost:3000","http://localhost:5173"]
# Optional LLM providers (at least one recommended for chat features)
GEMINI_API_KEY=
GOOGLE_API_KEY=
OPENAI_API_KEY=
TAVILY_API_KEY=
# Frontend
VITE_API_BASE_URL=http://localhost:8000/apiNote: For production, change
SECRET_KEYto a strong random value. See.env.examplefor all available settings.
cd backend
source venv/bin/activate # or .\venv\Scripts\Activate.ps1 on Windows
alembic upgrade headThis creates the initial schema: users, conversations, messages, documents, etc.
From repo root:
source backend/venv/bin/activate
python -m uvicorn backend.main:app --reload --host 0.0.0.0 --port 8000Or use the provided Makefile:
make backend-runBackend will be ready at http://localhost:8000.
In a new terminal:
cd frontend
npm install
npm run devBy default, the frontend reads VITE_API_BASE_URL from the workspace root .env and connects to http://localhost:8000/api.
| Service | URL |
|---|---|
| Frontend | http://localhost:5173 |
| API Docs (Swagger) | http://localhost:8000/docs |
| API ReDoc | http://localhost:8000/redoc |
| API Root | http://localhost:8000/api/ |
| Health Check | http://localhost:8000/api/health/ |
Axon uses Alembic for versioned schema management. Do NOT manually call Base.metadata.create_all().
cd backend
source venv/bin/activate
alembic upgrade headcd backend
source venv/bin/activate
# Edit models as needed, then:
alembic revision --autogenerate -m "describe your change"
alembic upgrade headcd backend
source venv/bin/activate
alembic downgrade -120260331_0001_create_core_tables– Users, conversations, documents20260331_0002_add_messages_tables– Message threads and feedback
All endpoints are under /api/ prefix (configured via API_PREFIX in settings).
POST /api/auth/register/– Create new accountPOST /api/auth/login/– Get access tokenPOST /api/auth/logout/– Revoke sessionGET /api/auth/me/– Current user profilePOST /api/auth/password/reset/– Request password resetPOST /api/auth/password/reset/confirm/– Confirm reset with tokenPOST /api/auth/password/change/– Change password (authenticated)PUT /api/auth/profile/– Update user profile
POST /api/chat/– Send message to agent (creates/continues conversation)GET /api/conversations/– List user's conversationsGET /api/conversations/{id}/– Get conversation details with messagesDELETE /api/conversations/{id}/– Delete conversationGET /api/conversations/{id}/export/– Export as DOCXPOST /api/conversations/{id}/export/zip/– Export as ZIP archive
GET /api/documents/– List uploaded documentsPOST /api/documents/– Upload new documentGET /api/documents/{id}/download/– Download document fileDELETE /api/documents/{id}/– Delete document
GET /api/database/connection/– Get saved connection settingsPOST /api/database/connection/– Save connection (SQLite/PostgreSQL URL)DELETE /api/database/connection/– Clear connectionPOST /api/database/connection/test/– Test connection validityPOST /api/database/upload/– Upload SQLite filePOST /api/database/query/– Execute read-only queryGET /api/database/schema/– Fetch schema metadataPOST /api/database/query/suggestions/– Get AI-generated query suggestionsPOST /api/database/export/– Export query results
GET /api/models/– List available LLM modelsPOST /api/models/set/– Set preferred model (Gemini/OpenAI/etc.)GET /api/preferences/– User settings and preferencesPUT /api/preferences/update/– Update user preferencesPOST /api/messages/{id}/feedback/– Rate message (helpful/unhelpful)DELETE /api/messages/{id}/feedback/delete/– Clear message feedback
Syntax validation:
cd backend
source venv/bin/activate
python -m compileall .Run unit tests:
cd backend
python -m unittest -v \
backend.tests.test_agent_pipeline \
backend.tests.test_agent_chat_api \
backend.tests.test_agent_model_preferences \
backend.tests.test_api_end_to_endOr use Makefile:
make backend-testRun live provider tests (requires GEMINI_API_KEY or OPENAI_API_KEY):
AXON_RUN_LIVE_PROVIDER_TESTS=1 python -m unittest -v backend.tests.test_agent_live_providerOr:
make backend-test-liveLint frontend code:
cd frontend
npm run lintBuild for production:
cd frontend
npm run buildPreview production build:
cd frontend
npm run previewAxon/
├── .env # Environment variables (local)
├── .env.example # Environment template
├── backend/
│ ├── main.py # FastAPI app entry point
│ ├── config.py # Pydantic settings
│ ├── database.py # SQLAlchemy async engine
│ ├── requirements.txt # Python dependencies
│ ├── alembic.ini # Migration config
│ ├── agent/
│ │ ├── __init__.py
│ │ └── pipeline.py # LangGraph StateGraph logic
│ ├── alembic/
│ │ ├── env.py
│ │ ├── script.py.mako
│ │ └── versions/ # Versioned migrations
│ │ ├── 20260331_0001_create_core_tables.py
│ │ └── 20260331_0002_add_messages_tables.py
│ ├── auth/
│ │ ├── dependencies.py # JWT token verification
│ │ └── jwt.py # Token encode/decode
│ ├── models/
│ │ ├── __init__.py
│ │ ├── user.py
│ │ ├── conversation.py
│ │ ├── message.py
│ │ ├── document.py
│ │ └── system_graph.py
│ ├── routers/
│ │ ├── __init__.py
│ │ ├── api_compat.py # Main router (includes all sub-routers)
│ │ ├── auth.py
│ │ ├── chat.py
│ │ ├── database.py
│ │ ├── documents.py
│ │ ├── export.py
│ │ ├── graph.py
│ │ └── health.py
│ ├── schemas/
│ │ ├── auth.py
│ │ ├── conversation.py
│ │ ├── database.py
│ │ └── graph.py
│ ├── tests/
│ │ ├── __init__.py
│ │ ├── README.md
│ │ ├── test_*.py # Unit test suite
│ │ ├── test_support.py # Common test utilities
│ │ └── warnings_config.py
│ └── [uploads/] # Dynamic: user file storage
├── frontend/
│ ├── package.json
│ ├── tsconfig.json
│ ├── vite.config.ts
│ ├── eslint.config.js
│ ├── index.html
│ ├── src/
│ │ ├── App.tsx # Root router and providers
│ │ ├── main.tsx # React DOM mount
│ │ ├── index.css # Global styles (TailwindCSS + custom)
│ │ ├── components/
│ │ │ ├── Canvas/ # Database schema viewer
│ │ │ ├── chat/
│ │ │ ├── command/
│ │ │ ├── documents/
│ │ │ ├── errors/
│ │ │ ├── layout/
│ │ │ ├── library/
│ │ │ ├── modals/
│ │ │ ├── settings/
│ │ │ └── skeletons/
│ │ ├── hooks/ # Custom React hooks
│ │ ├── stores/ # Zustand state stores
│ │ ├── services/ # API client functions
│ │ ├── types/ # TypeScript interfaces
│ │ ├── utils/ # Helpers and utilities
│ │ └── styles/ # TailwindCSS modules
│ └── public/ # Static assets
├── docs/
│ ├── README.md
│ ├── CONTEXT.md # Architecture & design decisions
│ ├── DEPLOYMENT.md # Deployment guide
│ └── presentation/
├── infra/
│ ├── terraform/ # IaC for cloud deployment
│ ├── ansible/ # Configuration management
│ └── nginx/
├── monitoring/
│ ├── prometheus/
│ ├── grafana/
│ └── alertmanager/
├── mcp/
│ ├── server.py
│ ├── requirements.txt
│ └── Dockerfile
├── docker-compose.yml # Local dev stack
├── docker-compose.prod.yml # Production stack
├── Makefile # Development shortcuts
└── README.md # This file
- Do NOT reintroduce
Base.metadata.create_all()inbackend/main.py - Always use Alembic migrations via
alembic revision --autogenerate - This ensures reproducible, versioned schema changes
- Passwords are hashed with bcrypt via
passlib(pbkdf2_sha256 backend) - JWTs are signed using
ALGORITHM=HS256(configurable) ACCESS_TOKEN_EXPIRE_MINUTEScontrols session duration (default: 60 minutes)- Always set a strong
SECRET_KEYin production
- Frontend expects routes under
/api/prefix (not/api/v1or unversioned) - Configure via
API_PREFIXin settings - CORS is enabled for localhost development ports; update for production
- The
stitch/directory contains design system components and UI modules - Component hierarchy:
Canvas/→ database schema,chat/→ messaging UI, etc. - Styling uses TailwindCSS 4 with custom tokens in
src/styles/
- Chat: At least one of
GEMINI_API_KEY,GOOGLE_API_KEY, orOPENAI_API_KEY - Database: PostgreSQL support via
DATABASE_URL(e.g.,postgresql+asyncpg://...) - Web UI:
VITE_API_BASE_URLmust point to your API backend
- CONTEXT.md – Architecture, design decisions, and system overview
- DEPLOYMENT.md – Deployment guides and infrastructure setup
- Backend Tests –
backend/tests/README.mdfor test architecture
Distributed under the MIT License. See LICENSE for details.


