feat: add email notification service with SMTP support
Some checks failed
Build and Deploy GooSeek / build-and-deploy (push) Failing after 8m22s

- Create pkg/email package (sender, templates, types)
- SMTP client with TLS, rate limiting, async sending
- HTML email templates with GooSeek branding
- Integrate welcome + password reset emails in auth-svc
- Add limit warning emails (80%/100%) in llm-svc middleware
- Add space invite endpoint with email notification in thread-svc
- Add GetUserEmail helper in JWT middleware
- Add SMTP config to .env, config.go, K8s configmap

Made-with: Cursor
This commit is contained in:
home
2026-03-03 02:50:17 +03:00
parent 7a40ff629e
commit 52134df4d1
12 changed files with 767 additions and 92 deletions

View File

@@ -15,6 +15,7 @@ import (
"github.com/gooseek/backend/internal/llm"
"github.com/gooseek/backend/internal/usage"
"github.com/gooseek/backend/pkg/config"
"github.com/gooseek/backend/pkg/email"
"github.com/gooseek/backend/pkg/metrics"
"github.com/gooseek/backend/pkg/middleware"
"github.com/gooseek/backend/pkg/ndjson"
@@ -189,12 +190,24 @@ func main() {
})
})
emailSender := email.NewSender(email.SMTPConfig{
Host: cfg.SMTPHost,
Port: cfg.SMTPPort,
User: cfg.SMTPUser,
Password: cfg.SMTPPassword,
From: cfg.SMTPFrom,
TLS: cfg.SMTPTLS,
SiteURL: cfg.SiteURL,
SiteName: cfg.SiteName,
})
llmAPI := app.Group("/api/v1", middleware.JWT(middleware.JWTConfig{
Secret: cfg.JWTSecret,
AuthSvcURL: cfg.AuthSvcURL,
AllowGuest: false,
}), middleware.LLMLimits(middleware.LLMLimitsConfig{
UsageRepo: usageRepo,
UsageRepo: usageRepo,
EmailSender: emailSender,
}))
llmAPI.Post("/generate", func(c *fiber.Ctx) error {