Thank you for your interest in contributing to LeanGraph! This document provides guidelines and instructions for contributing.
- Node.js 18+
- pnpm (install via
npm install -g pnpm)
- Fork the repository on GitHub
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/leangraph.git cd leangraph - Install dependencies:
pnpm install
- Run tests to verify everything works:
pnpm test
leangraph/
├── packages/
│ ├── leangraph/ # Unified npm package (re-exports client + server)
│ ├── server/ # Core server: parser, translator, executor, HTTP API
│ ├── client/ # TypeScript client library
│ └── cli/ # Command-line interface
├── docs/ # Documentation
└── deploy/ # Deployment scripts
| File | Purpose |
|---|---|
packages/server/src/parser.ts |
Cypher tokenizer & parser (produces AST) |
packages/server/src/translator.ts |
AST to SQL translation |
packages/server/src/executor.ts |
Query execution (handles multi-phase queries) |
packages/server/src/db.ts |
SQLite wrapper (nodes/edges tables) |
packages/server/src/routes.ts |
HTTP API endpoints |
packages/server/src/auth.ts |
API key authentication |
# Run all tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Run tests with coverage
pnpm test:coverage# Build all packages
pnpm build# Start development server
pnpm devThis project follows TDD. When adding new features:
- Write failing tests first in the appropriate test file
- Implement the feature to make tests pass
- Refactor if needed while keeping tests green
Test files mirror the source structure:
packages/server/src/parser.ts→packages/server/test/parser.test.tspackages/server/src/translator.ts→packages/server/test/translator.test.ts
- Start with parser tests in
packages/server/test/parser.test.ts - Implement parsing in
packages/server/src/parser.ts - Add translator tests in
packages/server/test/translator.test.ts - Implement SQL translation in
packages/server/src/translator.ts - Add integration tests in
packages/server/test/integration.test.ts
- TypeScript for all code
- Follow existing patterns in the codebase
- Keep code simple and readable over clever
- Use parameterized SQL queries everywhere (prevent injection)
-
Create a new branch for your feature:
git checkout -b feature/my-new-feature
-
Make your changes and commit with clear messages:
git commit -m "Add support for XYZ in Cypher parser" -
Ensure all tests pass:
pnpm test -
Push to your fork:
git push origin feature/my-new-feature
-
Open a Pull Request on GitHub
- Provide a clear description of what your PR does
- Reference any related issues
- Ensure tests pass
- Keep PRs focused - one feature or fix per PR
When reporting bugs, please include:
- Steps to reproduce
- Expected behavior
- Actual behavior
- Node.js version
- Operating system
Feel free to open an issue for questions or discussion.