This guide will walk you through setting up Open SWE for local development. You'll need to clone the repository, install dependencies, configure environment variables, create a GitHub App, and start the development servers.
<Note>
This setup is for development purposes. For production deployment, you'll need to adjust URLs and create separate GitHub Apps for production use.
</Note>
## Prerequisites
Before starting, ensure you have the following installed:
- Node.js (version 18 or higher)
- Yarn (version 3.5.1 or higher)
- Git
## Setup Steps
<Steps>
<Step title="Clone the Repository">
Clone the Open SWE repository to your local machine:
You'll need to create a **GitHub App** (not a GitHub OAuth App). These are different types of applications with different capabilities. Consider creating separate GitHub apps for development and production environments.
</Note>
### Create the GitHub App
1. Go to [GitHub App creation page](https://github.com/settings/apps/new)
2. Fill in the basic information:
- **GitHub App name**: Your preferred name
- **Description**: Development instance of Open SWE coding agent
- ✅ **Request user authorization (OAuth) during installation** - Allows users to log in to the web app
- ✅ **Redirect on update** - Redirects users back to your app after permission updates
- ❌ **Expire user authorization tokens** - Keep tokens from expiring
### Set Up Webhook
1. ✅ **Enable webhook**
2. **Webhook URL**: You'll need to use a tool like ngrok to expose your local server:
```bash
# Install ngrok if you haven't already
# Then expose your local LangGraph server
ngrok http 2024
```
Use the ngrok URL + `/webhook/github` (e.g., `https://abc123.ngrok.io/webhook/github`)
3. **Webhook secret**: Generate and save this value:
```bash
openssl rand -hex 32
```
Add this value to `GITHUB_WEBHOOK_SECRET` in `apps/open-swe/.env`
### Configure Permissions
**Repository permissions:**
- **Contents**: Read & Write
- **Issues**: Read & Write
- **Pull requests**: Read & Write
- **Metadata**: Read only (automatically enabled)
**Organization permissions:** None
**Account permissions:** None
### Subscribe to Events
- ✅ **Issues** - Required for webhook functionality
### Installation Settings
- **Where can this GitHub App be installed?**:
- Choose "Any account" for broader testing
- Or "Only on this account" to limit to your repositories
### Complete App Creation
Click **Create GitHub App** to finish the setup.
### Collect App Credentials
After creating the app, collect the following values and add them to both environment files:
- **GITHUB_APP_NAME**: The name you chose
- **GITHUB_APP_ID**: Found in the "About" section (e.g., `12345678`)
- **GITHUB_APP_CLIENT_ID**: Found in the "About" section
- **GITHUB_APP_CLIENT_SECRET**:
1. Scroll to "Client secrets" section
2. Click "Generate new client secret"
3. Copy the generated value
- **GITHUB_APP_PRIVATE_KEY**:
1. Scroll to "Private keys" section
2. Click "Generate a private key"
3. Download the `.pem` file and copy its contents
4. Format as a single line with `\\n` for line breaks, or use the multiline format shown in the example
<Tip>
Keep your GitHub App credentials secure and never commit them to version control. The `.env` files are already included in `.gitignore`.
</Tip>
</Step>
<Step title="Start Development Servers">
With all environment variables configured, start both development servers:
**Terminal 1 - Start the LangGraph Agent:**
```bash
# apps/open-swe
yarn dev
```
This starts the LangGraph server at `http://localhost:2024`
**Terminal 2 - Start the Web Application:**
```bash
# apps/web
yarn dev
```
This starts the Next.js web app at `http://localhost:3000`
<Note>
Both servers need to be running simultaneously for full functionality. The web app communicates with the LangGraph agent through API calls.
</Note>
</Step>
</Steps>
## Verification
Once both servers are running:
1. **Visit the web app**: Navigate to `http://localhost:3000`
2. **Test GitHub authentication**: Try logging in with your GitHub account
<Tip>
If you encounter issues, check the console logs in both terminal windows for error messages. Common issues include missing environment variables or incorrect GitHub App configuration.
</Tip>
## Next Steps
- Learn about [Authentication](/setup/authentication) to understand how the GitHub App integration works
- Explore [Usage](/usage/intro) to start using Open SWE for code changes
- Review the [Monorepo Structure](/setup/monorepo) for development best practices