Search by

esoul-cz / template-laravel-cms

Heroyt

eSoul Laravel 13 headless CMS: a Filament 5 admin that edits pages and site settings, the content export for an Astro site, the Publish button and the form endpoint.

Package info

github.com/eSoul-cz/template-laravel-cms

Type:project

pkg:composer/esoul-cz/template-laravel-cms

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-11-26 13:24 UTC

This package is auto-updated.

Last update: 2026-11-26 13:24:32 UTC


README

Replace this title and the sentence below with what the application does.

Getting started

  1. Clone: git clone git@github.com:eSoul-cz/<repository>.git, then git lfs pull where the project keeps assets/ or .pen files in LFS.
  2. Agent skills: the project commits skills-lock.json and .agents/skills/, so they come with the clone; npx skills experimental_install restores or refreshes them. Optional personal layers (installed once per user, not part of the project): npx @esoul-cz/skills install project helpers; npx @esoul-cz/skills layers lists them.
  3. Local environment: Setup (cp .env.example .env, docker compose up -d --build).
  4. Access, asked from the project lead or devops: the GitHub repository, the Freelo project (CONTEXT.md › Freelo), the Jenkins job (its Jenkins check runs on every pull request), Komodo (read-only, for the stack and its logs) and the project's vault in 1Password (secrets and staging logins live there, never in Git). Then read AGENTS.md and CONTEXT.md.

Requirements

  • Docker with Compose (OrbStack or Docker Desktop). The application runs only in the Docker stack; artisan serve on the host is not supported.
  • PHP 8.5, Composer, Node 26 and pnpm 12 on the host are optional: only for running the linters, static analysis and the tests outside the container.
  • Access to the eSoul container registry (rg.fr-par.scw.cloud) to pull the PHP base image.

Setup

cp .env.example .env
docker compose up -d --build
docker compose exec laravel php artisan key:generate   # only when APP_KEY in .env is empty

The first start installs the Composer and pnpm dependencies, waits for the database, runs the migrations and starts php-fpm, the queue listener, the scheduler and Vite. Follow it with docker compose logs -f laravel. composer create-project already copies .env and generates the key.

In a project fresh from the template, commit pnpm-lock.yaml after the first start, which writes it (composer.lock is already there). The release image runs pnpm install --frozen-lockfile and cannot be built without it. Pull-request builds do not show the gap: their tests run pnpm install, which leaves a lockfile in the workspace before the test image is built, so the first failure is the build of main.

Ports

Port Service Setting
8080 The application (nginx) APP_PORT
5173 Vite dev server VITE_PORT
8025 Mailpit inbox: every mail the application sends MAILPIT_UI_PORT
1025 Mailpit SMTP MAIL_PORT
3306 MariaDB, for a client on the host FORWARD_DB_PORT

Commands

Application commands run in the container:

docker compose exec laravel php artisan <command>
docker compose exec laravel php artisan migrate
docker compose exec laravel php artisan db:seed       # local development data (DatabaseSeeder: the test account)

Checks, in the container or on the host; CI runs the same ones:

composer phpstan   # Larastan, level 10
composer cs        # Pint, check only (`composer pint` fixes)
composer test      # PHPUnit in parallel, SQLite in memory
composer mutation  # Infection on the lines changed against main (local, never in CI)
pnpm build         # Vite production build

Configuration

The settings are in .env (local) and in the stack's environment (deployed). A new variable is added to .env.example with a placeholder and named in the pull request's deploy notes.

Variable Meaning
APP_PORT, VITE_PORT, MAILPIT_UI_PORT, FORWARD_DB_PORT, WWWUSER, WWWGROUP The local stack only (docker-compose.yml)
RUN_MIGRATIONS, RUN_SCHEDULER, RUN_QUEUE_WORKER What the production container starts, each exactly true or false. Exactly one container of a stack runs the scheduler
TRUSTED_PROXIES Addresses or CIDR ranges of the reverse proxies whose forwarded headers are trusted. Empty trusts none, which is right behind the host NGINX. Never *
MONEY_DEFAULT_CURRENCY ISO code used by App\Infrastructure\Casts\MoneyCast when a row has no currency
OTEL_* OpenTelemetry export, see below

Production start

