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