This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Morphik is an AI-native toolset for visually rich documents and multimodal data. It provides end-to-end RAG (Retrieval-Augmented Generation) capabilities for processing, storing, and querying unstructured documents with advanced multimodal search capabilities including ColPali.
- Core API: Located in
/core- FastAPI-based REST API - Database: PostgreSQL with pgvector for vector similarity search
- Models: SQLAlchemy models in
core/models/ - Services: Business logic in
core/services/ - Routes: API endpoints in
core/routes/ - Vector Store: Multiple providers (pgvector, TurboPuffer) in
core/vector_store/ - Embedding: Support for multiple providers (OpenAI, Ollama, Azure) in
core/embedding/ - Parser: Document processing and chunking in
core/parser/
- Location:
ee/ui-component/- Enterprise Edition UI component - Tech Stack: Next.js, TypeScript, ShadCN UI components, Tailwind CSS
- Purpose: Web interface for document upload, chat, and search
- Main Config:
morphik.toml- Central configuration file - Models: Registered AI models with provider-specific settings
- Components: Database, embedding, completion, parser, storage configurations
# Install dependencies
uv sync
# Run tests
pytest # All tests
pytest -m unit # Unit tests only
pytest -m integration # Integration tests only
pytest core/tests/ # Core tests
pytest -v -s # Verbose with output
# Code quality
ruff check # Linting
ruff check --fix # Auto-fix issues
black . # Code formatting
isort . # Import sorting
# Start development server
python start_server.py # Direct startup
./start-dev.sh # Docker development environmentcd ee/ui-component
# Install dependencies and run
npm install
npm run dev # Development server
# Build and quality
npm run build # Production build
npm run build:package # Package build
npm run lint # ESLint
npm run format # Prettier formatting
npm run format:check # Check formatting# Development environment with hot reload
./start-dev.sh
# Standard Docker setup
docker compose up --build
docker compose down
docker compose down -v # Reset all data- Central configuration in
morphik.toml - Model registration system supports multiple AI providers
- Environment-specific settings via
.envfiles - Docker vs local development configurations
- PostgreSQL with pgvector extension
- Multi-tenant ACL system for document permissions
- Async database operations using asyncpg/SQLAlchemy
- Connection pooling and retry mechanisms
- Abstracted model interface supporting OpenAI, Anthropic, Google, Ollama, Azure
- Vision-capable models for multimodal processing
- Embedding models for vector similarity search
- Completion models for chat and generation
- Unstructured document parsing with vision capabilities
- Chunking strategies with contextual awareness
- Metadata extraction and rules-based processing
- Storage abstraction (local, S3, etc.)
- RESTful endpoints in
core/routes/ - FastAPI with automatic OpenAPI documentation
- Async/await patterns throughout
- Comprehensive error handling and validation
- Unit Tests: Component-level testing in
core/tests/ - Integration Tests: Full API testing with database
- SDK Tests: Python SDK testing in
sdks/python/morphik/tests/ - Markers:
@pytest.mark.unit,@pytest.mark.integration, etc. - Async Support: pytest-asyncio for testing async code
- Python: Google Python Style Guide, Black formatting (120 char lines)
- TypeScript: Prettier + ESLint, ShadCN UI patterns
- Imports: isort with Black profile
- Linting: Ruff for Python, ESLint for TypeScript
core/api.py- Main FastAPI application and route registrationcore/config.py- Configuration loading and validationcore/services_init.py- Service initialization and dependency injectionmorphik.toml- Central configuration filestart_server.py- Application entry pointpyproject.toml- Python dependencies and tool configurationee/ui-component/package.json- Frontend dependencies and scripts
- The system supports both cloud and self-hosted deployments
- ColPali integration for advanced multimodal search
- Modular architecture allows swapping providers (embedding, storage, etc.)
- Enterprise Edition (ee/) features are available alongside open-source core
- Authentication supports both JWT and development mode
- Comprehensive telemetry and monitoring capabilities