1. DevCraft Platform
  2. Documentation
  3. Getting started

Start here

Getting started

Describes the development build as of 2026-10-11. The platform is under active development; statuses are marked on each page.

This page takes you from an empty machine to a running DevCraft Platform: the Docker Compose stack with the Laravel API, PostgreSQL, Redis and the helper services, a seeded database, and the Vue single-page application talking to the live API. It is written for developers and administrators who want to run the platform locally, look around and start working on it.

Prerequisites

PHP, Composer, PostgreSQL and Redis all run inside containers. On the host you need only Docker and Node.js.

ToolVersionNotes
Docker Desktopcurrent releaseOn Windows use the WSL 2 backend (winget install Docker.DockerDesktop) and start it once before the first docker compose command. See the Docker Desktop documentation.
Docker Composev2 (docker compose)Ships with Docker Desktop.
Node.js22 or laterfrontend/package.json and runner/package.json declare "node": ">=22". CI runs on Node 24. The runner container itself uses node:22-alpine.
npmthe version bundled with your Node.jsUsed for the SPA in frontend/.
Gitany recent versionTo get the source.

You do not need a native PHP installation. Every PHP command in this documentation runs inside the api container (docker compose exec api php artisan …).

Get the source

The repository is not public yet. Once it is published, clone it and work from the repository root:

git clone <repository-url> devcraft-platform
cd devcraft-platform

The top-level folders you will touch while getting started:

compose.yaml
The local development stack (all services below).
backend/
Laravel 12 REST API (PHP 8.4), bind-mounted into the api and scheduler containers.
frontend/
Vue 3 + TypeScript SPA, run on the host with Vite.
runner/
The background script runner service (Node, no dependencies).
scripts/
backend-test.sh (backend test suite) and check-baseline.mjs (baseline guard).

The development guide describes the full layout.

The Docker Compose stack

compose.yaml defines the project devcraft-platform with six services and one named volume (pgsql-data).

ServiceImage or buildCommandHost portsPurpose
apibuild ./backend (php:8.4-cli-alpine with pdo_pgsql, intl, zip, bcmath, pcntl, opcache, redis)php artisan serve --host=0.0.0.0 --port=8000 --no-reload8000The REST API under /api/v1. Source is bind-mounted from ./backend. PHP_CLI_SERVER_WORKERS=4.
schedulerbuild ./backendphp artisan schedule:worknoneRuns the due scheduled commands every minute: platform:logs:prune daily at 03:15, platform:packages:prune-previews hourly, platform:remote-sets:prune daily at 03:45.
runnerbuild ./runner (node:22-alpine)node server.mjsnone (3001 inside the network)Executes background scripts. No database, no secrets, read-only root filesystem, tmpfs on /tmp, mem_limit: 768m, pids_limit: 64.
pgsqlpostgres:17-alpinedefault5432Database devcraft, user devcraft, data in the pgsql-data volume, health check with pg_isready.
redisredis:7-alpinedefault6379Cache store (including the metadata cache) and queue connection.
mailpitaxllent/mailpit:latestdefault8025 (web UI), 1025 (SMTP)Catches outgoing mail. The api service is configured with MAIL_MAILER=smtp and MAIL_HOST=mailpit.

api and scheduler wait for pgsql to be healthy and for redis to start. Both share the entrypoint backend/docker/entrypoint.sh, which on every start:

  1. runs composer install when backend/vendor is missing;
  2. copies backend/.env.example to backend/.env when .env is missing;
  3. generates APP_KEY when .env has none;
  4. runs php artisan migrate --force.

The development server needs several workers because a background script calls the API back while the request that started it is still open. The built-in PHP server honours PHP_CLI_SERVER_WORKERS only with --no-reload, which also means it does not restart when backend/.env changes. Restart the api container after editing .env.

First start

  1. Start Docker Desktop. From the repository root, start the whole stack in the background:

    docker compose up -d

    The first run builds the api, scheduler and runner images, installs the Composer dependencies, creates backend/.env, generates the application key and runs the migrations. Follow progress with docker compose logs -f api.

  2. Align backend/.env with the Compose services. Open backend/.env (just created from the example) and set:

    DB_HOST=pgsql
    REDIS_HOST=redis
    CACHE_STORE=redis

    Then restart the API: docker compose restart api. The environment alignment section explains why this step is needed.

  3. Check that the API answers:

    curl -i http://localhost:8000/up
    curl -s http://localhost:8000/api/v1/health

    /up is the framework liveness check. /api/v1/health performs a database round trip and returns 503 when the platform is degraded.

  4. Seed the database (next section).

