2.9 KiB
2.9 KiB
Context
Phase 1–3 built the GOAT frontend + shared Postgres (users, tags, scans, products, orders on .13:5434). Phase 4 adds the Laravel admin: a management UI for users, tags (with the product/order linkage built in Phase 2.5), products/orders, and a dashboard. It reuses the same DB — no sync layer.
Goals / Non-Goals
Goals:
- A working Laravel + Filament admin on .27 via Docker (no PHP installed natively).
- Reads/writes the shared Postgres on
.13:5434(single source of truth). - Admin login gated by
users.is_admin; full CRUD for users/tags/products/orders; dashboard stats.
Non-Goals:
- Billing/payments (Phase 5).
- Photo uploads in admin (frontend has it; admin can reuse photo_url display).
- Public-facing Laravel pages (this is admin-only for now).
- Laravel owning migrations yet —
db/schema.sqlstays canonical; Eloquent reads the existing tables.
Decisions
- Docker dev on .27 —
admin/docker-compose.ymlwithphp:8.3-fpm+ a composer bootstrap;php artisan serve --host=0.0.0.0 --port=3030. No PHP/Composer installed natively (keeps .27 clean). Docker volume mountsadmin/so edits are live. - Filament v3 for the admin panel (CRUD resources: User, Tag, Product, Order + dashboard stats). Rationale: the 2014 system needed forms-heavy admin; Filament is the Laravel-idiomatic generator and the best skills-update vehicle for Laravel conventions.
- Shared DB via Eloquent — models map to the existing tables (users, tags, scans, products, orders). No migrations in Phase 4;
db/schema.sqlremains the source of truth (Laravel takes over migrations at deploy, generating from it).users.is_adminadded via the existing idempotent ALTER in schema.sql. - Auth — Laravel's session auth + a middleware/policy:
Filament::auth()->user()->is_admingate. Seed one admin user (env-configured email, password from env). - Connection —
admin/.envDB_CONNECTION=pgsql,DB_HOST=192.168.20.13,DB_PORT=5434,DB_DATABASE=wherewoof,DB_USERNAME=wherewoof, password via env (gitignored.env).
Risks / Trade-offs
- [Docker image pulls + composer install are slow first-time] → one-time cost; cached after.
- [Laravel writing to a schema it doesn't own] → read-only via Eloquent where possible; writes (tag product/order assignment, order status) are simple column updates already exercised by the GOAT app; migrations reconciled at deploy.
- [Shared users table across both apps] →
is_adminflag only; no schema conflict. - [NixOS Docker networking to .13] → plain TCP to 192.168.20.13:5434, already proven by the Go app.
Migration Plan
make db-up(addsusers.is_admin).admin/docker-compose.ymlup → composer create-project laravel/laravel admin → filament install → models/resources.- Seed admin user; verify login + CRUD against the shared DB.
Open Questions
- Whether the admin gets public-facing pages later (likely not — the GOAT frontend serves the public).