Skip to main content
The DataDot server is designed as a modern, asynchronous application. It leverages key technologies to ensure high performance for real-time AI interactions.

Tech Stack

FastAPI

A modern, fast (high-performance) web framework for building APIs with Python 3.10+.

SQLAlchemy

The Python SQL toolkit and Object Relational Mapper, used for all relational database interactions.

PydanticSettings

Roboust configuration management using environment variables.

LanceDB / Chroma

Pluggable support for various vector databases to power the RAG pipeline.

APScheduler

Advanced Python Scheduler for handling background jobs and periodic tasks.

Passlib & JWT

Secure password hashing and token-based authentication (JSON Web Tokens).

System Diagrams

High-Level Architecture

The below diagram illustrates the primary components and how data flows between the client, the API server, and the various backing services.

System Architecture

Chat & RAG Flow

When a user sends a message, the system orchestrates a complex flow to provide a context-aware response.
  1. Receive: The chat endpoint receives the user message.
  2. Retrieve: The embedding_service searches the Vector DB for relevant documents.
  3. Construct: The chat_service builds a prompt containing the user message, conversation history, and retrieved context.
  4. Generate: The prompt is sent to the configured LLM provider (e.g., OpenAI).
  5. Stream: The response is streamed back to the client in real-time.

Database Layer

The application uses SQLAlchemy (AsyncIO) for database persistence.
  • Session Management: Handled via app.core.database.get_db dependency.
  • Initialization: init_db() in app.core.database ensures tables are created on startup.
  • Migrations: Currently, the system uses Base.metadata.create_all() for schema creation.

Key Models (app/models/)

  • User: Stores user credentials and profile info.
  • Workspace: Groups resources (chats, docs) for isolation.
  • WorkspaceDocument: Metadata for uploaded files.
  • ChatSession: Represents a conversation thread.
  • ChatMessage: Individual messages within a session.

Background Jobs

If ENABLE_BACKGROUND_JOBS is set to True, the server initializes an APScheduler instance.
  • Location: app/tasks/scheduler.py
  • Lifecycle: Started/Shutdown via app.main.lifespan.
  • Use Cases: Periodic vector store cleanup, email notifications, system maintenance.