Seeding the database

Migrations create the empty schema. The seeders fill it with the platform's own metadata, the roles, the first administrator and, locally, fictional demo records:

docker compose exec api php artisan db:seed

DatabaseSeeder runs, in this order:

SeederWhat it writesWhen
RoleSeederThe roles admin, security_admin, platform_user, itil, user_admin.always
PlatformMetadataSeederThe platform baseline dictionary through the family seeders in database/seeders/Platform/, in dependency order: IdentitySeeder, AssetSeeder, CmdbSeeder, TaskSeeder, SystemTablesSeeder. Tables, fields, overrides, default forms and lists, plus reference data such as relationship types.always
first administratorA user with the roles admin, security_admin and platform_user, from PLATFORM_ADMIN_EMAIL and PLATFORM_ADMIN_PASSWORD.only when no user holds admin yet
DemoDataSeederFictional people, locations, departments, groups, assets, configuration items, incidents, problems and changes of an invented organisation, with reserved example e-mail domains.only when APP_ENV=local

Platform seeders and demo data are deliberately separate:

  • Platform seeders are idempotent and additive. Every object gets a deterministic id derived from its package key, so two fresh installations produce identical ids. Existing tables, fields, overrides, forms and lists are never overwritten, so your local customisations survive a re-seed. All writes go through MetadataWriter and RecordWriter.
  • Demo data is written through RecordWriter like any API call, so validation, references, numbering and audit apply. People, locations, departments, groups and configuration items are matched by name; task records are seeded once.

You can run one part on its own with the standard Laravel --class option:

docker compose exec api php artisan db:seed --class=PlatformMetadataSeeder
docker compose exec api php artisan db:seed --class=DemoDataSeeder

PlatformMetadataSeeder invalidates the metadata cache before it starts, because the database may have been reset underneath a shared cache.

The first administrator

Set the two variables in backend/.env before the first seed if you want to choose the account:

VariableEffect
PLATFORM_ADMIN_EMAILE-mail address of the first administrator (stored in lower case). Empty in a local environment: the seeder falls back to the project owner's development identity. Empty outside a local environment: no administrator is created and the seeder prints a warning.
PLATFORM_ADMIN_PASSWORDIts password. Empty: the seeder generates a 20-character password and prints it once in the seeder output.
PLATFORM_ADMIN_USER_NAMEOptional user name (config key platform.admin.user_name, default admin).

The platform never ships a hardcoded password, and the documentation never prints one.

Running the SPA

The SPA runs on the host with the Vite development server:

cd frontend
npm install
npm run dev

Vite listens on http://localhost:5173. Out of the box the SPA runs in mock mode. To use the live API, create frontend/.env.local (start from frontend/.env.example):

VITE_API_MODE=http

Restart npm run dev after changing the file. The variables in frontend/.env.example:

VariableDefaultMeaning
VITE_API_MODEmockmock: in-memory mock data, no backend needed. http: the live contracts talk to the Laravel API (see Mock mode and live API).
VITE_API_URLemptyBase URL of the API as seen from the browser. Leave it empty to use the Vite proxy, which is the recommended local setup.
VITE_PROXY_TARGEThttp://localhost:8000Where the dev-server proxy forwards /api, /sanctum and exactly /up.

With the proxy, the SPA and the API share one origin, so the Sanctum session cookie and the XSRF token work without CORS. The /up rule is an exact match so that SPA pages such as /update-sets are not proxied to Laravel.

The frontend entry in .claude/launch.json runs the same command with --port 5173 --strictPort.

Signing in

With VITE_API_MODE=http, open http://localhost:5173. The login page says "Connected to the local DevCraft API". Sign in with the administrator from backend/.env: the address in PLATFORM_ADMIN_EMAIL (or the one the seeder printed) and the password from PLATFORM_ADMIN_PASSWORD (or the generated one).

What happens behind the form:

  1. The SPA calls GET /sanctum/csrf-cookie, then POST /api/v1/auth/login with { email, password, remember? }.
  2. The API answers with the Session payload (user, roles, environment, workspace, platform date settings). GET /api/v1/auth/session returns it again on reload.
  3. Sign-in attempts are throttled to 5 per minute per e-mail and IP. After PLATFORM_LOCKOUT_ATTEMPTS failures (default 5) the account is locked and the API answers 423 account_locked. The answer never reveals whether an address exists.

