# GoFiber MVC Boilerplate

Boilerplate GoFiber MVC + HTMX + Flowbite + GORM, con auth server-rendered, area private/admin e mail sink in sviluppo.

## Setup Assets + Server

Terminale 1:

```bash
npm i
make assets
make tw-watch
```

Terminale 2:

```bash
make server
```

Admin SPA (Quasar):
- il backend serve `quasar/admin_section/dist/spa` sotto `/admin` (protetto da auth + ruolo admin)
- build frontend admin: `cd quasar/admin_section && npm i && npm run build`

Private SPA (Quasar):
- il backend serve `quasar/private_section/dist/spa` sotto `/private` (protetto da auth)
- build frontend private: `cd quasar/private_section && npm i && npm run build`

`make assets` esegue:
- copia di `node_modules/flowbite/dist/flowbite.min.js` in `web/static/vendor/flowbite.js`
- build Tailwind in `web/static/css/app.css`

Dark mode globale:
- toggle nel footer su tutte le pagine
- preferenza persistente in `localStorage` con chiave `theme` (`dark`/`light`)
- fallback automatico a `prefers-color-scheme` quando non c'e una preferenza salvata

## Quickstart SQLite

```bash
cp .env.example .env
npm i
make assets
make server
```

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.

## Template Directories

- Public: `web/templates/public`
- Private: `quasar/private_section/dist/spa` (SPA servita da Go sotto `/private`)
- Admin: `quasar/admin_section/dist/spa` (SPA servita da Go sotto `/admin`)

## Email in Develop

In `develop`, le email vengono salvate in `./data/emails`.

## Make Targets

- `make tw-build` -> build Tailwind CSS
- `make tw-watch` -> watch Tailwind CSS
- `make flowbite-copy` -> copia `node_modules/flowbite/dist/flowbite.min.js` in `web/static/vendor/flowbite.js`
- `make assets` -> `flowbite-copy` + `tw-build`
- `make server` -> `go run ./cmd/server`
- `make test` -> `go test ./...`
- `make db-reset` -> reset DB sqlite locale (`./data/app.db` / `./data/app.sqlite3`)
- `make fmt` -> `gofmt` su `cmd/` e `internal/`
# Third-Party Notices

This project uses third-party software distributed under the MIT License.

## Flowbite
- Package: `flowbite`
- License: MIT
- Upstream: https://github.com/themesberg/flowbite
- Full text: `licenses/FLOWBITE-MIT.txt`

## Tailwind CSS
- Packages: `tailwindcss`, `@tailwindcss/cli`
- License: MIT
- Upstream: https://github.com/tailwindlabs/tailwindcss
