template-symfony-sveltekit Svelte Themes

Template Symfony Sveltekit

Opinionated full-stack template: PHP 8.4 + Symfony 8 + SvelteKit 2 + FrankenPHP + Docker + 10 PHPStan extensions + Claude Code. Production-ready quality tooling from commit zero.

Symfony + SvelteKit Template

Opinionated full-stack template for PHP 8.4 + Symfony 8 + SvelteKit projects. Production-ready quality tooling from commit zero.

What's Included

Layer Technologies
Backend PHP 8.4, Symfony 8, Doctrine ORM, FrankenPHP (Worker Mode)
Frontend SvelteKit 2, Svelte 5, Bun, TypeScript strict, Tailwind 4
Database PostgreSQL 17, PgBouncer (Transaction Mode)
Email Mailpit (dev catch-all at :8025), Resend-ready for prod
Quality 10 PHPStan extensions, Rector, ECS, PHPUnit 13, Infection
CI/CD GitHub Actions (backend + frontend + E2E + deploy), Dependabot auto-merge
AI Claude Code integration via CLAUDE.md + .claude/ guidelines
Infrastructure OpenTofu modules for Hetzner deployment

Quick Start

Prerequisites: Docker (only dependency — everything else runs in containers)

# 1. Use this template (green button above) or clone via gh
gh repo create my-project --template tony-stark-eth/template-symfony-sveltekit --private

# 2. Start containers (composer install runs automatically via docker-entrypoint.sh)
docker compose --profile dev up -d

# 3. Run all quality checks (inside the PHP container)
docker compose exec php vendor/bin/ecs check
docker compose exec php vendor/bin/phpstan analyse
docker compose exec php vendor/bin/phpunit

After Forking — Checklist

  • Update composer.json name and description
  • Update package.json name
  • Generate JWT keys: docker compose exec php php bin/console lexik:jwt:generate-keypair
  • Copy .env.example to .env.local and fill in real secrets
  • Add ANTHROPIC_API_KEY as a GitHub repository secret (required for Claude workflows)
  • Create domain folders under backend/src/ (e.g. src/User/, src/Product/)
  • Add project-specific phpat architecture rules in tests/Architecture/
  • Update CLAUDE.md with project-specific context
  • Remove this checklist from README

Quality Stack

Tool What it enforces
PHPStan Level max Type safety, dead code, logic errors
phpstan-strict-rules ===, no empty(), strict in_array()
phpstan-deprecation-rules No deprecated API usage
shipmonk/phpstan-rules ~40 rules: enum safety, forgotten exceptions, custom bans
voku/phpstan-rules Operator type safety, assignment-in-condition
tomasvotruba/cognitive-complexity Max 8/method, max 50/class
tomasvotruba/type-coverage 100% type declarations required
phpat/phpat Architecture tests (layer dependencies, naming conventions)
phpstan-symfony Container-aware analysis, route parameter checking
phpstan-doctrine Entity mapping validation, repository return types
phpstan-phpunit Mock type inference, assertion analysis
Infection Mutation testing: MSI ≥ 80%, Covered MSI ≥ 90%

Make Targets

Run make help for a full list. Most commonly used:

Target Description
make up Start all Docker services (dev profile)
make down Stop all Docker services
make quality Run all backend quality checks (ECS, PHPStan, Rector, PHPUnit, Infection)
make phpstan Static analysis only
make ecs Coding standard auto-fix
make rector Rector auto-fix
make test PHPUnit (all suites)
make test-unit Unit tests with HTML coverage report
make test-integration Integration tests only
make infection Full mutation testing run
make infection-fast Mutation testing on changed files only
make frontend-dev SvelteKit dev server
make frontend-build SvelteKit production build
make frontend-check TypeScript + Svelte type check
make frontend-lint ESLint
make db-migrate Run Doctrine migrations
make db-reset Drop, recreate, and migrate database
make shell Shell into the PHP container
make tofu-plan OpenTofu infrastructure dry-run
make tofu-apply OpenTofu apply (creates real resources)

CI / GitHub Actions

Workflow Runs Steps
ci.yml Every push / PR ECS → PHPStan → Rector → PHPUnit → Infection
ci-frontend.yml Every push / PR ESLint → Svelte Check → Build
ci-e2e.yml Every push / PR Playwright E2E tests
cd.yml Push to main (app code) CI Gate → Build & Push to GHCR → Deploy via SSH
claude-update.yml Biweekly Dependency updates via Claude Code with breaking-change resolution
claude-review.yml Every PR Automatic code review posted as PR comment

Default: GitHub-hosted runners. For self-hosted runners: set the repository variable RUNNER_LABEL to your runner label.

Deployment

One-command deployment to Hetzner Cloud:

./scripts/first-deploy.sh <domain> <project-name> [github-repo]

This provisions a CX23 VPS, installs Docker, builds the app, sets up GlitchTip error tracking, and configures GitHub Actions CD. See docs/deployment.md for manual steps and troubleshooting.

Claude Code

This template ships with full Claude Code integration out of the box:

  • CLAUDE.md — entry point read automatically by Claude Code on every session
  • .claude/ — coding guidelines (PHP, frontend, testing, architecture)
  • claude-review.yml — automatic code review on every pull request
  • claude-update.yml — biweekly dependency updates with AI-assisted conflict resolution

Required secret: Add ANTHROPIC_API_KEY to your repository secrets. Without it, the Claude workflows will skip silently.

Contributing

See CONTRIBUTING.md. TL;DR: fork, branch, make quality, PR.

License

MIT — Copyright (c) 2026 tony-stark-eth

Top categories

Loading Svelte Themes