Examples & Recipes
Learn GoFr by example. Each recipe is a working project you can clone and run.
Examples live under gofr/examples — pick any subfolder and run go run main.go.
Start here
HTTP Server
Basic REST API server with CRUD endpoints, Redis caching, and structured responses.
gRPC Server
Build a gRPC service with protocol buffers, streaming, and automatic observability.
Publisher
Publish messages to Kafka, Google Pub/Sub, NATS, or MQTT with a unified API.
HTTP Server
Basic REST API server with CRUD endpoints, Redis caching, and structured responses.
gRPC Server
Build a gRPC service with protocol buffers, streaming, and automatic observability.
Publisher
Publish messages to Kafka, Google Pub/Sub, NATS, or MQTT with a unified API.
Subscriber
Subscribe to message topics with automatic offset management and error handling.
HTTP Server with Redis
REST API backed by Redis for caching and session management.
REST Handlers
Auto-generate CRUD endpoints by implementing the REST interface.
Data Migrations
Run versioned schema migrations across MySQL, PostgreSQL, Redis, and MongoDB.
GraphQL API
Schema-first GraphQL with resolvers, playground, and built-in observability.
WebSocket
Real-time bidirectional communication with WebSocket support.
Cron Jobs
Schedule recurring tasks with cron expressions and automatic metrics.
Custom Metrics
Publish application-specific Prometheus metrics alongside built-in observability.
HTTP Service Communication
Make inter-service HTTP calls with circuit breaker and retry support.
Auth Middleware
Protect endpoints with Basic Auth, API Key, or OAuth middleware.
File Handling
Upload, download, and manage files with local, S3, GCS, or FTP backends.
File Binding
Bind uploaded files directly to structs for type-safe file processing.
HTML Templates
Serve server-rendered HTML pages with Go template support.
CLI Application
Build command-line tools with subcommands, flags, and structured output.