diff --git a/cmd/server/__debug_bin2658940089 b/cmd/server/__debug_bin2658940089 deleted file mode 100755 index c5e9c28..0000000 Binary files a/cmd/server/__debug_bin2658940089 and /dev/null differ diff --git a/codex-prompt/add-flowbite.txt b/codex-prompt/add-flowbite.txt deleted file mode 100644 index 40daaee..0000000 --- a/codex-prompt/add-flowbite.txt +++ /dev/null @@ -1,71 +0,0 @@ -TASK: Integra Flowbite (UI + JS behavior) e aggiungi Makefile per Tailwind CLI (build/watch). Uso più terminali: non aggiungere tool per runner multi-process. - -1) Dipendenze Node -- Se non esiste package.json in root, crearlo. -- Installare: - - npm install -D @tailwindcss/cli tailwindcss - - npm install flowbite - -2) Tailwind config -- Creare tailwind.config.js con: - content: [ - "./web/templates/**/*.{html,gohtml}", - "./web/static/**/*.js", - "./node_modules/flowbite/**/*.js" - ], - theme: { extend: {} }, - plugins: [ require("flowbite/plugin") ] - -3) CSS input -- Creare ./assets/tailwind/input.css con: - @import "tailwindcss"; - -4) Scripts npm -- In package.json aggiungere: - "scripts": { - "tw:build": "npx @tailwindcss/cli -i ./assets/tailwind/input.css -o ./web/static/css/app.css --minify", - "tw:watch": "npx @tailwindcss/cli -i ./assets/tailwind/input.css -o ./web/static/css/app.css --watch" - } - -5) Copia Flowbite JS -- Creare directory web/static/vendor se manca -- Copiare: - node_modules/flowbite/dist/flowbite.min.js -> web/static/vendor/flowbite.js - -6) Layout -- Aggiornare /web/templates/layout.html per includere: - - - -- Rimuovere dal layout riferimenti attivi al vecchio UI kit Svelte (ma non cancellare /ui-kit dal repo) - -7) Makefile -- Creare/aggiornare Makefile con target: - - tw-build: npm run tw:build - - tw-watch: npm run tw:watch - - flowbite-copy: mkdir -p web/static/vendor && cp node_modules/flowbite/dist/flowbite.min.js web/static/vendor/flowbite.js - - assets: flowbite-copy tw-build - - server: go run ./cmd/server -- Non creare target che avvia più processi insieme. - -8) Partials Flowbite -- Creare /web/templates/components: - - navbar.html - - modal.html - - dropdown.html - - tabs.html - - collapse.html -Con markup Flowbite + data-attributes standard, senza JS custom. - -9) Licenze -- Creare /licenses/FLOWBITE-MIT.txt e THIRD_PARTY_NOTICES.md (Flowbite MIT, Tailwind MIT). - -10) README -- Aggiornare README con istruzioni: - Terminale 1: npm i && make assets && make tw-watch - Terminale 2: make server - -Criteri: -- make assets genera CSS e copia flowbite.js -- modals/dropdowns Flowbite funzionano -- progetto compilabile e avviabile. \ No newline at end of file diff --git a/codex-prompt/dark-mode.txt b/codex-prompt/dark-mode.txt deleted file mode 100644 index 492e894..0000000 --- a/codex-prompt/dark-mode.txt +++ /dev/null @@ -1,79 +0,0 @@ -TASK: Aggiungere Dark Mode globale con toggle nel footer (Flowbite + Tailwind). - -Vincoli: -- Usare Tailwind dark mode con strategia "class" (non media) -- Toggle nel footer visibile su tutte le pagine (layout globale) -- Stato persistente con localStorage -- Default: se non c’è preferenza salvata, usare prefers-color-scheme -- Nessun framework JS aggiuntivo -- Non rompere HTMX e Flowbite -- Accessibile (aria-label, stato, focus) - -1) Tailwind config -- Aggiornare tailwind.config.js: - - impostare `darkMode: 'class'` - - assicurarsi che content includa templates e node_modules/flowbite come già configurato - -2) JS globale -- Creare file /web/static/vendor/theme.js (o /web/static/js/theme.js se preferisci) con: - - all’avvio (prima del render visibile): - - leggere localStorage key `theme` ('dark'|'light') - - se non presente, leggere `window.matchMedia('(prefers-color-scheme: dark)')` - - applicare/rimuovere classe `dark` su (document.documentElement) - - esporre funzione toggleTheme() che: - - toggla classe `dark` - - salva preferenza in localStorage - - aggiorna label testo del bottone e aria-pressed - - gestire aggiornamento se l’utente non ha preferenza salvata e cambia prefers-color-scheme (listener matchMedia), opzionale ma gradito - -3) Includere theme.js nel layout -- In /web/templates/layout.html: - - includere theme.js nel prima del CSS per evitare FOUC: - - - poi link CSS e script htmx/flowbite come già presenti - - aggiungere classi base al body per dark: - - bg-white dark:bg-gray-900 - - text-gray-900 dark:text-gray-100 - - min-h-screen flex flex-col - - contenuto in main con flex-1 - -4) Footer + toggle button (Flowbite style) -- Nel footer del layout aggiungere un bottone: - - posizionato a destra (o center se preferisci) con icona (testo va bene senza icone) - - classi Flowbite/Tailwind: - - px-3 py-2 text-sm font-medium rounded-lg - - bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700 - - attributi accessibilità: - - id="themeToggle" - - type="button" - - aria-label="Toggle dark mode" - - aria-pressed="false" (aggiornato via JS) - - testo dinamico: "Dark mode" / "Light mode" o "Tema: Scuro/Chiaro" - -- Aggiungere onclick: - - onclick="window.toggleTheme && window.toggleTheme()" - -5) Aggiornare componenti base per dark -- Aggiornare /web/templates/components/navbar.html (se esiste) e altri partial principali con classi dark: - - Navbar: bg-white dark:bg-gray-900, border-gray-200 dark:border-gray-700 - - Dropdown: bg-white dark:bg-gray-800, text colors - - Cards: bg-white dark:bg-gray-800 - - Tables: dark divide colors -Non serve perfezione totale, ma assicurare leggibilità. - -6) README -- Aggiornare README con nota: - - dark mode persistente in localStorage key "theme" - -7) Criteri di accettazione -- Il toggle è visibile nel footer su tutte le pagine -- Il tema persiste al reload -- Default segue prefers-color-scheme se non impostato manualmente -- Nessun flash di tema sbagliato (FOUC minimizzato) -- Non rompe Flowbite JS, modals, dropdown e HTMX -- Accessibile: bottone focusable e aria-pressed aggiornato - -Esegui: -- make tw-build (o make tw-watch per verificare) -- Avvia server e verifica cambio tema su /login e /users. -Correggi eventuali classi mancanti. \ No newline at end of file diff --git a/codex-prompt/flowbite-convert.txt b/codex-prompt/flowbite-convert.txt deleted file mode 100644 index 4350ab7..0000000 --- a/codex-prompt/flowbite-convert.txt +++ /dev/null @@ -1,141 +0,0 @@ -TASK: Convertire tutti i template HTML esistenti per usare componenti Flowbite (markup + behavior JS) mantenendo logica MVC e HTMX. - -Non modificare controller, services, repo. -Modificare solo template e layout. - -------------------------------------- -1) LAYOUT GLOBALE -------------------------------------- - -Aggiornare /web/templates/layout.html: - -- Layout container moderno Tailwind -- Navbar Flowbite responsive con: - - Logo/AppName a sinistra - - Link: - - Public: Login / Signup - - Private: Dashboard / Users - - Admin: Admin (solo se role=admin) - - Dropdown utente con logout -- Include: - - - - -Struttura: -- Navbar top -- Container max-w-7xl mx-auto p-6 -- Footer minimale - -------------------------------------- -2) PUBLIC TEMPLATES -------------------------------------- - -Convertire: - -/web/templates/public/login.html -/web/templates/public/signup.html -/web/templates/public/forgot_password.html -/web/templates/public/reset_password.html - -Usare: -- Card Flowbite per form -- Input Flowbite style -- Button primary -- Alert Flowbite per flash messages -- Layout centrato verticalmente (flex items-center justify-center min-h-screen) - -------------------------------------- -3) PRIVATE USERS -------------------------------------- - -/web/templates/private/users/index.html - -- Header sezione con: - - Titolo - - Pulsante "Nuovo Utente" (modal Flowbite) -- Search input Flowbite -- Table Flowbite styled (striped, hover) -- Pagination button Flowbite -- Modal Flowbite per dettaglio utente - -Assicurarsi che: -- hx-get -- hx-target -- hx-swap -rimangano funzionanti - -------------------------------------- -4) ADMIN -------------------------------------- - -/web/templates/admin/dashboard.html -/web/templates/admin/users.html -/web/templates/admin/audit_logs.html - -Usare: -- Card summary (stats) -- Table Flowbite -- Badge per ruoli (admin = red, user = blue) -- Tabs Flowbite se presenti più sezioni - -------------------------------------- -5) FLASH MESSAGES -------------------------------------- - -Creare partial: -- /web/templates/components/flash.html - -Usare Flowbite alert component: -- success -> green -- error -> red -- warning -> yellow - -Includere in layout sopra {{embed}} - -------------------------------------- -6) MODAL STANDARD -------------------------------------- - -Creare partial riusabile: -/web/templates/components/modal.html - -Markup Flowbite standard con: -- id dinamico -- header con titolo -- body slot -- footer slot opzionale -- data-modal-toggle attributes - -Usare nelle pagine private. - -------------------------------------- -7) ACCESSIBILITÀ -------------------------------------- - -- Usare aria attributes corretti come in documentazione Flowbite -- Non rompere keyboard interaction -- Mantenere form method e csrf se presente - -------------------------------------- -8) RESPONSIVE DESIGN -------------------------------------- - -- Navbar collapse mobile -- Table scrollable mobile -- Forms full width mobile - -------------------------------------- -9) CRITERI DI ACCETTAZIONE -------------------------------------- - -- Tutte le pagine hanno layout moderno Flowbite -- Modals funzionano -- Dropdown funzionano -- Navbar responsive -- HTMX partial update continua a funzionare -- Nessuna modifica backend richiesta -- Nessun errore JS in console - -Scrivere codice pulito, leggibile, con commenti minimi. -Non eliminare logica Go template esistente. \ No newline at end of file diff --git a/codex-prompt/prompt-0.txt b/codex-prompt/prompt-0.txt deleted file mode 100644 index d668c41..0000000 --- a/codex-prompt/prompt-0.txt +++ /dev/null @@ -1,13 +0,0 @@ -Sei Codex in VS Code. Lavora direttamente nel workspace. - -Obiettivo: creare un boilerplate riusabile “GoFiber MVC + HTMX + Svelte Custom Elements UI kit + GORM + SQLite/Postgres + Auth + Email sink + CORS + template directory public/private/admin + role admin”. - -1) Scansiona il workspace e dimmi cosa esiste già. -2) Crea/aggiorna la struttura cartelle secondo questa convenzione: - /cmd/server - /internal/{app,config,http,middleware,db,models,repo,services,controllers,auth,mailer} - /web/{templates/{public,private,admin},emails/templates,static/{vendor,ui,css}} - /ui-kit - /data (solo dev) -3) Crea una TODO checklist in README.md con i passi rimanenti. -Non implementare ancora logica: solo struttura + README e .gitignore. \ No newline at end of file diff --git a/codex-prompt/prompt-1.txt b/codex-prompt/prompt-1.txt deleted file mode 100644 index 4e9ffa6..0000000 --- a/codex-prompt/prompt-1.txt +++ /dev/null @@ -1,24 +0,0 @@ -Implementa internal/config e internal/app. - -- Aggiungi internal/config/config.go: - - carica .env se presente (godotenv) - - espone Config con: AppName, Env (develop|prod), Port, BaseURL, BuildHash - DBDriver (sqlite|postgres), SQLitePath, PostgresDSN - CORS settings (origins/headers/methods/credentials) - SessionKey - SMTP settings + EmailSinkDir - Flags: AutoMigrate, SeedEnabled - - valida i campi essenziali (es. DB DSN se postgres) - -- Aggiungi internal/app/app.go: - - crea fiber.App - - registra CORS middleware - - registra session store - - init DB (internal/db) + migrate/seed (in base ai flag) - - registra router (internal/http/router.go) - - espone NewApp(cfg) (*fiber.App, error) - -- Aggiorna cmd/server/main.go per usare internal/app. - -Crea/aggiorna .env.example e .gitignore (escludi .env, /data, db sqlite, email sink). -Scrivi codice compilabile. \ No newline at end of file diff --git a/codex-prompt/prompt-10.txt b/codex-prompt/prompt-10.txt deleted file mode 100644 index 6a183b6..0000000 --- a/codex-prompt/prompt-10.txt +++ /dev/null @@ -1,20 +0,0 @@ -Aggiungi DX boilerplate. - -- Makefile: - - make dev (go run ./cmd/server) - - make ui-build (cd ui-kit && npm i && npm run build) - - make ui-dev (watch) - - make test (go test ./...) - - make db-reset (solo sqlite: rimuovi ./data/app.db) - - make fmt (gofmt) - -- docker-compose.yml: - - postgres service (porta 5432) - - env compatibile con DB_PG_DSN - -- README.md: - - Quickstart sqlite - - Quickstart postgres (docker compose) - - dove stanno templates public/private/admin - - email in develop: ./data/emails - - build UI kit \ No newline at end of file diff --git a/codex-prompt/prompt-2..txt b/codex-prompt/prompt-2..txt deleted file mode 100644 index 6ed10b8..0000000 --- a/codex-prompt/prompt-2..txt +++ /dev/null @@ -1,19 +0,0 @@ -Implementa internal/db (db.go, migrate.go, seed.go) con GORM. - -- db.go: Open(cfg) (*gorm.DB, error) con switch sqlite/postgres. - - sqlite usa cfg.SQLitePath, crea directory se serve. - - postgres usa cfg.PostgresDSN. - - logger più verboso in develop. - -- migrate.go: Migrate(db) che fa AutoMigrate su tutti i modelli (User, EmailVerificationToken, PasswordResetToken). - - esegui solo se cfg.AutoMigrate=true (gestisci in app.go o in migrate.go). - -- seed.go: Seed(db) idempotente se cfg.SeedEnabled=true: - - in develop crea: - - admin@example.com (role=admin, verified=true, password="password") - - user@example.com (role=user, verified=true, password="password") - - crea anche utenti demo aggiuntivi per tabella. - - usa upsert by email (GORM clauses OnConflict dove possibile). - - NON loggare password in chiaro. - -Aggiorna/crea internal/models con i modelli necessari. \ No newline at end of file diff --git a/codex-prompt/prompt-3.txt b/codex-prompt/prompt-3.txt deleted file mode 100644 index 4eb68f8..0000000 --- a/codex-prompt/prompt-3.txt +++ /dev/null @@ -1,19 +0,0 @@ -Implementa internal/models e internal/auth. - -- internal/models/user.go: - - User: ID, Email unique, PasswordHash, EmailVerified, Role (default user), timestamps. - -- internal/models/auth_tokens.go: - - EmailVerificationToken: UserID, TokenHash unique, ExpiresAt, timestamps - - PasswordResetToken: UserID, TokenHash unique, ExpiresAt, timestamps - -- internal/auth/passwords.go: - - HashPassword(plain) -> hash (bcrypt) - - ComparePassword(hash, plain) -> bool/error - -- internal/auth/tokens.go: - - NewToken() -> plainToken (base64url random 32+ bytes) - - HashToken(plainToken) -> hex/bytes SHA-256 string - - ExpiresAt helpers (verify 24h, reset 1h) - -Assicurati che nel DB venga salvato SOLO l’hash del token. \ No newline at end of file diff --git a/codex-prompt/prompt-4.txt b/codex-prompt/prompt-4.txt deleted file mode 100644 index 150cc69..0000000 --- a/codex-prompt/prompt-4.txt +++ /dev/null @@ -1,24 +0,0 @@ -Implementa internal/mailer. - -Requisiti: -- directory template email: /web/emails/templates - - verify_email.html + .txt - - reset_password.html + .txt - -- internal/mailer/templates.go: - - carica e renderizza template (html+txt) con dati: AppName, BaseURL, VerifyURL/ResetURL, UserEmail. - -- internal/mailer/mailer.go: - - interfaccia Mailer { Send(ctx, to, subject, htmlBody, textBody) error } - - factory NewMailer(cfg) che ritorna: - - sink mailer se cfg.Env==develop - - smtp mailer altrimenti - -- internal/mailer/sink.go: - - salva in cfg.EmailSinkDir file con timestamp__type__to.eml (o .txt/.html) - - includi subject, to, bodies e link. - -- internal/mailer/smtp.go: - - invio via SMTP usando cfg.SMTPHost/Port/User/Password/From/FromName. - -Aggiorna README con “in develop le email sono salvate in ./data/emails”. \ No newline at end of file diff --git a/codex-prompt/prompt-5.txt b/codex-prompt/prompt-5.txt deleted file mode 100644 index 49a9cd1..0000000 --- a/codex-prompt/prompt-5.txt +++ /dev/null @@ -1,14 +0,0 @@ -Aggiungi session e middleware. - -- Usa Fiber session middleware (cookie session). Configura key da cfg.SessionKey, cookie secure in prod, SameSite Lax, HttpOnly. - -- Implementa internal/http/middleware: - - RequireAuth: se non loggato redirect /login - - RequireAdmin: se role != admin -> 403 (pagina admin/forbidden o testo) - - CurrentUser helper (legge user_id da sessione, carica user da DB con repo) - -- Implementa flash messages (success/error) in sessione: - - SetFlashSuccess/SetFlashError - - ConsumeFlash middleware che aggiunge al template data - -Aggiorna layout.html per mostrare flash e navbar diversa per public/private/admin. \ No newline at end of file diff --git a/codex-prompt/prompt-6.txt b/codex-prompt/prompt-6.txt deleted file mode 100644 index b356f38..0000000 --- a/codex-prompt/prompt-6.txt +++ /dev/null @@ -1,27 +0,0 @@ -Implementa AUTH completo (server-rendered) e templates in /web/templates/public. - -Routes: -- GET/POST /signup -- GET/POST /login -- POST /logout -- GET /verify-email?token=... -- GET/POST /forgot-password -- GET/POST /reset-password?token=... - -Comportamento: -- Signup crea user (role=user, verified=false), genera verify token (hash in DB), invia email (mailer). -- Login: blocca se email non verificata. -- Verify-email: valida token, set EmailVerified=true, elimina token. -- Forgot-password: risposta sempre generica; se user esiste+verified, genera reset token e invia email. -- Reset-password: valida token, aggiorna password, elimina token. - -Crea templates: -- public/login.html -- public/signup.html -- public/forgot_password.html -- public/reset_password.html -- public/verify_notice.html -- public/home.html (opzionale) -Aggiungi partial per flash (public/_flash.html) e includilo nel layout. - -Usa repo/service per accesso DB e logica (non tutto nel controller). \ No newline at end of file diff --git a/codex-prompt/prompt-7.txt b/codex-prompt/prompt-7.txt deleted file mode 100644 index f6a0656..0000000 --- a/codex-prompt/prompt-7.txt +++ /dev/null @@ -1,22 +0,0 @@ -Implementa modulo “users” sotto /web/templates/private/users. - -Routes protette (RequireAuth): -- GET /users -> pagina con search + container tabella -- GET /users/table -> partial HTML tabella (htmx) -- GET /users/:id/modal -> partial HTML contenuto modal - -Requisiti tabella: -- query params: q, sort (id|name|email whitelist), dir (asc|desc), page, pageSize -- server-driven paging/sort/search usando GORM (Count + Limit/Offset + Order) -- _table.html deve includere: - - header th cliccabili con hx-get (toggle dir) - - pager prev/next con hx-get - - bottone “Apri” che hx-get sul modal e hx-target="#userModal" hx-swap="innerHTML" - - apri modal via JS minimal: setAttribute('open','') dopo swap (o onclick) - -Crea template: -- private/users/index.html -- private/users/_table.html -- private/users/_modal.html - -Integra nella index privata. \ No newline at end of file diff --git a/codex-prompt/prompt-8.txt b/codex-prompt/prompt-8.txt deleted file mode 100644 index 4a95663..0000000 --- a/codex-prompt/prompt-8.txt +++ /dev/null @@ -1,11 +0,0 @@ -Implementa area admin. - -Routes protette (RequireAuth + RequireAdmin): -- GET /admin -> admin/dashboard.html -- GET /admin/users -> pagina elenco utenti (server-rendered semplice) - -Templates: -- admin/dashboard.html -- admin/users.html - -Navbar nel layout deve mostrare link Admin solo se role=admin. \ No newline at end of file diff --git a/codex-prompt/prompt-9.txt b/codex-prompt/prompt-9.txt deleted file mode 100644 index b3a2ee2..0000000 --- a/codex-prompt/prompt-9.txt +++ /dev/null @@ -1,33 +0,0 @@ -Crea /ui-kit come progetto Vite + Svelte per custom elements. - -Requisiti: -- build deve scrivere direttamente in ../web/static/ui: - - ui.esm.js - - ui.css (tokens+base) -- src/index.ts registra: - - ui-modal - - ui-drop-down - - ui-data-table-shell (driver htmx per aggiornare un target) - -Componenti: -1) UiModal.svelte: - - - - attributi: title, open (boolean presence) - - close on ESC, backdrop click - - focus trap minimale - - emette evento "ui:close" (bubbles+composed) - - slot contenuto (HTMX swappa dentro al tag) - -2) UiDropDown.svelte: - - usa