How sanjay0208/aipos works
1. Purpose and Current Scope
AIPOS is intended as an AI-native personal operating system for memory, planning, knowledge, automation, and third-party integrations. The checked-in implementation is currently a small FastAPI backend foundation: health routing, application configuration/logging, and SQLAlchemy user persistence. The README’s broader React, AI, memory, planner, and integration architecture is aspirational rather than present in this tree.
2. Backend Entry Point and API Composition
The runnable backend entry point is backend/app/main.py, which should construct the FastAPI application and attach its API router. Routing is layered from the application-level router through versioned endpoints:
• backend/app/api/router.py
• backend/app/api/v1/__init__.py
• backend/app/api/v1/health.py
The health endpoint is the only visible public capability, establishing the initial API/versioning boundary for future domains.
3. Duplicate Application Package Boundary
Two near-identical package trees exist:
• app/api/router.py
• app/core/config.py
• backend/app/api/router.py
Only backend/app/ contains main.py, database code, and Python dependency manifests, so it appears to be the executable backend. The top-level app/ is likely an incomplete duplicate or an earlier scaffold. Engineers should avoid adding parallel features to both until ownership/import behavior is reconciled.
4. Core Runtime and Cross-Cutting Services
Configuration and logging are centralized in:
• backend/app/core/config.py
• backend/app/core/logging.py
• backend/app/main.py
These form the runtime boundary between environment-driven deployment settings and application code. .env.example indicates environment configuration is expected; backend/pyproject.toml and backend/requirements.txt define the Python/FastAPI runtime dependency boundary.
5. Persistence Layer
Database concerns are separated from HTTP handlers:
• backend/app/database/base.py
• backend/app/database/session.py
• backend/app/database/models/user.py
base.py provides SQLAlchemy model metadata/base infrastructure; session.py owns database engine/session lifecycle; user.py is the initial durable domain model. API/domain services should depend on sessions/models through this layer rather than create database connections inside route handlers.
6. Primary Control and Data Flow
Current request flow is: process starts in backend/app/main.py → FastAPI includes backend/app/api/router.py → versioned routing dispatches to backend/app/api/v1/health.py → response returns through FastAPI middleware/logging.
The expected persistence flow for future authenticated/domain APIs is: versioned handler → service/domain logic not yet present → SQLAlchemy session from backend/app/database/session.py → mapped models such as backend/app/database/models/user.py → PostgreSQL. No authentication, AI orchestration, Redis, Qdrant, MinIO, or external API adapters are implemented in the supplied tree.
7. Deployment and External Infrastructure
docker-compose.yml is the repository’s visible local orchestration boundary. The stated target stack includes PostgreSQL and Redis, with Qdrant/MinIO and providers such as Gmail, Calendar, GitHub, Maps, and Weather planned, but no corresponding service clients or integration modules are present. Docker Compose should therefore be treated as infrastructure scaffolding, not evidence that those product stages are implemented.
Main entry points: main.py FastAPI app · session.py Database sessions · router.py API router · logging.py Logging
Components 13
Backend Runtime
- FastAPI app · Executable backend composition point.
backend/app/main.py - Configuration
backend/app/core/config.py - Logging
backend/app/core/logging.py - Python dependencies
backend/pyproject.toml
HTTP API
- API router
backend/app/api/router.py - Versioned API
backend/app/api/v1/__init__.py - Health endpoint · Only implemented public capability.
backend/app/api/v1/health.py
Persistence
- SQLAlchemy base
backend/app/database/base.py - Database sessions
backend/app/database/session.py - User model
backend/app/database/models/user.py
Local Infrastructure
- PostgreSQL · Target durable store for domain APIs.
- Docker Compose · Infrastructure scaffolding, not implemented product stages.
docker-compose.yml
Other components
- Top-level app scaffold · Incomplete parallel package; avoid adding mirrored features.
app/api/router.py
Connections 13
- Python dependencies → FastAPI app: defines runtime
- Configuration → FastAPI app: configures
- Logging → FastAPI app: observes
- FastAPI app → API router: includes
- API router → Versioned API: dispatches
- Versioned API → Health endpoint: routes to
- Health endpoint → Logging: request logging
- Database sessions → SQLAlchemy base: uses metadata
- User model → SQLAlchemy base: maps through
- Database sessions → User model: persists
- Database sessions → PostgreSQL: connects to
- Docker Compose → PostgreSQL: orchestrates
- Top-level app scaffold → API router: parallel scaffold