Configure a Project
End-to-end guide for setting up a CodeSpar project — from deploying the backend to linking a repository, enabling channels, and verifying everything works.
Configure a Project
This guide walks you through the complete setup of a CodeSpar project, from deploying the backend to running your first command.
Estimated time: 15-20 minutes
Prerequisites
- A GitHub account with at least one repository
- A GitHub Personal Access Token with
repoandadmin:repo_hookscopes - An Anthropic API key
- At least one messaging platform account (Slack, Discord, WhatsApp, or Telegram)
Step 1: Deploy the Backend
You can run the CodeSpar backend locally with Docker or deploy it to Railway. Choose one:
Option A: Docker (Local Development)
The backend will be available at http://localhost:3000.
Option B: Railway (Production)
- Fork the codespar/codespar repository
- Go to railway.app and create a new project
- Select "Deploy from GitHub repo" and choose your fork
- Configure environment variables (see Step 2)
- Deploy
Railway will assign a public URL (e.g., https://codespar-production.up.railway.app). Note this URL — you will need it for webhook configuration.
For detailed deployment instructions, see the Docker guide or Railway guide.
Step 2: Set Environment Variables
Configure the required environment variables for your deployment:
Required Variables
| Variable | Description | Example |
|---|---|---|
ANTHROPIC_API_KEY | Your Anthropic API key | sk-ant-... |
GITHUB_TOKEN | GitHub PAT with repo scope | ghp_... |
Channel Variables
Enable at least one channel:
| Variable | Description |
|---|---|
ENABLE_SLACK | Set to true to enable Slack |
SLACK_BOT_TOKEN | Slack Bot User OAuth Token (xoxb-...) |
SLACK_SIGNING_SECRET | Slack app signing secret |
ENABLE_DISCORD | Set to true to enable Discord |
DISCORD_BOT_TOKEN | Discord bot token |
ENABLE_TELEGRAM | Set to true to enable Telegram |
TELEGRAM_BOT_TOKEN | Telegram bot token from BotFather |
ENABLE_WHATSAPP | Set to true to enable WhatsApp |
Webhook Variables
| Variable | Description | Example |
|---|---|---|
WEBHOOK_BASE_URL | Public URL of your CodeSpar instance | https://codespar.up.railway.app |
The WEBHOOK_BASE_URL is used for auto-configuring GitHub webhooks when linking repositories. Without it, you will need to configure webhooks manually.
Example .env File
Step 3: Enable Channels
For each channel you want to use, follow the corresponding setup guide:
| Channel | Guide | Setup Time |
|---|---|---|
| Slack | Slack Setup | 5 min |
| Discord | Discord Setup | 5 min |
| Telegram | Telegram Setup | 3 min |
| WhatsApp Setup | 3 min |
You can also configure channels from the Dashboard Setup page if the dashboard is deployed.
Step 4: Start the Server
Docker
Local Development
Verify the Server
Check that the server is running:
Expected response:
Step 5: Link a Repository
From your connected channel (e.g., Slack), send:
Replace owner/repo with your actual repository (e.g., acme/backend-api).
Expected Response
If the webhook could not be auto-configured, see manual webhook setup.
Step 6: Verify the Webhook
Confirm that the GitHub webhook is active:
Expected Response
You can also verify in GitHub by going to your repository's Settings > Webhooks and checking for a webhook pointing to {WEBHOOK_BASE_URL}/webhooks/github.
Step 7: Set Autonomy Level
By default, agents start at L1 (Notify) — they monitor and alert but never auto-execute. You can increase the autonomy level:
Autonomy Levels
| Level | Name | What Changes |
|---|---|---|
| L0 | Passive | Only responds when addressed |
| L1 | Notify | Monitors and alerts (default) |
| L2 | Suggest | Proposes actions, waits for approval |
| L3 | Auto-Low | Auto-executes low-risk actions |
| L4 | Auto-Med | Auto-executes medium-risk actions |
| L5 | Full Auto | Fully autonomous within policy bounds |
For a new project, L2 (Suggest) is a good starting point — the agent will proactively suggest actions but always wait for your approval before executing.
Step 8: Test with a Command
Run a simple command to verify everything is working end-to-end:
Expected Behavior
- The Dev Agent searches your repository
- Reads relevant files for context
- Sends the task to Claude
- Creates a branch
codespar/<taskId> - Commits the changes
- Opens a pull request
You should receive a response like:
Step 9: Monitor via Dashboard
If you have the CodeSpar dashboard deployed (see Production Deploy), you can monitor your agents at codespar.dev/dashboard:
- Log in with your Clerk credentials
- Select your organization
- See your agents on the Overview page
- Click an agent card for detailed stats
- View the Audit Trail for event history
Troubleshooting
"Agent not responding"
- Verify the server is running:
curl http://localhost:3000/api/health - Check that the channel is enabled in environment variables
- Verify the bot is invited to the correct channel/group
- Check server logs for connection errors
"Repository not found"
- Verify
GITHUB_TOKENhasreposcope - Confirm the repository name format is correct:
owner/repo - For private repos, ensure the token owner has access
"Webhook not delivering"
- Check
WEBHOOK_BASE_URLis set and publicly accessible - Verify the webhook in GitHub: Settings > Webhooks > Recent Deliveries
- Ensure no firewall is blocking incoming requests on your deployment
"Claude API errors"
- Verify
ANTHROPIC_API_KEYis valid - Check your Anthropic account has sufficient credits
- If using a custom model via
TASK_MODEL, ensure the model name is correct
Next Steps
- Dev Agent PR Guide — create pull requests with the Dev Agent
- Approval System — configure approval workflows
- Webhook Monitoring — monitor builds and PRs
- Dashboard Overview — monitor agents via the web dashboard