In mock mode the login accepts any valid work e-mail with a password of at least 8 characters, and nothing is sent to a server. The page says so.

Details on sessions, tokens and roles: Access control.

Service URLs and ports

WhatAddressNotes
SPA (Vite)http://localhost:5173Runs on the host, not in Compose.
Service Portalhttp://localhost:5173/portalEnd-user surface of the same SPA.
APIhttp://localhost:8000Base path /api/v1.
Livenesshttp://localhost:8000/upFramework health route.
Healthhttp://localhost:8000/api/v1/healthDatabase round trip, version; 503 when degraded.
Mailpithttp://localhost:8025SMTP on localhost:1025.
PostgreSQLlocalhost:5432Database and user devcraft; the password is in compose.yaml and is for local use only.
Redislocalhost:6379No password locally.
Script runnerhttp://runner:3001Only inside the Compose network; not published to the host.

CORS and stateful session origins are configured for localhost:5173 and 127.0.0.1:5173 (SANCTUM_STATEFUL_DOMAINS, CORS_ALLOWED_ORIGINS).

Environment alignment with Compose

The API container gets its settings from two places:

  • the environment: block of the api service in compose.yaml (DB_HOST=pgsql, REDIS_HOST=redis, CACHE_STORE=redis, QUEUE_CONNECTION=redis, mail and runner URLs);
  • the file backend/.env, created from backend/.env.example, whose defaults target a native setup (DB_HOST=127.0.0.1, REDIS_HOST=127.0.0.1, CACHE_STORE=database).

In this setup the web worker started by php artisan serve --no-reload reads backend/.env, while commands started with docker compose exec api … read the Compose environment: block. If the two disagree, the web process and the command line use different databases or, more subtly, different metadata caches.

The practical consequence: php artisan platform:meta:cache-clear clears the cache the CLI sees, and the SPA keeps showing the old dictionary because the web process reads another cache store.

Never commit backend/.env. backend/.env.example is the reference for every variable, including the limits for XML transfer (TRANSFER_*), update set packages (PACKAGE_*), remote instances (REMOTE_*), system logs (PLATFORM_LOG_*) and background scripts (SCRIPT_*). Operations lists them.

Stopping, resetting and the metadata cache

Stopping

docker compose down        # stop and remove the containers, keep the database volume
docker compose down -v     # also delete the pgsql-data volume (all data)

Stop Vite with Ctrl+C in its terminal.

Resetting the database

Two ways, depending on how far you want to go:

  1. Full reset. docker compose down -v, then docker compose up -d (the entrypoint migrates the empty database), then docker compose exec api php artisan db:seed.

  2. Schema reset in place. Rebuild the tables and seed again:

    docker compose exec api php artisan migrate:fresh
    docker compose exec api php artisan db:seed

Clearing the metadata cache after migrate:fresh

Table definitions are cached in the configured cache store under a version key (meta:version). MetadataWriter invalidates it after every write, but migrate:fresh resets the database underneath a running instance while Redis keeps the old dictionary. After migrate:fresh, either seed (the platform seeder invalidates the cache) or clear it explicitly:

docker compose exec api php artisan platform:meta:cache-clear

The command prints the new cache version. If the SPA still shows stale tables afterwards, check the environment alignment.

Mock mode and live API

All screens call api.* from frontend/src/api. frontend/src/api/index.ts binds each contract either to an in-memory mock or to the HTTP implementation. The list of live contracts is exported as liveContracts.

ContractVITE_API_MODE=mockVITE_API_MODE=http
authsimulated sign-in, nothing verifiedLive Sanctum session
meta, records, referencesprototype definitions only; generic table screens show an explanatory stateLive /api/v1/meta, /api/v1/table
portalmockLive /api/v1/portal
scriptsprototype mode: runs are reported as not executedLive runner service
transfer, updateSets, packages, remotenot available; the UI hides or explains the featureLive
users, catalogItems, dashboard, notificationsmockStill mocked prototype screens, labelled as such
flowsstored in the browserStill in the browser until a flow API exists

Prototype-only screens carry a visible prototype badge. Mock data resets on reload. The Service Portal's catalogue and knowledge articles are illustrative client data in both modes and are labelled as such.

A first tour

