Before contributing, please review the Troubleshooting & FAQ guide for details on common operational issues and setup challenges, and our Code of Conduct for community standards and expectations.
Please report security vulnerabilities responsibly by following our Security Policy. Do not open public issues for security-related concerns.
cp .env.example .env
docker compose up -d # Postgres
cargo run -p lumenqraph-indexer
cargo run -p lumenqraph-apicargo fmt --all
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace
cargo audit
cargo deny checkThe cargo audit and cargo deny check commands verify dependency security and license compliance. These must pass in CI; running them locally catches issues before pushing.
The codebase uses sqlx's offline mode for compile-time verification of SQL queries. After modifying any SQL queries in the code:
cargo sqlx prepare --database-url "$DATABASE_URL"This generates .sqlx/ metadata that must be committed alongside your code changes. CI will verify that the metadata is up-to-date; stale metadata will fail the build.
If you see "query not prepared" errors during build, run the command above with your database running (same as docker compose up -d in dev setup).
cargo test --workspace skips anything marked #[ignore], which is every test
that needs a real database (retention pruning, contract-spec versioning, webhook
enqueue). To run those locally with a single command:
make test-dbThis target automatically:
- Ensures the Postgres container is running (
make db) - Sets
TEST_DATABASE_URLto the local database - Runs all ignored tests with
--test-threads=1for proper isolation
Each test resets the schema to isolate itself. --test-threads=1 is required, not a preference: each test runs DROP SCHEMA public CASCADE to start clean, so two running at once will drop the tables out from under each other.
If you need to run tests against a custom database, you can still use the manual approach:
export TEST_DATABASE_URL=postgres://user:password@host:port/dbname
cargo test -p lumenqraph-indexer -- --ignored --test-threads=1
cargo test -p lumenqraph-webhooks -- --ignored --test-threads=1
cargo test -p lumenqraph-api -- --ignored --test-threads=1
cargo test -p lumenqraph-mcp -- --ignored --test-threads=1CI runs all of the above against a Postgres service.
- Shared types and decoding live in
lumenqraph-core; don't duplicate models. - DB writes must stay idempotent (key on
event_id). - New schema changes go in a new numbered
migrations/NNNN_*.sql— never edit an applied migration. - Keep raw base64 alongside any decoded representation; decoding is best-effort and must never break ingestion.
When contributing code, especially around authentication, cryptography, or sensitive data:
- Use constant-time comparison for secrets and signatures (see SECURITY.md)
- Never hardcode secrets or API keys
- Validate all user inputs and external data
- Avoid leaking sensitive information in error messages
- Keep dependencies up to date and audit transitive dependencies