Thank you for your interest in contributing to Preclinical! This guide will help you get started.
- Node.js 20+
- Docker and Docker Compose
- An OpenAI API key (or compatible LLM provider)
# Clone the repo
git clone https://github.com/Mentat-Lab/preclinical.git
cd preclinical
# Copy environment variables and start everything
make setup
# Edit .env and add your OPENAI_API_KEY, then restart
make restartFor local development (hot-reload on file changes):
docker compose up db -d
cd server && npm install && npm run devcd tests && npm run test- Fork the repository and create a feature branch from
main - Make your changes with clear, focused commits
- Ensure TypeScript compiles without errors:
cd server && npx tsc --noEmit - Run existing tests to verify nothing is broken
- Open a PR with a clear description of what changed and why
- TypeScript with strict mode
- ESM imports with
.jsextensions for local files
We use postgres (Postgresjs) for database access — not the more common pg (node-postgres) or an ORM. It uses tagged template literals for queries:
import { sql } from '../lib/db.js';
// Values are auto-parameterized (safe from SQL injection)
const rows = await sql`SELECT * FROM agents WHERE id = ${agentId}`;
// JSONB columns — use sql.json()
await sql`INSERT INTO gradings (criteria_results) VALUES (${sql.json(myArray)})`;
// Dynamic SET clauses
await sql`UPDATE agents SET ${sql(updates, ...Object.keys(updates))} WHERE id = ${id}`;All database helpers live in server/src/lib/db.ts. See the Postgresjs docs for the full API.
Open an issue on GitHub with:
- Steps to reproduce
- Expected vs actual behavior
- Environment details (OS, Node version, Docker version)
By contributing, you agree that your contributions will be licensed under the Apache 2.0 license.