- Define models as structs with `gorm.Model` embedded — use `json` and `gorm` struct tags for column mapping and constraints.
- Use `Preload()` for eager loading associations and `Joins()` for inner joins — avoid N+1 queries by loading related models upfront.
- Use `db.Transaction(func(tx *gorm.DB) error {})` for multi-step operations — return an error to rollback, nil to commit.
- Use `Preload()` or `Joins()` to eager-load associations and prevent N+1 queries.
- Use `Scopes()` for reusable query conditions: `db.Scopes(ActiveUsers, RecentlyCreated).Find(&users)`.
- Wrap multi-table operations in `db.Transaction()` for atomicity.
- Use `Create`, `Save`, `Updates`, `Delete` — avoid raw SQL unless GORM can't express the query.