Skip to content

Quick Start

Get the API and bot running locally in minutes.

Prerequisites

This guide assumes you've completed the Installation steps.

Start Local Infrastructure

Start PostgreSQL, RabbitMQ, and MinIO:

docker compose -f docker-compose.local.yml up -d

Verify all services are healthy:

docker compose -f docker-compose.local.yml ps

All services should show "Up (healthy)" status.

Running the API

Start the Litestar API server:

just run-api

This command: - Automatically loads .env.local - Runs litestar run with hot reload enabled - Serves on http://localhost:8000

Verify API is Running

Open your browser to:

You should see the interactive OpenAPI documentation.

Running the Bot

Start the Discord bot:

just run-bot

This command: - Automatically loads .env.local - Runs the bot with your configured Discord token - Connects to the local API at localhost:8000

Verify Bot is Running

Check the terminal output for:

Logged in as YourBotName#1234
Bot is ready.

In your Discord server, the bot should appear online.

Testing the Integration

1. Trigger a Bot Command

In Discord, send a command to test the bot:

/map search parkour

2. Check API Logs

In the API terminal, you should see incoming requests from the bot.

3. Check RabbitMQ Management UI

Visit http://localhost:15672: - Username: genji - Password: local_dev_password

You can see queues, messages, and connections.

Development Workflow

Make Code Changes

The API runs with --reload, so changes are automatically picked up. For the bot, you'll need to restart the process (Ctrl+C and run just run-bot again).

Run Tests

Test the API:

just test-api

This runs pytest with 8 parallel workers.

Lint Code

Before committing, run linters:

just lint-all

This formats code with Ruff and type-checks with BasedPyright.

Common Tasks

View Logs

API logs: Displayed in the terminal where just run-api is running

Bot logs: Displayed in the terminal where just run-bot is running

Database logs:

docker compose -f docker-compose.local.yml logs -f postgres-local

RabbitMQ logs:

docker compose -f docker-compose.local.yml logs -f rabbitmq-local

MinIO logs:

docker compose -f docker-compose.local.yml logs -f minio-local

Stop Services

Stop infrastructure services:

docker compose -f docker-compose.local.yml down

Stop API/bot: Press Ctrl+C in their respective terminals.

Re-sync Dependencies

After pulling changes or switching branches:

just sync

Next Steps

Troubleshooting

Port Already in Use

If port 8000 is already in use, find and kill the process:

lsof -ti:8000 | xargs kill -9

Bot Won't Connect

  1. Verify DISCORD_TOKEN is set in .env.local
  2. Check that the bot has proper permissions in your Discord server
  3. Ensure intents are enabled in the Discord Developer Portal

Database Connection Failed

  1. Verify Docker services are running:

    docker compose -f docker-compose.local.yml ps
    

  2. Check PostgreSQL logs:

    docker compose -f docker-compose.local.yml logs postgres-local
    

  3. Verify database credentials in .env.local:

    POSTGRES_HOST=localhost
    POSTGRES_USER=genji
    POSTGRES_PASSWORD=local_dev_password
    POSTGRES_DB=genjishimada
    

RabbitMQ Connection Failed

  1. Verify RabbitMQ is healthy:

    docker compose -f docker-compose.local.yml ps rabbitmq-local
    

  2. Check RabbitMQ logs:

    docker compose -f docker-compose.local.yml logs rabbitmq-local
    

  3. Visit management UI: http://localhost:15672

MinIO Connection Failed

  1. Verify MinIO is healthy:

    docker compose -f docker-compose.local.yml ps minio-local
    

  2. Ensure bucket exists (see Installation Guide)