Symfony 8 SPA with Doctrine ORM, Symfony Security, vanilla JS frontend. Migrated from plain PHP (delight-im/auth + raw SQL) to full Symfony stack. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Dudi – Claude Context
What this is
Habit & goal tracking PWA. Users set goals (e.g. "50 push-ups/day for 30 days"), log sets daily, and see progress. Invite-only registration. German UI.
Stack
- Symfony 8 + Doctrine ORM (src/)
- Vanilla JS SPA — no build step, no npm (public/app.js)
- HTML
<template>elements in templates/app.html.twig (rendered once, JS clones them) - MariaDB, session auth + remember-me 24h
Local dev
- URL: http://dudi.local/
- DB: zieltracker / zieltracker (see .env.local, gitignored)
php bin/console cache:clearafter config changespublic/app.jsis the authoritative JS file — also copy topublic/after edits toapp.jsat root (root copy is legacy, will be removed)
Server
ssh -p 30183 root@miniweb.kuehn.home- App: /var/www/tracker/, DB: dd/dd
- Deploy:
bash deploy.sh(rsync + remote composer install + cache:clear) - Remember-me table must exist:
rememberme_token(already created)
Key files
src/Controller/AuthController.php— login, register, password reset, name changesrc/Controller/GoalController.php— goals CRUDsrc/Controller/InviteController.php— invite creation + listingsrc/Security/JsonLoginAuthenticator.php— JSON POST /api/loginconfig/packages/security.yaml— firewall, remember-me, access controltemplates/app.html.twig— SPA shell + all tpl-* templatespublic/app.js— all frontend logic
Data model
goals.setsis a JSON object:{"2026-04-01": [20, 30], "2026-04-02": [50]}— keys are dates, values are arrays of logged amounts per session- Users table schema is compatible with the old delight-im/auth library (bcrypt hashes work unchanged)
- Password resets use
users_resetstable directly (raw SQL) — Symfony doesn't manage this table
Conventions
- API responses:
{ ok: true, ... }on success,{ error: "message" }on failure - All API routes prefixed
/api/, catch-all route in AppController renders SPA - No Twig cache (cache: false in index.php, now handled by Symfony kernel in prod)
- JS uses
tpl(id)helper to clone<template>elements, fills via querySelector with semantic class names - No comments in JS unless non-obvious; no trailing summaries in responses
Pending cleanup
api.php,index.php,include/,app.js,style.cssat project root are legacy pre-Symfony files — safe to delete once miniweb is migrated to Symfony- Legacy DB tables that can be dropped:
users_throttling,users_confirmations,schema_migrations - miniweb still runs old non-Symfony code — Symfony deploy + Apache config update pending