Skip to main content

Development setup

This guide will help you set up Answer Overflow for local development.

Prerequisites

Before you begin, ensure you have the following installed:

Bun 1.3+

Fast JavaScript runtime and package manager

Node.js 18+

Required for some tooling compatibility

Discord account

For creating a test bot application

Git

Version control system
VSCode users: Open the answeroverflow.code-workspace file for recommended settings and extensions.

Installation

1

Clone the repository

git clone https://github.com/answeroverflow/answer-overflow.git
cd answer-overflow
2

Install dependencies

bun install
This will install all dependencies for the entire monorepo.
3

Set up environment variables

Copy the example environment file:
cp .env.example .env
Follow the instructions in .env.example to configure your environment variables.
4

Set up the database

Initialize and configure the Convex database:
cd packages/database
bun db:push
bun db:wipe
cd ../..
5

Start development

bun dev
This starts all apps in development mode using Turbo.

Discord bot setup

To develop the Discord bot, you’ll need to create a test bot application.

Create a Discord application

1

Go to Discord Developer Portal

Visit the Discord Developer Portal and create a new application.Name it something like “AO Dev Test”.
2

Create a bot user

In the portal, click Bot and add a bot.Enable the following privileged intents:
  • Server Members
  • Message Content
3

Copy your bot token

Click Reset Token and copy it to a safe place (like your .env file).
.env
DISCORD_TOKEN=your_bot_token_here
Never share your bot token publicly. Treat it like a password.
4

Configure OAuth2

In OAuth2 → General:
  1. Copy your Client ID and Client Secret
  2. Add redirect: http://localhost:3000/api/auth/callback/discord
  3. Change authorization method to “In-app Authorization”
  4. Check bot and applications.commands scopes
.env
DISCORD_CLIENT_ID=your_client_id
DISCORD_CLIENT_SECRET=your_client_secret
5

Set bot permissions

Enable these permissions:
  • Manage Server
  • Create Instant Invite
  • Read Messages/View Channels
  • Send Messages
  • Create Public Threads
  • Send Messages in Threads
  • Manage Threads
  • Embed Links
  • Read Message History
  • Add Reactions
  • Use Slash Commands
6

Generate invite link

Use this template (replace YOUR_ID):
https://discord.com/oauth2/authorize?client_id=YOUR_ID&permissions=328565083201&scope=bot+applications.commands
Or use the Discord Permissions Calculator.
7

Invite to test server

Create a test Discord server and invite your bot using the generated link.

Development workflow

Running individual apps

To run a specific app or package:
# Run only the Discord bot
cd apps/discord-bot
bun dev

# Run only the main site
cd apps/main-site
bun dev

# Run the database in dev mode
cd packages/database
bun dev

Available scripts

# Install dependencies
bun i

# Run all apps in development
bun dev

# Run with local databases
bun dev:with:dbs

# Build all apps
bun build

# Type checking
bun typecheck

# Run tests
bun test

# Lint and fix
bun lint:fix

# Format code
bun format

Testing

Run the test suite:
# Run all tests
bun run test

# Test a specific package
cd packages/database
bun test:watch

# Run E2E tests
cd apps/bot-e2e
bun test

Troubleshooting

Make sure you have Bun 1.3+ installed:
bun --version
If needed, upgrade Bun:
curl -fsSL https://bun.sh/install | bash
  1. Verify your DISCORD_TOKEN is correct
  2. Check that required intents are enabled
  3. Ensure the bot is invited to your test server
  4. Check the logs for error messages
  1. Run bun install to ensure dependencies are up to date
  2. Run bun typecheck to see all type errors
  3. For Convex types, run cd packages/database && bun codegen
  1. Ensure .env file exists in the root directory
  2. Check that the file has the correct format (no quotes around values)
  3. Restart the development server after changing .env

Next steps

Architecture

Learn about the system architecture

Contributing

Read the contribution guidelines

API Reference

Explore the API documentation

Discord Community

Get help from the community
If you encounter any issues, please reach out in our Discord community!