Local Development
Getting started
- Clone the project from GitHub.
- Get the
.envfile from Keeper and place it inside thesrc/folder. - From
src/, install dependencies:composer install npm install - Return to the project root (
cd ../) and bring up the containers:docker-compose -f docker-compose-mk-dev.yml up --buildUse
--buildto refresh the container image after dependency or Dockerfile changes.
Docker Compose environments
The repo ships several compose files for different scenarios. Each uses the
Dockerfile.dev image and mounts ./src into the container.
| File | Container name | Host port | Notes |
|---|---|---|---|
docker-compose.yml | pedalheads-public-api | 9000 | Default dev stack |
docker-compose-mk-dev.yml | pedalheads-public-api-mk-dev | 8000 | Martin’s dev server |
docker-compose-2025-schema.yml | pedalheads-public-api-2025-schema | 8000 | Points at the 2025 schema database |
docker-compose-prod.yml | pedalheads-public-api-prod | 9090 | Production-style image (Dockerfile) |
:::warning Always make sure the container name you target in commands matches the container you actually have running. :::
Common commands
Open a shell inside the running container:
docker exec -it pedalheads-public-api /bin/bash
# or, for the mk-dev stack:
docker exec -it pedalheads-public-api-mk-dev /bin/bash
Queue workers
When working on a queued job, restart the queue workers after code changes:
docker compose exec pedalheads-public-api php artisan queue:restart
Migrations
:::danger The API does not own the database schema Migrations are run from the Cadence / Velo Admin app to keep the shared schema clean. Run schema changes there before releasing the API so the API has every DB update it depends on. The commands below are for local/dev use only. :::
# Create a migration that adds a column
php artisan make:migration add_columnname_to_tablename_table --table=tablename
# Run / refresh / rollback migrations (dev)
docker compose exec pedalheads-public-api php artisan migrate
docker compose exec pedalheads-public-api php artisan migrate:refresh
docker compose exec pedalheads-public-api php artisan migrate:rollback
Clearing cache
php artisan cache:clear
Testing
# Create a test
php artisan make:test UserTest
# Run the suite
php artisan test
Debugging with Telescope (DEV ONLY)
Laravel Telescope can be enabled in development for request/query inspection.
TELESCOPE_ENABLED=true
ASSET_URL="${APP_URL}"
:::warning Only enable Telescope in development — never in production. :::
Testing CORS from the browser console
const userAction = async () => {
const response = await fetch(
'https://api.pedalheads.com/api/allocations/23221'
);
const myJson = await response.json();
console.log(myJson);
};
userAction();