MatCraft uses PostgreSQL as its primary data store. Here are the requirements, configuration recommendations, and scaling considerations.
| Requirement | Minimum | Recommended | |——————-|————-|——————-| | PostgreSQL version | 14 | 16 | | Storage | 1 GB | 10 GB+ | | RAM | 256 MB (shared) | 1 GB+ dedicated | | Connections | 20 | 100+ |
For local development, the simplest setup is Docker:
docker run -d \
--name matcraft-db \
-e POSTGRES_DB=matcraft \
-e POSTGRES_USER=matcraft \
-e POSTGRES_PASSWORD=matcraft \
-p 5432:5432 \
-v matcraft-pgdata:/var/lib/postgresql/data \
postgres:16-alpineAlternatively, the core library can use SQLite for single-user, local-only usage (no web dashboard):
# SQLite mode (core library only, no server)
export MATCRAFT_DATABASE_URL="sqlite:///./matcraft.db"
materia campaign run --config my_material.yamlConfigure the database URL in your .env file:
DATABASE_URL=postgresql://user:password@host:5432/matcraftFor connection pooling in production, use PgBouncer or your cloud provider's built-in connection pooler:
DATABASE_URL=postgresql://user:password@pgbouncer:6432/matcraft?pgbouncer=trueMatCraft uses Alembic for database migrations:
# Apply all pending migrations
materia db upgrade
# Check current migration version
materia db current
# Generate a new migration after model changes (development)
materia db revision --autogenerate -m "add campaign tags"| Table | Purpose | Growth Rate | |———-|————-|——————-| | materials | Material definitions | Slow (10s-100s) | | campaigns | Campaign metadata | Slow (10s-100s) | | iterations | Per-iteration state | Moderate (100s-1000s) | | candidates | Proposed compositions | Fast (1000s-10000s) | | measurements | Evaluation results | Fast (1000s-10000s) | | surrogate_checkpoints | Serialized model weights | Moderate (MBs per checkpoint) |
candidates table for active campaigns.candidates table sees frequent inserts and benefits from regular vacuuming.Tested and recommended managed PostgreSQL services:
db.t3.medium for small teams, db.r6g.large for production.