Sign in as the administrator in live mode, then try these in order.

  1. Open the incident list. Go to http://localhost:5173/incident/list (or Incidents in the navigator). This is the generic list: columns, sort, per-column filters, search and paging come from the backend list layout. Every table is served the same way at /{table}/list, /{table}/new and /{table}/{recordId}. Filters, sort, page and search live in the URL; try right-clicking a cell and choosing Show matching, then look at the q parameter.

  2. Create a record. Choose New (or open /incident/new). Fill Short description and Caller (both mandatory; the caller is a reference picker over the live Table API) and save. The number is assigned by the server with the INC prefix. Change a field and save again: updates use optimistic locking, so a concurrent change answers 409 conflict. Administrators can open View history from the form's actions menu.

  3. Pick an update set. On a wide window, the top bar shows the update set picker (administrators, live mode only). Without a selection, configuration changes go to the scope's Default set. Open Administration → Update Sets (/update-sets), create a set and choose Make current. Now change something that counts as configuration (for example a system property at /sys_property/list) and look at the captured changes of your set. Incidents are operational data and are never captured. See Update sets.

  4. Run a background script. Open Platform → Background Scripts (/background-scripts). Paste:

    const incidents = await DevCraft.record('incident')
      .where('active', true)
      .orderBy('number', 'desc')
      .limit(5)
      .find();
    DevCraft.log.info(`Found ${incidents.length} incidents`);

    Run it. The script executes in the runner service, never in PHP or the browser, with a short-lived token of your account. A script that calls insert, update or delete asks for confirmation first. See Scripting and flows.

  5. Look at the logs and the dictionary. System Logs are at /syslog/list (administrators only, read-only). The data model is at /sys_table/list.

  6. Visit the portal. Open /portal, raise a request from New request and find it as an incident in /incident/list.

Troubleshooting

SymptomLikely causeFix
The SPA shows tables or fields that no longer exist after migrate:fresh, or a new table is missing.The metadata cache in Redis outlived the database reset.Run docker compose exec api php artisan platform:meta:cache-clear or seed again.
platform:meta:cache-clear reports success but the SPA does not change.backend/.env points the web process at another cache store or database than the CLI.Set DB_HOST=pgsql, REDIS_HOST=redis, CACHE_STORE=redis in backend/.env and docker compose restart api.
An edit to backend/.env has no effect.artisan serve --no-reload does not watch .env.docker compose restart api.
The SPA accepts any password and shows no real data.Mock mode.Create frontend/.env.local with VITE_API_MODE=http and restart npm run dev.
Generic table screens show an explanatory state instead of records.Mock mode: the mock data source only knows the prototype tables.Use live mode.
The update set picker, Export XML or Import XML… are missing.Mock mode, a non-administrator account, or (for the picker) a narrow window.Use live mode as an administrator; widen the window.
Sign-in answers 419 csrf_token_mismatch or the session is lost after login.The SPA does not reach the API through the Vite proxy, or runs on an origin outside SANCTUM_STATEFUL_DOMAINS (for example another port because 5173 was taken).Leave VITE_API_URL empty, keep Vite on port 5173, check VITE_PROXY_TARGET.
Sign-in answers 423 account_locked.Too many failed attempts (PLATFORM_LOCKOUT_ATTEMPTS).An administrator unlocks the account; locally you can also reset the database.
Sign-in answers 429 rate_limited.More than 5 attempts per minute for one e-mail and IP.Wait for the Retry-After interval.
No administrator was created by db:seed.An administrator already exists, or PLATFORM_ADMIN_EMAIL is empty outside a local environment.Read the seeder output; set the variables before the first seed or reset the database.
A background script ends as unavailable.The runner is not running, or SCRIPT_RUNNER_URL is empty in backend/.env. Nothing was executed.docker compose up -d runner; check SCRIPT_RUNNER_URL=http://runner:3001 and restart api.
A background script hangs until its timeout.The API runs with a single worker, so the script cannot call it back.Keep PHP_CLI_SERVER_WORKERS above 1 and the --no-reload flag, as in compose.yaml.
Saving configuration answers 422 "The requested change set is no longer in progress".Your current update set was completed.Choose another set in the picker or clear the selection.
A remote instance on http:// or a private address is refused.The outbound policy allows only https to public addresses.For local experiments only, set REMOTE_ALLOW_LOCAL=true in backend/.env. Never in production.
Tests wiped your local data.php artisan test was run inside the api container against the development database.Always use scripts/backend-test.sh; see the development guide.

When something fails in the API, every response carries an X-Request-Id header. Search for it in System Logs (/syslog/list) or in docker compose logs api.