Architecture Documentation
šļø Introduction
This document describes the technical architecture and data flow of Alesqui Intelligence, an AI-powered API integration platform designed for enterprise environments.
Target Audience: CISOs, Security Architects, Compliance Officers, IT Directors, Enterprise Technical Evaluators
Alesqui Intelligence enables users to interact with multiple APIs through natural language queries, powered by large language models (LLMs) while maintaining complete data sovereignty through self-hosted deployment.
š Table of Contents
- Introduction
- High-Level Architecture
- System Architecture
- Data Flow Architecture
- AI Agent Architecture
- Security Architecture
- Scalability & Performance
- Monitoring & Observability
- Deployment Architecture
- Network Security
- Disaster Recovery
- Compliance Considerations
- Technology Stack Summary
- Questions?
šÆ High-Level Architecture
System Components
1. Frontend: React + TypeScript (Vite)
- Single-page application (SPA)
- Responsive UI with TailwindCSS
- JWT-based authentication
- Real-time server-sent events (SSE) for chat streaming
2. Backend: Spring Boot (Java 21) + WebFlux
- Reactive, non-blocking REST API
- Stateless architecture (horizontal scaling)
- Spring AI integration for LLM orchestration
- MongoDB reactive drivers
3. Database: MongoDB
- NoSQL document store
- Collections:
users- User accounts with bcrypt-hashed passwordsgroups- Access control groupsuser_group_links- User-to-group associationsswagger_documents- OpenAPI/Swagger specificationspostman_collection_documents- Postman collectionsunified_api_specs- Normalized API definitionsapi_group_links- API-to-group visibility controlconversations- Chat history with step-by-step reasoningaudit_logs- Security and compliance logs (TTL-indexed)
4. External Services
- OpenAI API (or Azure OpenAI): LLM for natural language processing
- SMTP Server: Email notifications (activation, password reset)
šļø System Architecture
Layered Architecture Diagram
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā CLIENT TIER ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā React 18 SPA (TypeScript + Vite) ā ā
ā ā - Chat Interface ā ā
ā ā - API Configuration UI ā ā
ā ā - Admin Dashboard ā ā
ā ā - Diagnostics Panel ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā HTTPS
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā REVERSE PROXY TIER ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Nginx / Traefik / Cloud Load Balancer ā ā
ā ā - SSL/TLS Termination ā ā
ā ā - Request routing ā ā
ā ā - Rate limiting (optional) ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā HTTP
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā APPLICATION TIER ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Spring Boot WebFlux Application (Java 21) ā ā
ā ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā ā ā Controller Layer ā ā ā
ā ā ā - REST API Endpoints ā ā ā
ā ā ā - SSE Streaming Endpoints ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā ā ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā ā ā Security Layer ā ā ā
ā ā ā - JWT Authentication Filter ā ā ā
ā ā ā - Role-Based Authorization ā ā ā
ā ā ā - Group-Based Access Control ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā ā ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā ā ā Service Layer ā ā ā
ā ā ā - AI Agent Service (ReAct Pattern) ā ā ā
ā ā ā - API Management Service ā ā ā
ā ā ā - User Management Service ā ā ā
ā ā ā - Conversation Service ā ā ā
ā ā ā - Audit Service ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā ā ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā ā ā Repository Layer (Reactive) ā ā ā
ā ā ā - Spring Data MongoDB Reactive ā ā ā
ā ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā MongoDB Protocol
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā DATA TIER ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā MongoDB 7 Replica Set ā ā
ā ā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā ā ā
ā ā ā Primary ā ā Secondary ā ā Secondary ā ā ā
ā ā ā Node āāāā Node āāāā Node ā ā ā
ā ā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā ā ā
ā ā ā ā
ā ā Collections: ā ā
ā ā - users - conversations ā ā
ā ā - groups - audit_logs ā ā
ā ā - user_group_links - swagger_documents ā ā
ā ā - api_group_links - postman_collection_documents ā ā
ā ā - unified_api_specs ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā EXTERNAL SERVICES ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā OpenAI API (api.openai.com) ā ā
ā ā - GPT-4 for natural language processing ā ā
ā ā - Function calling for API selection ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā SMTP Server (Configurable) ā ā
ā ā - Email notifications ā ā
ā ā - Account activation ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Architecture Highlights
- ā Reactive, Non-Blocking I/O: Spring WebFlux enables high concurrency with minimal threads
- ā Stateless Backend: JWT tokens eliminate need for session storage, enabling horizontal scaling
- ā AI Agent with ReAct Pattern: Reasoning + Acting loop for intelligent API selection
- ā MongoDB Flexibility: Schema-less design supports evolving data models
- ā Event-Driven Communication: Server-Sent Events (SSE) for real-time streaming
- ā Security at Every Layer: JWT authentication, RBAC, group-based visibility
- ā Docker-First Deployment: Multi-stage builds optimize image size and security
Technical Details
Frontend Stack:
React App (Vite)
āāā Authentication Layer (JWT tokens)
āāā Routing (React Router)
āāā State Management (React Context + hooks)
āāā API Client (Axios with interceptors)
āāā Real-time Communication (EventSource for SSE)
āāā UI Components (TailwindCSS + custom components)
Frontend Implementation Details:
- JWT stored in memory (access token) and HTTP-only cookies (refresh token)
- Automatic token refresh on 401 responses
- Role-based UI rendering (SUPERADMIN, IT, BUSINESS)
- Server-sent events for streaming AI responses
Backend Stack:
Spring Boot WebFlux Application
āāā Security Layer (JWT Authentication Filter)
āāā Controllers (REST endpoints)
āāā Services (Business logic)
ā āāā ChatService (AI conversation orchestration)
ā āāā UserService (User management)
ā āāā ApiService (API specification management)
ā āāā AuditService (Compliance logging)
ā āāā ToolServices (AI agent tools)
āāā Repositories (Reactive MongoDB access)
āāā Spring AI Integration
ā āāā ChatClient (OpenAI integration)
ā āāā Tool Registration (Function calling)
ā āāā ReAct Loop Orchestration
āāā Security
āāā JWT Service (Token generation/validation)
āāā Password Encoder (BCrypt)
āāā RBAC (Role-based access control)
Key Design Patterns:
- Reactive Programming: Non-blocking I/O with Project Reactor (Mono/Flux)
- Stateless Design: No server-side sessions, JWT-based authentication
- Repository Pattern: Data access abstraction
- Service Layer Pattern: Business logic encapsulation
š Data Flow Architecture
User Registration & Activation Flow
1. SUPERADMIN creates user (POST /api/admin/users)
ā Backend generates secure activation token (32 bytes)
ā Stored in MongoDB with 48-hour expiration
ā Email sent via SMTP with activation link
2. User clicks activation link (GET /api/auth/validate-token?token=...)
ā Backend validates token expiration and uniqueness
ā Frontend renders password setup form
3. User sets password (POST /api/auth/activate-account)
ā Password hashed with BCrypt (default strength)
ā User marked as active
ā Token invalidated (single-use)
ā Email confirmation sent
Authentication Flow
1. User submits credentials (POST /api/auth/login)
ā Backend validates username/password with BCrypt
ā Generates JWT access token (15 min expiration)
ā Generates JWT refresh token (7 days expiration)
ā Returns both tokens to client
ā Logs login in audit_logs collection
2. Frontend stores tokens:
ā Access token: Memory (JavaScript variable)
ā Refresh token: HTTP-only cookie (secure, SameSite)
3. Authenticated requests:
ā Frontend includes: Authorization: Bearer <access_token>
ā Backend JWT filter extracts username from token
ā Loads user from MongoDB
ā Validates token signature and expiration
ā Sets ReactiveSecurityContext for request
4. Token refresh (when access token expires):
ā Frontend detects 401 response
ā Calls POST /api/auth/refresh with refresh token
ā Backend validates refresh token
ā Issues new access + refresh tokens
ā Frontend updates stored tokens
ā Retries original request
AI Chat Conversation Flow
1. User sends query (POST /api/chat)
ā Request includes:
- query: Natural language question
- conversationId: Session identifier
- maxIterations: ReAct loop limit (default: 5)
2. Backend initiates ReAct loop:
a) Backend prepares LLM context:
ā Loads user's accessible APIs from MongoDB
ā Filters by group membership and read-only permissions
ā Converts API metadata to tool definitions
ā Initializes conversation with system prompt, user query, and available tools
**Iteration 1: List Available APIs**
b) LLM reasoning:
ā š Thought: "I need to discover what APIs the user has access to"
ā š¬ Action: list_apis()
c) Backend executes tool:
ā ApiDiscoveryTools.listApis() queries MongoDB
ā Returns: [{"name": "Users API", "description": "..."}, {"name": "Products API", "description": "..."}]
d) Observation sent back to LLM
**Iteration 2: List Endpoints for Selected API**
e) LLM reasoning:
ā š Thought: "The query relates to users, so I'll explore the Users API endpoints"
ā š¬ Action: list_endpoints(apiName="Users API")
f) Backend executes tool:
ā ApiDiscoveryTools.listEndpoints() parses OpenAPI/Postman collection
ā Returns: [
{"method": "GET", "path": "/users", "summary": "List all users"},
{"method": "POST", "path": "/users", "summary": "Create user"},
{"method": "GET", "path": "/users/{id}", "summary": "Get user by ID"}
]
g) Observation sent back to LLM
**Iteration 3: Endpoint Inspection**
f) LLM analyzes APIs and decides next action:
ā Example: inspect_endpoint(apiName="Users API", method="GET", path="/users")
g) Backend executes tool:
ā ApiDiscoveryTools.inspectEndpoint() loads OpenAPI schema
ā Returns: Parameters, request body schema, response schema
h) Result sent back to LLM
**Iteration 4: API Execution**
i) LLM validates parameters and calls API:
ā Example: call_api(apiName="Users API", method="GET", path="/users", params={...})
j) Backend executes tool:
ā ApiInvocationTools.callApi() loads authentication config
ā Constructs HTTP request with:
- Base URL from configuration
- Authentication headers (Bearer token, API key, etc.)
- Query parameters
- Request body (if applicable)
ā Sends request via WebClient (reactive HTTP client)
ā Applies timeout (default: 30s) and retry logic (default: 3 attempts)
ā Returns API response
k) Result sent back to LLM
**Iteration 5: Data Processing (if needed)**
l) If user requested filtering/transformation:
ā LLM calls: process_data(data=<api_result>, operation="filter", filter={...})
ā DataTools.processData() applies JSON transformations
ā Returns processed data
**Iteration 6: Final Answer**
m) LLM formats final response for user
ā No more tool calls (loop terminates)
ā Backend detects completion
3. Backend saves conversation to MongoDB:
ā Document includes:
- User query
- Final answer
- Step-by-step reasoning (all thoughts, actions, observations)
- Execution time
- Status (SUCCESS, ERROR_PROCESSING)
- Timestamp
4. Frontend displays response with reasoning steps:
ā š Thought: "I need to list available APIs"
ā š¬ Action: list_apis()
ā šļø Observation: [Users API, Products API]
ā š Thought: "I'll inspect the Users API GET /users endpoint"
ā ...
š¤ AI Agent Architecture
ReAct Pattern Implementation
The AI agent follows the ReAct (Reason + Act) pattern for transparent, step-by-step problem solving:
Loop (max iterations: 5):
1. Reason: LLM analyzes current state and decides next action
2. Act: Backend executes tool (if requested)
3. Observe: LLM receives tool result
4. Repeat until final answer is generated or max iterations reached
Key Implementation Details:
- One tool per iteration: Prevents runaway loops
- Forced tool execution: If LLM hallucinates a tool call in text without emitting actual function call, backend nudges LLM to properly execute the tool
- State management: ReActContext tracks all thoughts, actions, observations
- Timeout protection: Entire chat request has configurable timeout (default: none, but can be set per request)
Available Tools
| Tool Name | Class | Purpose | Security |
|---|---|---|---|
list_apis | ApiDiscoveryTools | List all accessible APIs | Filtered by user's groups |
list_endpoints | ApiDiscoveryTools | List endpoints for an API | Only shows GET if read-only mode |
inspect_endpoint | ApiDiscoveryTools | Get endpoint parameter details | Required before call_api |
call_api | ApiInvocationTools | Execute API request | Respects authentication config |
process_data | DataTools | Filter/transform JSON | Operates on in-memory data |
create_chart | ChartTools | Generate chart config | Client-side rendering |
create_excel_file | ExportTools | Export data to .xlsx | Returns download URL |
Memory Management
Conversation History:
- Stored in MongoDB
conversationscollection - Retrieved on subsequent messages in same conversation
- Includes:
- User messages
- Assistant responses
- Tool calls and results
- Step-by-step reasoning
Context Window Management:
- Spring AI automatically manages token limits
- Older messages truncated if context exceeds model limits
- Important system prompts always included
š Security Architecture
Authentication & Authorization Flow
Request ā JWT Filter ā Token Validation ā User Loading ā RBAC Check ā Controller
JWT Authentication Filter (JwtAuthenticationWebFilter):
- Extracts
Authorization: Bearer <token>header - Validates token signature with secret key (HMAC-SHA256)
- Checks token expiration
- Loads user from MongoDB
- Sets
ReactiveSecurityContextfor downstream handlers
Role-Based Access Control (RBAC):
| Role | User Management | API Management | Group Management | Chat | Diagnostics |
|---|---|---|---|---|---|
| SUPERADMIN | ā Full control | ā Full control | ā Full control | ā All APIs | ā All tickets |
| IT | ā No access | ā Full control | ā Read-only | ā Group APIs | ā Group tickets |
| BUSINESS | ā No access | ā No access | ā No access | ā Group APIs | ā Report issues |
Group-Based API Visibility
Data Model:
users āā user_group_links āā groups āā api_group_links āā unified_api_specs
Access Control Logic:
- User belongs to groups (via
user_group_links) - APIs are assigned to groups (via
api_group_links) - User can only chat with APIs in their groups
- Public APIs: APIs with zero
api_group_linksare visible to all users - SUPERADMIN: Bypasses group restrictions (sees all APIs)
Query Example:
// Find accessible APIs for user "alice@company.com"
1. Find user's groups: [financeGroup, hrGroup]
2. Find APIs in those groups: [PayrollAPI, InvoiceAPI, EmployeeAPI]
3. Find public APIs (no api_group_links): [CalendarAPI]
4. Return union: [PayrollAPI, InvoiceAPI, EmployeeAPI, CalendarAPI]
Password Security
Hashing:
- Algorithm: BCrypt
- Strength: Default (cost factor 10)
- Salting: Automatic (per-password unique salt)
Password Policy:
- Minimum 8 characters
- At least one uppercase letter
- At least one lowercase letter
- At least one number
- At least one special character
Reset Flow:
- User requests reset (POST /api/auth/forgot-password)
- Backend generates secure token (32 bytes)
- Token expires in 1 hour
- User clicks link (GET /api/auth/validate-reset-token?token=...)
- User sets new password (POST /api/auth/reset-password)
- Token invalidated (single-use)
API Security (Upstream APIs)
When the AI agent calls external APIs, authentication is configured per API:
Supported Authentication Types:
- None: Public APIs
- API Key: Header or query parameter
- Bearer Token: OAuth2 access token
- Basic Authentication: Username/password (Base64-encoded)
- OAuth2 Client Credentials: Automatic token acquisition
Configuration Storage:
- Stored in
unified_api_specs.authConfigfield - Encrypted at rest (MongoDB encryption at rest must be enabled at database level)
- Never exposed in API responses
ā” Scalability & Performance
Horizontal Scaling
Backend:
- Stateless Design: No server-side sessions, all state in MongoDB or JWT
- Load Balancer: Distribute requests across multiple backend instances
- Health Checks:
/actuator/healthendpoint for liveness/readiness probes - Rolling Updates: Zero-downtime deployments
MongoDB:
- Replica Set: 3+ nodes for high availability
- Automatic Failover: Primary election on failure
- Read Preference:
primaryPreferredorsecondaryPreferred - Sharding: (Optional) For very large datasets
Performance Optimizations
Backend:
- Reactive Programming: Non-blocking I/O with Project Reactor
- Connection Pooling: MongoDB connection pool (default: 100 connections)
- Caching: (Not currently implemented, but Spring Cache can be added)
Database:
- Indexes:
users.username(unique)unified_api_specs.name(unique)conversations.userId+conversationId(compound)audit_logs.createdAt(TTL index for automatic deletion)
Frontend:
- Code Splitting: Lazy loading of routes
- Tree Shaking: Unused code elimination
- Minification: Vite production build
š Monitoring & Observability
Health Checks
Endpoint: GET /actuator/health
Response Example:
{
"status": "UP",
"groups": [
"liveness",
"readiness"
],
"components": {
"diskSpace": {
"status": "UP"
},
"livenessState": {
"status": "UP"
},
"mail": {
"status": "UP"
},
"mongo": {
"status": "UP"
},
"ping": {
"status": "UP"
},
"readinessState": {
"status": "UP"
},
"ssl": {
"status": "UP"
}
}
}
Metrics
Endpoint: GET /actuator/metrics (requires JWT authentication)
Available Metrics:
jvm.memory.used/jvm.memory.maxsystem.cpu.usagehttp.server.requests(request count, duration, errors)mongodb.driver.pool.size(connection pool utilization)
Integration:
- Prometheus (via Spring Boot Actuator)
- Grafana (visualizations)
- Datadog / New Relic (APM)
Logging
Log Levels:
- Production: ERROR level (minimal logging)
- Development: DEBUG level (verbose)
Log Rotation:
- Max file size: 10 MB
- Retention: 30 days
- Total size cap: 1 GB
Log Aggregation:
- ELK Stack (Elasticsearch, Logstash, Kibana)
- Filebeat for log shipping
Audit Logging
Purpose: Compliance and security auditing
Logged Events:
- User logins, logouts, token refreshes
- User CRUD operations
- Group membership changes
- API CRUD operations
- Group-API assignments
- Password changes and resets
Storage:
- MongoDB collection:
audit_logs - TTL index: Automatic deletion after 730 days (configurable)
Structure:
{
"_id": "...",
"timestamp": "2026-01-22T14:30:00Z",
"actorUsername": "admin@example.com",
"actorUserId": "696ce3767302dd415583cff1",
"action": "USER_CREATED",
"entityType": "USER",
"entityId": "new-user-id",
"entityName": "newuser@example.com",
"details": "User created with roles: BUSINESS",
"ipAddress": "192.168.1.100",
"userAgent": "Mozilla/5.0...",
"result": "SUCCESS"
}
š Deployment Architecture
Recommended Production Deployment
Internet
|
[Firewall]
|
[Load Balancer]
(HTTPS: 443)
|
āāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāā
| | |
[Backend 1] [Backend 2] [Backend 3]
(Port 8080) (Port 8080) (Port 8080)
| | |
āāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāā
|
[MongoDB Replica Set]
(Primary + 2 Secondaries)
|
[Backup Storage]
Components:
- Load Balancer: nginx, HAProxy, or cloud load balancer
- Backend Instances: Docker containers or JVM processes
- MongoDB: Self-hosted or MongoDB Atlas
- SMTP: Internal mail server or SendGrid/AWS SES
High Availability Setup
Backend:
- Minimum 2 instances
- Health check interval: 30 seconds
- Unhealthy threshold: 2 consecutive failures
- Auto-restart on failure
MongoDB:
- Replica Set with 3+ nodes
- Automatic primary election
- Read preference:
primaryPreferred
Load Balancer:
- Health check:
GET /actuator/health - Sticky sessions: Not required (stateless)
š Network Security
Private Network Deployment
Zero Inbound Access:
- Backend, frontend, MongoDB communicate within private subnet
- VPN or intranet access only
- No public internet exposure
Firewall Rules:
Allow: VPN/Intranet ā Load Balancer (80, 443)
Allow: Load Balancer ā Backend (8080)
Allow: Backend ā MongoDB (27017)
Allow: Backend ā OpenAI API (443) [or Azure OpenAI within VNET]
Allow: Backend ā SMTP (587)
Deny: All other traffic
Azure OpenAI Option (No Internet Egress)
For maximum security (Banking, Healthcare, Government):
- Deploy Azure OpenAI Service in your Azure VNET
- Use Azure Private Link for connectivity
- No public internet access required
- Data remains within your network boundaries
š Disaster Recovery
Backup Strategy
MongoDB:
- Automated daily backups (MongoDB Atlas or
mongodump) - Point-in-time recovery (Atlas)
- Retention: 30 days
Environment Variables:
- Backup
.envfile after each change - Store encrypted in secure location
Recovery Procedures
RTO (Recovery Time Objective): ~15-30 minutes RPO (Recovery Point Objective): 24 hours (daily backups)
Steps:
- Provision new infrastructure
- Restore MongoDB from backup
- Deploy application containers
- Restore
.envfile - Verify health check
ā Compliance Considerations
GDPR Compliance
- Data Sovereignty: All data in your infrastructure
- Right to Erasure: Delete user data via admin interface
- Data Portability: Export conversation history
- Audit Trail: Comprehensive logging
SOC 2 Readiness
- Access Controls: RBAC with group-based visibility
- Audit Logging: 2-year retention (configurable)
- Encryption: TLS in transit, MongoDB encryption at rest
- Monitoring: Health checks, metrics, log aggregation
š ļø Technology Stack Summary
| Component | Technology | Version |
|---|---|---|
| Backend | Spring Boot + WebFlux | 3.x |
| Language | Java | 21 |
| AI Framework | Spring AI | Latest |
| LLM Provider | OpenAI API or Azure OpenAI | GPT-4o / GPT-4o-mini |
| Database | MongoDB | 6.0+ |
| Authentication | JWT (JJWT library) | 0.12.x |
| Password Hashing | BCrypt (Spring Security) | - |
| Frontend | React + TypeScript | 18.x |
| Build Tool (FE) | Vite | 5.x |
| Styling | TailwindCSS | 3.x |
| HTTP Client | Axios | Latest |
| Runtime | Node.js (development only) | 20.x |
| Containerization | Docker + Docker Compose | Latest |
š§ Questions?
For architecture-related questions or deployment support:
- Email: support@alesqui.com
- Related Documentation:
- Configuration Guide - Detailed setup and environment configuration
- Enterprise Readiness - Security, compliance, and production deployment
- Trial Quickstart - Quick setup for evaluation
- Distribution Repository - Docker deployment guides
This architecture is designed for security-conscious organizations requiring full control over their data and infrastructure.