Update README: document sqlc instead of GORM

This commit is contained in:
Christoph Haas 2026-03-29 14:47:48 +02:00
parent c4e3a31b69
commit 7cdc561dcc

View file

@ -13,7 +13,7 @@ A self-sufficient web application to manage an ISPmail (Postfix, Dovecot, Rspamd
## Tech Stack
- **Backend**: Go with Gin framework, GORM for database
- **Backend**: Go with Gin framework, sqlc for type-safe SQL
- **Frontend**: SvelteKit
- **Database**: MariaDB/MySQL (shared with mail server ISPmail schema)
- **Auth**: JWT-based authentication
@ -40,7 +40,9 @@ imc-vibe/
│ │ └── handlers/ # HTTP handlers
│ ├── auth/ # JWT authentication
│ ├── config/ # Configuration loading
│ ├── db/ # Database models and operations
│ ├── db/ # Database access layer
│ │ ├── queries/ # SQL query files (sqlc source)
│ │ └── sqlc/ # Generated type-safe Go code
│ └── mail/ # Mail server integration (postqueue, logs, quota)
├── frontend/ # SvelteKit frontend
│ ├── src/
@ -121,6 +123,26 @@ The app creates these tables automatically:
Existing ISPmail tables (`virtual_domains`, `virtual_users`, `virtual_aliases`) are used for mail data.
### Database Access with sqlc
The app uses [sqlc](https://sqlc.dev/) for type-safe database access:
- SQL queries are defined in `backend/internal/db/queries/*.sql`
- Type-safe Go code is generated with `sqlc generate` into `backend/internal/db/sqlc/`
- **Do not edit files in `sqlc/`** - they are regenerated from queries
To regenerate after changing queries:
```bash
cd backend && sqlc generate
```
Enable SQL query logging in development:
```bash
USE_EMBEDDED=false ./build/imc
```
## Systemd Service
Example service file at `/etc/systemd/system/imc.service`:
@ -151,6 +173,7 @@ WantedBy=multi-user.target
- Go 1.21+
- Bun (for frontend development)
- sqlc (for database code generation)
- MariaDB/MySQL
- Postfix (with postqueue/postsuper)
- systemd-journald (for log viewing)