Skip to content

Development

This guide covers native development and testing. Production operators should use Getting Started instead.

  • PHP 8.5.12 or newer and Composer 2
  • Node.js 22.23.4 or newer and npm (.node-version and mise.toml pin PHP 8.5.12 and Node.js 26.13.0 to match CI and production Docker builds)
  • rsvg-convert from librsvg2-bin for SVG brand uploads
  • SQLite for the default local setup, or PostgreSQL via compose.yaml for integration work
  • Redis and Gotenberg when working on Horizon queues, sessions, cache, or PDF features

The PHP and Node.js floors are security requirements, not preferences. PHP 8.5.12 fixes CVE-2026-109618 and CVE-2026-109619, and Node.js 22.23.4 fixes CVE-2026-111497. The application logs a warning when it detects an unpatched interpreter and refuses to boot in a production environment.

If you use mise, running mise install in the repository root installs the pinned PHP and Node.js versions automatically.

composer setup and composer dev are cross-platform and run identically on Windows, macOS, and Linux without external databases or Redis:

Terminal window
git clone https://github.com/yukazakiri/koakademy.git
cd koakademy
composer setup
composer dev

composer setup is idempotent: it runs composer install, copies .env.example to .env, generates APP_KEY if unset, creates database/database.sqlite, runs php artisan migrate --force, links public/storage, generates Passport keys for MCP OAuth, runs wayfinder:generate, installs Node dependencies with npm ci, and compiles initial assets with npm run build.

composer dev launches the HTTP server (http://127.0.0.1:8000), queue listener, cross-platform log watcher (scripts/dev-logs.php), and Vite HMR server together. Open http://127.0.0.1:8000/setup to create development data and the first administrator.

Containerized setup (Docker Compose & Dev Containers)

Section titled “Containerized setup (Docker Compose & Dev Containers)”

If your local machine does not have PHP 8.5.12 installed, use the self-contained development container defined in docker/dev/Dockerfile and compose.yaml (it builds directly on a fresh clone before vendor/ exists):

Terminal window
git clone https://github.com/yukazakiri/koakademy.git
cd koakademy
docker compose up -d --build
docker compose exec laravel.test composer setup
docker compose exec laravel.test php artisan test --compact

To also start Redis-backed Horizon and Pulse background workers in Docker, enable the workers profile:

Terminal window
docker compose --profile workers up -d

Contributors using VS Code Dev Containers or GitHub Codespaces can open the repository directly using the bundled .devcontainer/devcontainer.json, which boots compose.yaml and runs composer setup automatically.

The development compose.yaml is not the production topology and publishes local ports (8000, 5173, 5432, 6379, 8025, 7700, 9888) via configurable environment variables.

Terminal window
composer test
vendor/bin/pint --test
npm run build
npm run format:check
npm run docs:check
npm --prefix docs ci
npm --prefix docs run build

Run a focused Pest file while iterating:

Terminal window
php artisan test --compact tests/Feature/SetupAvailabilityTest.php
php artisan test --compact --filter="shows the setup screen"

CONTRIBUTING.md remains the only root-level canonical Markdown source and syncs to docs/src/content/docs/start-here/contributing.mdx. The other foundational guides (installation, deployment, configuration, troubleshooting, development, architecture, FAQ) are now native MDX pages under docs/src/content/docs/ and are edited directly. Run:

Terminal window
npm run docs:sync
npm run docs:check

The sync command updates the contributing mirror. Never edit generated mirrors directly; native MDX pages are edited in place.

The Astro site in docs/ is buildable locally with npm --prefix docs run build. Its deploy-docs.yml workflow builds on pushes to master that change documentation and can also be dispatched manually.

After making the repository public, enable GitHub Pages in Settings → Pages → Build and deployment → Source: GitHub Actions. If the workflow is disabled in repository settings, enable it with:

Terminal window
gh workflow enable deploy-docs.yml --repo yukazakiri/koakademy

Successful deployments publish to https://yukazakiri.github.io/koakademy/.

  • app/ — application services, models, middleware, jobs, policies, and support code
  • routes/ — web, API, console, and channel routes
  • resources/js/ — Inertia React pages and frontend components
  • Modules/ — optional domain modules loaded by Laravel Modules
  • database/ — migrations, factories, and seeders
  • tests/ — Pest feature and unit tests
  • docs/ — Astro documentation site and in-app Markdown sources
  • docker/ — production image and runtime scripts

See Architecture for boundaries and production dependencies.

Create migrations rather than modifying historical migrations. Include factories or test fixtures when a behavior needs representative data. Test migrations against SQLite when supported and PostgreSQL when using database-specific features. Production migrations must be compatible with the documented explicit migrate --force upgrade step.

  • Use strict types in new PHP files.
  • Validate request input and authorize protected actions.
  • Keep controllers focused on HTTP translation; place reusable workflows in services or actions.
  • Use Eloquent relationships, eager loading, and database constraints deliberately.
  • Dispatch expensive exports, mail, indexing, and PDF work to queues.
  • Keep secrets and host-specific values in configuration, never source code.

Use TypeScript for React code and existing design-system primitives before adding dependencies. Preserve keyboard access, visible focus, meaningful labels, reduced-motion behavior, loading states, and actionable error messages. Frontend calls to Laravel routes should use generated Wayfinder helpers where available.

API routes are not documented merely because they exist. New public documentation requires:

  1. Authentication and authorization behavior
  2. Request validation and response tests
  3. Stable examples based on actual controller responses
  4. An update to the API documentation contract test

The currently published subset is listed in docs/src/content/docs/api/api-overview.mdx.