Enterprise-AI-Gateway / docs /project_structure.md
vn6295337's picture
Initial commit: Enterprise-AI-Gateway - Secure LLM gateway
bb0c63f
# Project Structure
> **Primary Responsibility:** Directory layout and codebase organization
Directory layout for the Enterprise AI Gateway.
```
Enterprise-AI-Gateway/
β”œβ”€β”€ src/ # Source code
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ main.py # FastAPI application entry point
β”‚ β”œβ”€β”€ config.py # Configuration and LLM client
β”‚ β”œβ”€β”€ api/
β”‚ β”‚ └── routes.py # API route definitions
β”‚ β”œβ”€β”€ llm/
β”‚ β”‚ └── client.py # LLM provider client
β”‚ β”œβ”€β”€ metrics/
β”‚ β”‚ └── __init__.py # Metrics tracking
β”‚ β”œβ”€β”€ models/
β”‚ β”‚ └── __init__.py # Pydantic models
β”‚ β”œβ”€β”€ providers/
β”‚ β”‚ └── __init__.py # Provider configuration
β”‚ └── security/
β”‚ └── __init__.py # Security utilities (auth, PII, toxicity)
β”‚
β”œβ”€β”€ static/
β”‚ └── index.html # Interactive demo dashboard
β”‚
β”œβ”€β”€ tests/
β”‚ β”œβ”€β”€ __init__.py
β”‚ β”œβ”€β”€ unit/
β”‚ β”‚ └── test_security_models.py
β”‚ └── integration/
β”‚ └── test_gateway.py
β”‚
β”œβ”€β”€ docs/ # Documentation (MECE structure)
β”‚ β”œβ”€β”€ README.md # Index + Quick Start
β”‚ β”œβ”€β”€ api_reference.md # API endpoints & functions
β”‚ β”œβ”€β”€ architecture.md # System design & data flow
β”‚ β”œβ”€β”€ configuration.md # Environment variables
β”‚ β”œβ”€β”€ deployment.md # Deployment procedures
β”‚ β”œβ”€β”€ faq.md # Q&A format help
β”‚ β”œβ”€β”€ project_structure.md # This file
β”‚ β”œβ”€β”€ security_overview.md # Security architecture
β”‚ β”œβ”€β”€ testing.md # Testing procedures
β”‚ └── troubleshooting.md # Problem resolution
β”‚
β”œβ”€β”€ examples/
β”‚ └── basic_usage.py # Usage examples
β”‚
β”œβ”€β”€ scripts/
β”‚ └── health_check.py # Health check script
β”‚
β”œβ”€β”€ Dockerfile # Docker build configuration
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ README.md # Project overview (root)
└── BUSINESS_README.md # HuggingFace Spaces README
```
## Key Directories
### `src/` - Source Code
| Module | Purpose |
|--------|---------|
| `main.py` | FastAPI app initialization, middleware setup |
| `config.py` | Environment config, LLM client initialization |
| `api/routes.py` | HTTP endpoint handlers |
| `llm/client.py` | Multi-provider LLM client with cascade |
| `security/__init__.py` | Auth, PII detection, AI safety (Gemini + Lakera) |
| `models/__init__.py` | Request/response Pydantic models |
| `metrics/__init__.py` | Performance metrics tracking |
| `providers/__init__.py` | Provider pricing and configuration |
### `static/` - Frontend
Single-page interactive dashboard with:
- Real-time pipeline visualization
- Security gate status indicators
- Rate limiting controls
- Test scenario selector
### `tests/` - Test Suite
| Directory | Purpose |
|-----------|---------|
| `unit/` | Unit tests for individual functions |
| `integration/` | API endpoint integration tests |
### `docs/` - Documentation
See [Documentation Index](README.md) for the complete MECE documentation structure.
## Data Flow
```
Request β†’ src/main.py
↓
src/security/ (auth, PII, toxicity check)
↓
src/llm/client.py (provider cascade)
↓
Response
```
## Related Docs
- [Architecture](architecture.md) - Detailed system design
- [API Reference](api_reference.md) - Endpoint documentation
- [Configuration](configuration.md) - Environment setup