Skip to main content

The Recipes Cookbook

ยท 4 min read
Fiber Team
Maintainers

Documentation tells you what an API does. Blog posts explain the why. But when you need to build something real - authentication with JWT, deployment to AWS, a WebSocket chat, a CRUD app with Postgres - what you really want is working code you can copy and adapt.

That is what the Fiber Recipes repository is. Over 70 complete, runnable example projects covering everything from "Hello World" to clean architecture with Docker, OAuth2, and Kubernetes. Every recipe is a self-contained Go project with its own go.mod, main.go, and README.

Where to Find Themโ€‹

The recipes live in two places:

Recipes by Categoryโ€‹

Authenticationโ€‹

RecipeWhat It Shows
auth-jwtSimple JWT authentication
auth-docker-postgres-jwtJWT + Docker + Postgres - full stack
firebase-authFirebase authentication integration
oauth2GitHub OAuth2 flow
oauth2-googleGoogle OAuth2 flow
todo-app-with-auth-gormTodo app with auth and GORM

If you need authentication in your Fiber app, start with auth-jwt for the simplest case or auth-docker-postgres-jwt for a production-like setup.

Databasesโ€‹

RecipeWhat It Shows
gormGORM with SQLite
gorm-postgresGORM with PostgreSQL
gorm-mysqlGORM with MySQL
mongodbMongoDB driver
ent-mysqlEnt ORM with MySQL
sqlcType-safe SQL with sqlc
sqlboilerSQLBoiler ORM
postgresqlRaw PostgreSQL driver
mysqlRaw MySQL driver
neo4jNeo4j graph database
memgraphMemgraph graph database

Deploymentโ€‹

RecipeWhat It Shows
docker-nginx-loadbalancerDocker + Nginx load balancing
docker-mariadb-clean-archDockerized MariaDB with Clean Architecture
k8sKubernetes deployment
aws-ebAWS Elastic Beanstalk
aws-sam-containerAWS SAM containerized
cloud-runGoogle Cloud Run
herokuHeroku deployment
vercelVercel deployment
seenodeSeenode cloud platform
cloudflare-workersCloudflare Container Workers

Real-Timeโ€‹

RecipeWhat It Shows
websocketBasic WebSocket communication
websocket-chatReal-time chat app
socketioSocket.io chatroom
sseServer-Sent Events

Architecture Patternsโ€‹

RecipeWhat It Shows
clean-architectureClean Architecture in Go
clean-codeClean Code patterns
hexagonalHexagonal Architecture with MongoDB

Securityโ€‹

RecipeWhat It Shows
csrfCSRF protection
csrf-with-sessionCSRF + session management
https-tlsHTTPS with TLS
https-pkcs12-tlsHTTPS with PKCS12 certificates
autocertAutomatic TLS certificate management

How to Use a Recipeโ€‹

Every recipe follows the same pattern:

# Clone the recipes repository
git clone https://github.com/gofiber/recipes.git
cd recipes

# Pick a recipe
cd auth-jwt

# Read the README
cat README.md

# Run it
go run .

Most recipes start a server on :3000. Some require Docker for databases - the README tells you what you need.

Building on Recipesโ€‹

Recipes are starting points, not finished applications. The typical workflow:

  1. Find a recipe that matches your use case
  2. Copy it into your project (or use it as reference)
  3. Adapt the code to your needs
  4. Add production concerns (error handling, logging, config)

The clean-architecture and hexagonal recipes are especially useful as project templates - they show how to structure a larger Fiber application with layers, interfaces, and dependency injection.

Contributing Recipesโ€‹

If you have built something interesting with Fiber, the community would benefit from seeing it. The recipes repository accepts contributions following the existing pattern: one directory per recipe, a go.mod, a main.go, and a README.md that explains what the recipe demonstrates.

Internal Referencesโ€‹