Getting Started
Prerequisites
Before you begin, make sure you have:- Node.js LTS (Long-term Support) installed
- pnpm package manager
- Git for version control
- Basic understanding of TypeScript and Node.js
Install pnpm
If you don’t have pnpm installed:Fork and Clone
- Fork the repository on GitHub
- Clone your fork:
- Add upstream remote:
Project Structure
LlamaIndex.TS uses a pnpm monorepo structure:Key Directories
packages/llamaindex: The main package that aggregates core functionalitypackages/core: Abstract base classes and interfaces for runtime-agnostic codepackages/env: Runtime compatibility layers for different JS environmentspackages/providers/*: Separate packages for LLMs, embeddings, vector stores, etc.
Development Setup
1. Install Dependencies
2. Build Packages
3. Start Development Mode
Making Changes
1. Create a Branch
2. Make Your Changes
Edit the relevant files in the appropriate package. Quick testing: Create a test script to verify your changes:3. Add Tests
All new features and bug fixes should include tests. Unit tests are located in each package’stests/ folder:
4. Run Linting
5. Type Check
Adding a New Package
When to Create a New Package
- Adding a new LLM provider (e.g.,
@llamaindex/mistral) - Adding a new vector store (e.g.,
@llamaindex/storage/milvus) - Adding a new reader or tool
Steps
- Create the package in
packages/providers/:
- Use existing
package.jsonas a template:
- Reference in root
tsconfig.json:
- Add to examples if applicable:
Submitting a Pull Request
Before Submitting
- All tests pass:
- Create a changeset for version bumping:
- Select which packages changed
- Choose bump type (major, minor, patch)
- Write a description of the changes
Submit Your PR
- Push your branch:
-
Open a Pull Request on GitHub with:
- Clear title describing the change
- Description of what changed and why
- Reference any related issues
- Screenshots/examples if applicable
-
Address review feedback:
- Make requested changes
- Push additional commits
- Re-request review when ready
PR Checklist
- Tests added/updated and passing
- Documentation updated (if needed)
- Examples added/updated (for new features)
- Changeset created
- Code follows existing style
- No breaking changes (or clearly documented)
Documentation
If your changes affect user-facing APIs:- Update the docs in
apps/next/folder - Add examples in the
examples/folder - Update README if adding a new package
Code Style
Formatting
We use Prettier for formatting. It runs automatically on commit via Husky. Manual formatting:Linting
We use ESLint. Configuration is ineslint.config.js.
TypeScript
- Use strict mode
- Prefer interfaces over types for public APIs
- Add JSDoc comments for public APIs
- Use async/await instead of promises
Testing
Unit Tests
Use Vitest for unit tests:E2E Tests
End-to-end tests are in thee2e/ folder and test runtime compatibility:
Running Tests
Common Tasks
Check for Circular Dependencies
Clean Build Artifacts
Update Dependencies
Release Process (Maintainers)
We use Changesets for versioning and releases:- PRs are merged with changesets
- Release PR is auto-generated
- Merging release PR publishes to npm
Getting Help
If you need help contributing:- Discord: Join our Discord
- GitHub Discussions: Ask a question
- Issues: Open an issue
Code of Conduct
Please be respectful and inclusive. We’re building a welcoming community for everyone.Thank You!
Your contributions make LlamaIndex.TS better for everyone. We appreciate your time and effort!Community
Join our community to connect with other contributors