A production-ready Go backend starter template built with Fiber, GORM, and the Flowfull/Flowless ecosystem. This starter kit implements all 7 core concepts of Flowfull architecture.
- π Bridge Validation - Distributed session validation with Flowless
- π‘οΈ Validation Modes - Layered security (DISABLED, STANDARD, ADVANCED, STRICT)
- β‘ HybridCache - 3-tier caching (Ristretto β Redis β Database)
- π Trust Tokens - PASETO v4 tokens for secure authentication
- π― Auth Middleware - Flexible route protection (RequireAuth, OptionalAuth, RequireUserType)
- πΎ Multi-Database - Support for PostgreSQL, MySQL, and SQLite
- βοΈ Environment Config - Validated configuration with Viper
- Web Framework: Fiber v2 - Fast HTTP framework
- ORM: GORM - Multi-database ORM
- Cache: Ristretto + Redis
- Config: Viper - Configuration management
- Logging: Zap - Structured logging
- Tokens: PASETO - Secure tokens
- Validation: validator
flowfull-go-starter/
βββ cmd/
β βββ server/
β βββ main.go # Application entry point
βββ internal/
β βββ config/
β β βββ environment.go # Configuration with Viper
β βββ lib/
β β βββ auth/
β β β βββ bridge_validator.go # Bridge Validation
β β β βββ middleware.go # Auth Middleware
β β β βββ validation_mode.go # Validation Modes
β β β βββ types.go # Auth types
β β βββ cache/
β β β βββ hybrid_cache.go # HybridCache implementation
β β βββ database/
β β β βββ connection.go # Database connection
β β βββ tokens/
β β β βββ trust_tokens.go # PASETO tokens
β β βββ utils/
β β βββ logger.go # Zap logger
β βββ models/
β β βββ task.go # Example GORM model
β βββ routes/
β βββ health.go # Health check routes
β βββ api.go # API routes
βββ scripts/
β βββ generate_paseto_key.go # Generate PASETO keys
βββ .env.example # Environment variables template
βββ .gitignore
βββ .air.toml # Live reload config
βββ go.mod
βββ Makefile
βββ README.md
- Go 1.22+ - Download
- PostgreSQL/MySQL/SQLite - Choose your database
- Redis (optional but recommended)
# Clone the repository
git clone https://github.com/yourusername/flowfull-go-starter.git
cd flowfull-go-starter
# Install dependencies
make install
# Copy environment file
cp .env.example .envEdit .env with your settings:
# Server
PORT=3001
ENVIRONMENT=development
# Database
DATABASE_URL=postgresql://user:pass@localhost:5432/mydb
# Flowless Integration
FLOWLESS_API_URL=http://localhost:3000
BRIDGE_VALIDATION_SECRET=your-secret-key-min-32-chars
# Redis (optional)
REDIS_URL=redis://localhost:6379
# Auth Validation Mode
AUTH_VALIDATION_MODE=STANDARD # DISABLED | STANDARD | ADVANCED | STRICTmake generate-key
# Copy the generated private key to .env# With live reload
make dev
# Or without live reload
make build
make runThe server will start at http://localhost:3001
GET /health # Basic health check
GET /health/db # Database health
GET /health/cache # Cache health
GET /health/all # Complete health checkGET / # Service info
GET /api/public # Public endpoint (no auth)GET /api/protected # Protected endpoint
GET /api/profile # User profile
GET /api/tasks # List user tasks
POST /api/tasks # Create task
GET /api/tasks/:id # Get task
PUT /api/tasks/:id # Update task
DELETE /api/tasks/:id # Delete taskGET /api/optional # Works with or without authThis starter uses Bridge Validation with Flowless for authentication.
- User authenticates with Flowless
- Flowless generates a
session_id - Frontend sends
session_idin header:X-Session-Id - Backend validates with Flowless via Bridge Validation
- Session is cached in HybridCache (Ristretto + Redis)
- Subsequent requests use cached session (sub-millisecond latency)
curl -H "X-Session-Id: your-session-id" \
http://localhost:3001/api/protectedConfigure security level in .env:
AUTH_VALIDATION_MODE=STANDARD| Mode | IP Check | User-Agent | Device ID | Use Case |
|---|---|---|---|---|
| DISABLED | β | β | β | Development only |
| STANDARD | β | β | β | Basic security |
| ADVANCED | β | β | β | Recommended |
| STRICT | β | β | β | High security |
- Cache Hit Rate: >95% (Ristretto + Redis)
- Auth Latency (cached): <1ms (Ristretto)
- Auth Latency (Redis): <5ms
- Auth Latency (Bridge): <50ms
- Throughput: >50k req/s with cache
# Run tests
make test
# Run tests with coverage
make test-coverage
# Run linter
make lint
# Format code
make fmtmake help # Show all commands
make install # Install dependencies
make dev # Run with live reload
make build # Build binary
make run # Run binary
make test # Run tests
make lint # Run linter
make clean # Clean artifacts
make generate-key # Generate PASETO key# Build image
make docker-build
# Run with docker-compose
make docker-up
# Stop
make docker-downFor detailed documentation, see the /docs folder or visit:
Contributions are welcome! Please read CONTRIBUTING.md for details.
MIT License - see LICENSE for details.
Built with the Flowfull/Flowless ecosystem.
Made with β€οΈ by the Pubflow Team