Contributor Setup
Learn how to contribute using GitHub Desktop, VS Code extensions, and Git rebase.
Requirements
- Git (Essential)
- Node.js (Essential, use v20.19.0+ or ^22.12.0 or >= 23.0.0)
- 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
GitHub
-
Fork the LibreChat repository: https://github.com/danny-avila/LibreChat/fork
-
Create a branch on your fork, name it properly, and link it to the original repository.
-
Download your new branch to your local PC
Replace
branch-nameandusernamewith your details
Open in VS Code
- After cloning your branch:
Prepare LibreChat
-
Open the terminal in VS Code with
ctrl+shift+`` ```Alternatively, use
ctrl+jto open the bottom pane and select the terminal. -
Alternatively, use
npm cifor a fresh lockfile-based install. -
-
.env Configuration
- Create the
.envfile. If you don't have one, duplicate.env.exampleand configure it.
- Create the
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:devto avoid restarting both frontend and backend on port 3090. - SetDEBUG_CONSOLEto true in.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. Include clear messages explaining changes.
Example:
Push Changes
Push changes to the remote repository after completing a feature or fixing an issue.
Example:
Create a Pull Request (PR)
Pull Request merges changes from a feature branch into the main branch.
- Pull latest changes from main branch and resolve conflicts.
- Push updated feature branch.
- Ensure code follows project guidelines.
Example:
Access your repository in a browser and click "Contribute".
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:
-
-
-
Replace
pickwithdropfor commits to remove. Save and exit editor. -
How is this guide?