Getting Started
Project Structure
Overview of the Cortex project directory structure and key components.
Overview
Cortex follows a modular monorepo structure that separates concerns between the core analytics engine, API server, and Studio interface.
Directory Structure
cortex/
├── cortex/ # Python package
│ ├── api/ # FastAPI application
│ │ ├── routers/ # API route definitions
│ │ ├── schemas/ # Pydantic request/response models
│ │ └── main.py # FastAPI app entry point
│ │
│ ├── core/ # Core business logic
│ │ ├── connectors/ # Database Connectors
│ │ ├── consumers/ # User Management
│ │ ├── dashboards/ # Dashboard Management
│ │ ├── data/ # Data Models and Sources
│ │ ├── query/ # Query Engine
│ │ ├── semantics/ # Semantic Definitions
│ │ ├── stores/ # Data Persistence
│ │ ├── types/ # Type Definitions
│ │ └── workspaces/ # Environments and workspaces
│ │
│ └── migrations/ # Alembic database migrations
│ ├── alembic/ # Migration scripts
│ └── alembic.ini # Alembic configuration
│
├── frontend/cortex/ # Studio Interface
│ ├── app/ # Nuxt.js Application
│ │ ├── components/ # Vue Components
│ │ ├── composables/ # Reusable business logic
│ │ ├── pages/ # Route pages
│ │ └── types/ # TypeScript types
│ │
│ ├── package.json # Frontend dependencies
│ └── nuxt.config.ts # Nuxt configuration
│
├── pyproject.toml # Python dependencies
└── README.md # Project documentation
Key Components
Core Package
cortex/core
The heart of Cortex containing all business logic:
- Semantic Layer (
semantics/): Metric definitions and validation - Query Engine (
query/): SQL generation and execution - Connectors (
connectors/): Database connectivity - Workspaces (
workspaces/): Multi-tenant organization - Data Models (
data/): Business entity definitions
API Layer
cortex/api
FastAPI-based REST API that exposes core functionality:
- Routers (
routers/): Endpoint definitions organized by domain - Schemas (
schemas/): Pydantic models for request/response validation - Static Files (
static/): API documentation assets
Studio Interface
frontend/cortex
Vue.js/Nuxt.js application for administrative workflows:
- Components (
app/components/): Reusable Vue components - Pages (
app/pages/): Route-specific page components - Composables (
app/composables/): Reactive business logic - Types (
app/types/): TypeScript type definitions
Configuration Files
Python
pyproject.toml: Python dependencies and project metadatapoetry.lock: Locked dependency versions
Frontend
package.json: Node.js dependencies and scriptsnuxt.config.ts: Nuxt.js framework configurationtailwind.config.ts: Tailwind CSS styling configuration
Environment
.env: Environment variables for developmentlocal.env: Local development overrides
Development Structure
Core Development
Focus on the cortex/core/ directory for:
- Adding new database connectors
- Extending the semantic layer
- Improving query optimization
- Adding new data model features
API Development
Work with cortex/api/ for:
- Adding new API endpoints
- Updating request/response schemas
- Implementing authentication features
- Adding API middleware
Studio Development
Use frontend/cortex/ for:
- Creating new UI components
- Adding admin functionality
- Improving user experience
- Building custom visualizations
Next Steps
- Installation: Get started with Installation Guide
- Development: Set up local development with Development Setup
- Architecture: Learn more about Cortex Architecture
- Studio: Explore the Studio Interface