Development
This guide covers native development and testing. Production operators should use Getting Started instead.
Toolchain
Section titled “Toolchain”- PHP 8.5.12 or newer and Composer 2
- Node.js 22.23.4 or newer and npm (
.node-versionandmise.tomlpin PHP 8.5.12 and Node.js 26.13.0 to match CI and production Docker builds) rsvg-convertfromlibrsvg2-binfor SVG brand uploads- SQLite for the default local setup, or PostgreSQL via
compose.yamlfor 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.
Native setup (Linux, macOS, and Windows)
Section titled “Native setup (Linux, macOS, and Windows)”composer setup and composer dev are cross-platform and run identically on Windows, macOS, and Linux without external databases or Redis:
git clone https://github.com/yukazakiri/koakademy.gitcd koakademycomposer setupcomposer devcomposer 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):
git clone https://github.com/yukazakiri/koakademy.gitcd koakademydocker compose up -d --builddocker compose exec laravel.test composer setupdocker compose exec laravel.test php artisan test --compactTo also start Redis-backed Horizon and Pulse background workers in Docker, enable the workers profile:
docker compose --profile workers up -dContributors 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.
Common commands
Section titled “Common commands”composer testvendor/bin/pint --testnpm run buildnpm run format:checknpm run docs:checknpm --prefix docs cinpm --prefix docs run buildRun a focused Pest file while iterating:
php artisan test --compact tests/Feature/SetupAvailabilityTest.phpphp artisan test --compact --filter="shows the setup screen"Documentation workflow
Section titled “Documentation workflow”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:
npm run docs:syncnpm run docs:checkThe sync command updates the contributing mirror. Never edit generated mirrors directly; native MDX pages are edited in place.
Hosted documentation site
Section titled “Hosted documentation site”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:
gh workflow enable deploy-docs.yml --repo yukazakiri/koakademySuccessful deployments publish to https://yukazakiri.github.io/koakademy/.
Application structure
Section titled “Application structure”app/— application services, models, middleware, jobs, policies, and support coderoutes/— web, API, console, and channel routesresources/js/— Inertia React pages and frontend componentsModules/— optional domain modules loaded by Laravel Modulesdatabase/— migrations, factories, and seederstests/— Pest feature and unit testsdocs/— Astro documentation site and in-app Markdown sourcesdocker/— production image and runtime scripts
See Architecture for boundaries and production dependencies.
Database changes
Section titled “Database changes”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.
Backend conventions
Section titled “Backend conventions”- 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.
Frontend conventions
Section titled “Frontend conventions”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.
Adding or changing APIs
Section titled “Adding or changing APIs”API routes are not documented merely because they exist. New public documentation requires:
- Authentication and authorization behavior
- Request validation and response tests
- Stable examples based on actual controller responses
- An update to the API documentation contract test
The currently published subset is listed in docs/src/content/docs/api/api-overview.mdx.
