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
Set up environment variables
Copy the example environment file:Follow the instructions in
.env.example to configure your environment variables.Discord bot setup
To develop the Discord bot, you’ll need to create a test bot application.Create a Discord application
Go to Discord Developer Portal
Visit the Discord Developer Portal and create a new application.Name it something like “AO Dev Test”.
Create a bot user
In the portal, click Bot and add a bot.Enable the following privileged intents:
Server MembersMessage Content
Configure OAuth2
In OAuth2 → General:
- Copy your Client ID and Client Secret
- Add redirect:
http://localhost:3000/api/auth/callback/discord - Change authorization method to “In-app Authorization”
- Check
botandapplications.commandsscopes
.env
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
Generate invite link
Development workflow
Running individual apps
To run a specific app or package:Available scripts
Testing
Run the test suite:Troubleshooting
Bun installation fails
Bun installation fails
Make sure you have Bun 1.3+ installed:If needed, upgrade Bun:
Discord bot doesn't connect
Discord bot doesn't connect
- Verify your
DISCORD_TOKENis correct - Check that required intents are enabled
- Ensure the bot is invited to your test server
- Check the logs for error messages
Type errors in the editor
Type errors in the editor
- Run
bun installto ensure dependencies are up to date - Run
bun typecheckto see all type errors - For Convex types, run
cd packages/database && bun codegen
Environment variables not loading
Environment variables not loading
- Ensure
.envfile exists in the root directory - Check that the file has the correct format (no quotes around values)
- 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!