prompt 10

This commit is contained in:
fabio
2026-02-22 18:01:37 +01:00
parent e069100c53
commit 81245535b3
6 changed files with 134 additions and 53 deletions

112
README.md
View File

@@ -1,64 +1,72 @@
# GoFiber MVC Boilerplate
Boilerplate riusabile per:
Boilerplate GoFiber MVC + HTMX + Svelte Custom Elements + GORM, con auth server-rendered, area private/admin e mail sink in sviluppo.
- GoFiber (MVC)
- HTMX
- Svelte Custom Elements (UI kit)
- GORM
- SQLite/Postgres
- Auth + ruolo `admin`
- Email sink
- CORS
- Template directory `public` / `private` / `admin`
In ambiente `develop`, le email vengono salvate in `./data/emails` (sink locale).
## UI Kit (Vite + Svelte CE)
Comandi:
## Quickstart SQLite
```bash
cd ui-kit
npm install
npm run dev
npm run build
cp .env.example .env
make dev
```
La build scrive direttamente in `web/static/ui`:
Default SQLite path: `./data/app.sqlite3`.
Comandi utili:
```bash
make test
make fmt
make db-reset
```
## Quickstart Postgres (Docker Compose)
```bash
docker compose up -d
cp .env.example .env
```
Configura `.env` così:
```env
DB_DRIVER=postgres
DB_PG_DSN=postgres://trustcontact:trustcontact@localhost:5432/trustcontact?sslmode=disable
```
`DB_POSTGRES_DSN` è comunque supportato.
## UI Kit Build
```bash
make ui-build
```
Per sviluppo UI:
```bash
make ui-dev
```
Output build in `web/static/ui`:
- `ui.esm.js`
- `ui.css`
## Struttura iniziale
## Template Directories
```text
.
├── cmd/
│ └── server/
├── internal/
│ ├── app/
│ ├── auth/
│ ├── config/
│ ├── controllers/
│ ├── db/
│ ├── http/
│ ├── mailer/
│ ├── middleware/
│ ├── models/
│ ├── repo/
│ └── services/
├── ui-kit/
├── web/
│ ├── emails/
│ │ └── templates/
│ ├── static/
│ │ ├── css/
│ │ ├── ui/
│ │ └── vendor/
│ └── templates/
│ ├── admin/
│ ├── private/
│ └── public/
└── data/ # solo sviluppo locale
```
- Public: `web/templates/public`
- Private: `web/templates/private`
- Admin: `web/templates/admin`
## Email in Develop
In `develop`, le email vengono salvate in `./data/emails`.
## Make Targets
- `make dev` -> `go run ./cmd/server`
- `make ui-build` -> install + build ui-kit
- `make ui-dev` -> watch UI con Vite
- `make test` -> `go test ./...`
- `make db-reset` -> reset DB sqlite locale (`./data/app.db` / `./data/app.sqlite3`)
- `make fmt` -> `gofmt` su `cmd/` e `internal/`