Contributor Setup
Learn how to contribute using GitHub Desktop, VS Code extensions, and Git rebase.
Requirements
- Git (Essential)
- Node.js
v24.22.1(Essential) - npm
v11.13.0(Essential) - MongoDB (Essential, for the database)
- Git LFS (Useful for larger files)
- GitHub Desktop (Optional)
- VSCode (Recommended Source-code Editor)
Recommended VSCode Extensions
Install these extensions in VS Code:
Prepare the Environment
Node.js and npm
If you use nvm, install and select the recommended Node.js version before installing LibreChat:
nvm install 24.22.1
nvm use 24.22.1
npm install -g [email protected]The .nvmrc file in the LibreChat repository is the source of truth for the Node.js version; running nvm use from the repository root selects it.
Verify your shell is using the expected versions:
node -v
npm -vv24.22.1
11.13.0GitHub
-
Fork the LibreChat repository: https://github.com/LibreChat-AI/LibreChat/fork
-
Clone your fork and add the original repository as
upstream. Contributions branch from and targetdev;mainonly moves at release time.
git clone https://github.com/username/LibreChat.git
cd LibreChat
git remote add upstream https://github.com/LibreChat-AI/LibreChat.git
git fetch upstream dev
git checkout -B dev upstream/dev- Create a descriptive, slash-based branch off
dev:
git checkout -b new/feature/xReplace
usernameand the branch name with your details. Do not usenpm run updateto refresh a development branch; it is the self-host updater and checks outmain.
Open in VS Code
- After cloning your branch:
cd LibreChatcode .
Prepare LibreChat
-
Open the terminal in VS Code with
ctrl+shift+`` ```Alternatively, use
ctrl+jto open the bottom pane and select the terminal. -
npm run smart-reinstallIf you just changed Node.js or npm versions, use
npm run reinstallonce for a clean install. -
npm run build -
.env Configuration
- Create the
.envfile. If you don't have one, duplicate.env.exampleand configure it.
- Create the
-
Git hooks
npm installsets up husky pre-commit checks, which run the Static Checks CI job locally on the files in each commit (ESLint, Prettier, import order, circular dependencies). SetHUSKY=0to opt out, and run the checks by hand withnpm run static-checks.
Warning
The default values in .env.example are usually fine, except for MONGO_URI. Provide your own.
Make sure to install MongoDB and configure MONGO_URI correctly to connect to your MongoDB
instance. Use MongoDB Community Server or
MongoDB Atlas Cloud.
Development Workflow
For efficient work on LibreChat, use these commands:
-
Starting Backend:
- Use
npm run backendfor normal operation. - For active development, use
npm run backend:devto monitor changes. - Access at
http://localhost:3080/.
- Use
-
Running Frontend in Development Mode:
- Ensure backend is running.
- Use
npm run frontend:devto monitor frontend changes. - View at
http://localhost:3090/.
Pro Tips
- For real-time updates during frontend development, run
npm run frontend:devso frontend changes refresh on port3090. - Set
DEBUG_CONSOLE=truein.envfor verbose server output in the console.
Local Testing
Before submission, test your updates locally, see: Perform Tests Locally
By running tests, ensure your contributions are robust and ready for integration.
Commit, Push, Pull Request (PR)
Make a Commit
Commits mark logical checkpoints in development. Use conventional commit messages that begin with a type such as feat, fix, docs, or refactor, followed by a brief summary.
Example:
git add .
git commit -m "feat: Add login functionality"Push Changes
Push changes to the remote repository after completing a feature or fixing an issue.
Example:
git push origin feature-branch-nameCreate a Pull Request (PR)
Pull Request merges changes from a feature branch into the dev branch.
- Pull the latest changes from
devand resolve conflicts. - Push updated feature branch.
- Ensure code follows project guidelines.
Example:
git fetch upstream dev
git checkout feature-branch-name
git rebase upstream/dev
# Resolve conflicts if any
git push origin feature-branch-name
# Open PR on GitHubAccess your fork in a browser and click "Contribute", and make sure the pull request targets dev.
Note:
Provide a detailed PR description explaining changes and their value. Reference related issues.
Tip
Use GitHub Desktop to track changes.
Warning
If git commit fails due to ESLint errors, understand and fix the issue.
Revert Commits Safely
To undo changes in a feature branch, follow these steps cautiously:
-
git pull origin feature-branch-name -
git log -
git rebase -i HEAD~NReplace
pickwithdropfor commits to remove. Save and exit editor. -
git push --force-with-lease origin feature-branch-name
How is this guide?
Overview
How to set up a productive LibreChat development workflow.
Tools and Plugins
This doc shows you how to create custom plugins for LibreChat by extending the LangChain `Tool` class. You will learn how to use different APIs and functions with your plugins, and how to integrate them with the LangChain framework.