docker/production/start caches the configuration, runs the migrations where RUN_MIGRATIONS=true and starts Supervisor. A failing migration does not stop the container: MIGRATION FAILED is written to standard error and php-fpm starts anyway, so whoever monitors the deployment reads the log and decides (fix forward or roll back). The script never seeds. A seeder is run by hand in the container (docker exec <container> php artisan db:seed --class=ProductionSeeder --force). Only the specialised seeders may run in staging or production: a production seeder (what every environment needs; idempotent, create-only, no account) and a demo seeder (deliberate demo content, no account with credentials outside local development). DatabaseSeeder is the general seeder for local development: it refuses to run outside local and testing. Heavy data tasks (recalculations, syncs, imports) run in the background, never in this script.

OpenTelemetry

Every deployed application exports traces, logs and metrics over OTLP (gRPC) to the host collector. The base image has the opentelemetry PHP extension; the template ships only the OTEL_* placeholders in .env.example and keeps OTEL_PHP_AUTOLOAD_ENABLED=false, so nothing is exported yet. To switch it on, a maintainer approves and adds the SDK, the OTLP exporter and the Laravel auto-instrumentation packages, sets OTEL_PHP_AUTOLOAD_ENABLED=true and a real OTEL_SERVICE_NAME, and the stack's environment names the collector (OTEL_EXPORTER_OTLP_ENDPOINT). Host-side test runs export OTEL_PHP_DISABLED_INSTRUMENTATIONS=all when the extension is installed.

Production image

docker/production/Dockerfile builds the release image: php-fpm on port 9000 under Supervisor with the optional queue worker and scheduler, and no web server (the host nginx reaches php-fpm over FastCGI). Its HEALTHCHECK fails when a Supervisor program that should run is not RUNNING or when a FastCGI request for /up does not answer 200.

Troubleshooting

  • docker compose up hangs at "Waiting for the database": the MariaDB container is still initialising on the first start; the entrypoint retries for two minutes. docker compose logs mariadb shows the reason when it does not come up.
  • Port already in use: change APP_PORT, VITE_PORT, MAILPIT_UI_PORT or FORWARD_DB_PORT in .env.
  • Files written by the container belong to root on Linux: set WWWUSER and WWWGROUP to id -u and id -g in .env and rebuild (docker compose up -d --build). Docker Desktop and OrbStack ignore them.
  • Missing PHP extension or base image: the extension belongs to the shared base image, not to this repository's Dockerfile.

Admin panel (Filament)

The Filament panel is served at /admin and themed from resources/css/filament/admin/theme.css, a Vite entry (pnpm build builds it, pnpm dev serves it).

  • Create a user with docker compose exec laravel php artisan make:filament-user, then give it access with docker compose exec laravel php artisan admin:promote <email>. Only users with users.is_admin set can open the panel.
  • Regenerate the theme with php artisan make:filament-theme admin --pm=pnpm; without --pm Filament uses npm and creates an npm lockfile.

Headless CMS

This application is the backend of a static Astro site: editors maintain pages and site settings in the admin (/admin), the Publish page starts the Jenkins job of the frontend, and the frontend build reads the content from GET /cms-api/v1/export. The contract (versioned, guarded by tests/Fixtures/content-export.golden.json) is docs/contract.md of the astro-cms monorepo; the form endpoint is docs/forms.md.

| Path | What | | /admin | Filament admin: pages, site settings, Publish, form submissions | | /cms-api/v1/export, /cms-api/v1/publishes/{id}/status | Content export and the Jenkins callback (IP allowlist and bearer tokens, CMS_* in .env.example) | | /forms/contact | The contact form of the site (docs/forms.md) | | /_cms/, /cms-media/ | Public media and admin uploads, served by NGINX from storage/app/cms-public and storage/app/cms-media |

  • Contract change: the exporter and the golden test change here, the Zod schema, the golden copy (pnpm contract:sync) and the fixture in the frontend, and docs/contract.md: one pull request in each repository, linked to each other. After changing the exporter or tests/Support/SampleContent.php: GOLDEN_UPDATE=1 php artisan test --filter=GoldenExportTest.
  • Where this backend lives: on a subdomain of the site (default) or, as a documented exception, under /admin of the site's domain (CMS_ADMIN_PATH_MODE=true, SESSION_PATH=/admin); see .env.example and the README of the astro-cms monorepo.
  • Persistent paths (bind mounts of the stack): storage/app/cms-public, storage/app/cms-media, storage/app/private/forms-last-resort. The build agent has to be in CMS_API_ALLOWED_IPS.
  • A static site without a CMS that only needs forms starts from this template too and ignores the pages.