Digital management system for loyalty cards, vouchers, and gift cards with sharing functionality
A modern web-based system for managing loyalty cards, discount vouchers, and prepaid gift cards. Features integrated barcode scanner, transaction history, and flexible sharing with other users.
Offline features:
ENABLE_CARDS - Enable/disable loyalty cards featureENABLE_VOUCHERS - Enable/disable vouchers featureENABLE_GIFT_CARDS - Enable/disable gift cards featureENABLE_LOCAL_LOGIN - Enable/disable email/password authenticationENABLE_REGISTRATION - Enable/disable user self-registration/api/v1/config endpoint/metrics endpoint):/health - Liveness probe (server running)/ready - Readiness probe (database connectivity)# 1. Clone repository
git clone <repository-url>
cd savvy
# 2. Configure environment variables
cp .env.example .env
# Edit .env with your settings
# 3. Start Docker containers (automatically builds everything)
make dev
# 4. Load test data (optional, in another terminal)
make seed
Application URL: http://localhost:8080
Note: Local development without Docker is not supported due to Vite proxy requirements. The Vite dev server requires access to
http://api:8080which only works in the Docker network. See DEVELOPMENT.md for details.
After seeding, the following test accounts are available (password: test123):
| Role | Description | |
|---|---|---|
[email protected] |
Admin | Has admin rights + own items |
[email protected] |
User | Has access to shared items |
[email protected] |
User | Has access to shared items |
[email protected] |
User | Has own items |
IMPORTANT: Always use Docker for development!
# β
RECOMMENDED: Start with Makefile (includes Hot Reload)
make dev
# This starts:
# - PostgreSQL (port 5432)
# - Go API with Air Hot Reload (port 8080)
# - Vite Dev Server with HMR (port 5173)
http://api:8080)See DEVELOPMENT.md for details.
# Development (Docker-based)
make dev # Start Docker development (alias for make up)
make up # Start Docker containers with hot reload
make down # Stop Docker containers
make restart # Restart containers
make rebuild # Rebuild containers
make logs # View API logs
make logs-all # View all container logs
# Database (runs in Docker)
make migrate-up # Apply migrations
make migrate-down # Rollback migration
make migrate-status # Check migration status
make seed # Seed test data
make db-shell # PostgreSQL shell
# Testing & Build
make test # Run all tests
make test-core # Run core tests (services + models)
make build # Build binary with embedded client
# Container Access
make shell # Application shell
All changes are automatically detected in Docker containers:
# Start Docker development environment
make dev # or: make up
# This provides automatic hot reload for:
# - SvelteKit Frontend: Vite HMR detects changes in client/src/
# - Go Backend: Air reloads on changes in internal/
# - Database: GORM AutoMigrate runs on server start
File locations:
client/src/ - SvelteKit components, stores, API clientsinternal/ - Go handlers, services, repositoriesinternal/models/ - GORM modelsinternal/handlers/api/ - JSON API handlersImportant: Always use Docker (make dev) - local npm/air commands won't work due to network requirements.
savvy/
βββ cmd/ # Application entrypoints
β βββ server/ # Main application server
β βββ seed/ # Database seeding script
β βββ migrate/ # Database migration tool
β βββ release-tool/ # Release version synchronization
β βββ e2e/ # E2E test server setup
β
βββ internal/
β βββ setup/ # Server initializationβ β βββ dependencies.go # DI container, database, telemetry
β β βββ routes.go # Route registration
β β βββ server.go # Echo configuration
β βββ config/ # Configuration management
β βββ database/ # Database connection & utilities
β βββ handlers/ # HTTP handlers (Controllers)
β β βββ api/ # JSON API handlersβ β β βββ cards.go # Cards API
β β β βββ vouchers.go # Vouchers API
β β β βββ gift_cards.go # Gift Cards API
β β β βββ notifications.go # Notifications API
β β β βββ dto.go # Data Transfer Objects
β β β βββ mappers.go # Model β DTO mapping
β β βββ shares/ # Share handler abstraction
β β βββ health.go # Health checks
β β βββ oauth.go # OAuth/OIDC handlers
β β βββ spa.go # SvelteKit SPA fallback
β βββ services/ # Business logic layer
β β βββ card_service.go
β β βββ voucher_service.go
β β βββ gift_card_service.go
β β βββ notification_service.go
β β βββ transfer_service.go
β β βββ authz_service.go
β β βββ container.go # Service DI container
β βββ repository/ # Data access layer (GORM)
β βββ models/ # GORM models
β β βββ user.go
β β βββ merchant.go
β β βββ notification.goβ β βββ card.go / voucher.go / gift_card.go
β β βββ *_share.go # Sharing models
β βββ middleware/ # HTTP middleware
β β βββ auth.go # Authentication
β β βββ cors.go # CORS configuration
β β βββ csrf*.go # CSRF protection
β β βββ security.go # Security headers
β β βββ ... # Other middleware
β βββ migrations/ # Database migrations (embedded)
β βββ mocks/ # Generated mocks for testing (mockery)
β βββ audit/ # Audit logging
β βββ metrics/ # Prometheus metrics
β βββ telemetry/ # OpenTelemetry integration
β βββ oauth/ # OAuth/OIDC implementation
β βββ security/ # Security utilities
β βββ i18n/ # Internationalization
β βββ validation/ # Input validation
β βββ debug/ # Debug utilities
β βββ assets/ # Embedded client build
β βββ client/ # SvelteKit build output
β
βββ client/ # SvelteKit Frontendβ βββ src/
β β βββ routes/ # SvelteKit pages
β β β βββ +page.svelte # Dashboard
β β β βββ cards/ # Cards routes
β β β βββ vouchers/ # Vouchers routes
β β β βββ gift-cards/ # Gift cards routes
β β β βββ admin/ # Admin panel
β β βββ lib/
β β β βββ components/ # Reusable Svelte components
β β β βββ api/ # API client modules
β β β βββ stores/ # Svelte stores (auth, offline, i18n)
β β β βββ utils/ # Helper functions
β β β βββ i18n/ # Translations (DE, EN, FR)
β β β βββ types/ # TypeScript types
β β βββ tests/ # E2E tests (Playwright)
β β βββ hooks.client.ts # SvelteKit client hooks
β β βββ app.html # HTML template
β βββ static/ # Static assets (favicon, etc.)
β βββ vite.config.ts # Vite configuration
β βββ playwright.config.ts # Playwright E2E test config
β βββ package.json # Node.js dependencies
β βββ tsconfig.json # TypeScript config
β
βββ deploy/ # Deployment configurations
β βββ helm/ # Helm charts for Kubernetes
β βββ kustomize/ # Kustomize overlays
β βββ grafana/ # Grafana dashboards
β βββ observability/ # Observability stack (Prometheus, Loki)
β
βββ .air.toml # Hot reload config (Air)
βββ .golangci.yml # Go linter configuration
βββ .revive.toml # Revive linter configuration
βββ .mockery.yaml # Mock generation config
βββ .goreleaser.yaml # Release automation config
βββ docker-compose.yml # Docker services (dev)
βββ Dockerfile # Multi-stage build
βββ Makefile # Development commands
βββ go.mod / go.sum # Go dependencies
βββ CODE_OF_CONDUCT.md # Community guidelines
βββ OBSERVABILITY.md # Observability guide
βββ README.md # This file
| Component | Technology | Version | Purpose |
|---|---|---|---|
| Backend Framework | Echo | v4.15 | HTTP Router & Middleware |
| ORM | GORM | v1.31 | PostgreSQL Abstraction |
| Frontend | SvelteKit + TypeScript | 2.51 | Modern SPA Framework |
| Build Tool | Vite | 7.3 | Fast Build & Dev Server |
| Styling | TailwindCSS | 4.1 | Utility-First CSS |
| Database | PostgreSQL | 16 | Primary Data Store |
| Language | Go | 1.26 | Backend Language |
| Language | TypeScript | 5.9 | Frontend Language |
| Feature | Technology | Purpose |
|---|---|---|
| Auth (Sessions) | Gorilla Sessions | Session-based Authentication |
| Auth (OAuth/OIDC) | go-oidc | OpenID Connect Provider |
| Barcode Scanning | @undecaf/zbar-wasm | WebAssembly Barcode Scanner |
| Barcode Generation | bwip-js | Server-side Barcode Rendering |
| Validation | go-playground/validator | Input Validation |
| i18n | go-i18n | Internationalization |
| Metrics | Prometheus | Application Metrics |
| Tracing | OpenTelemetry | Distributed Tracing |
| PWA | @vite-pwa/sveltekit | Service Worker & Offline |
| Service Worker | Workbox | Caching & Offline Strategies |
| Tool | Technology | Purpose |
|---|---|---|
| Hot Reload (Go) | Air | Go Auto-Reload |
| Hot Reload (Vite) | Vite HMR | Frontend Hot Module Replace |
| Unit Testing (Go) | testify | Go Test Assertions |
| Unit Testing (JS) | Vitest | Frontend Unit Tests |
| E2E Testing | Playwright | End-to-End Browser Tests |
| Mocking | Mockery | Mock Generation for Tests |
| Linting (Go) | golangci-lint + revive | Go Code Quality |
| Linting (TS) | svelte-check | TypeScript/Svelte Validation |
The application uses PostgreSQL with 12 main tables for users, merchants, cards, vouchers, gift cards, sharing, favorites, notifications, and audit logs.
For detailed database schema, ERD diagram, and table descriptions, see:
π ARCHITECTURE.md - Database Schema
See SECURITY.md for complete security policy and vulnerability reporting.
The application is designed for containerized deployment with Traefik reverse proxy for production use. Supports Docker Compose and Kubernetes (K3s/K8s).
Production Architecture:
Client (HTTPS) β Traefik (TLS) β Savvy (HTTP:8080) β PostgreSQL
For detailed deployment instructions, environment variables, Traefik configuration, and Kubernetes manifests, see:
π OPERATIONS.md - Deployment Guide
# Run all tests
make test
# Run core tests (services + models)
make test-core
# Run tests with coverage report
make test-coverage
# Run specific test (direct go test)
go test ./internal/models -run TestCard_GetColor
# Run tests with race detection
go test -race ./...
Coverage: 57.8% (Services), 54.1% (Handlers/API), 100.0% (Models), 97.2% (Repositories)
cd client
# Run unit tests
npm test
# Run tests with UI
npm run test:ui
# Run tests with coverage
npm run test:coverage
Coverage: 32.8% unit test coverage (19 tests, stores and utils)
cd client
# Install Playwright browsers
npm run playwright:install
# Run all E2E tests
npm run test:e2e
# Run tests in UI mode (interactive)
npm run test:e2e:ui
# Run tests with visible browser
npm run test:e2e:headed
# Run on specific browser
npm run test:e2e:chromium
# View test report
npm run playwright:report
Coverage: 75 E2E tests across 13 test suites covering authentication, CRUD operations, sharing, favorites, notifications, and admin panel.
We welcome contributions! Please see CONTRIBUTING.md for:
See CHANGELOG.md for full release history and breaking changes.
Need help? We have various support channels:
See also: CONTRIBUTING.md for contribution guidelines
MIT License - see LICENSE file for details.
Built with Go + Echo + SvelteKit + TypeScript + TailwindCSS
Deployed with Docker + PostgreSQL (Traefik recommended for production)