Welcome to the KrakenD Examples repository. This repository contains various examples demonstrating different features and configurations of the KrakenD API Gateway. Below you will find a list of the examples contained in this repository, along with a brief description and links to each example.
- Description: Provides a minimal configuration file and instructions to run KrakenD using Docker.
- Key Features: Basic configuration, single endpoint setup, Docker commands.
- Description: A complete demo environment built with Docker Compose, featuring multiple use-cases and integrations.
- Key Features: Demo setup, monitoring solutions, authentication integration, internal APIs for testing.
- Description: Demonstrates how to use the KrakenD debug endpoint to get detailed request and response logs.
- Key Features: Debugging service, parameter forwarding, detailed logs.
- Description: Example implementation of flexible configuration, including variables, templates, code snippets, and basic logic.
- Key Features: Docker setup, environment-based settings, immutable Docker artifact.
- Description: Illustrates how to handle multiple response encodings and consolidate them using KrakenD.
- Key Features: Aggregating responses, encoding consolidation.
- Description: Shows how to use KrakenD to aggregate data from multiple sources into a single endpoint.
- Key Features: Data aggregation, configuration examples.
- Description: Demonstrates traffic throttling features of KrakenD, including rate limiting and circuit breaker patterns.
- Key Features: Rate limiting, circuit breakers.
- Description: Example of connecting KrakenD with backends that require Basic Authentication.
- Key Features: Basic Authentication, backend configuration.
- Description: Integration with Moesif for API analytics and monetization.
- Key Features: API event tracking, subscription management, usage-based billing.
- Description: Proof of concept for custom rate limits based on user tiers using API keys.
- Key Features: Tiered rate limits, API key authentication.
- Description: Generates API documentation using Redocly and includes configuration examples.
- Key Features: API documentation generation.
- Description: A custom middleware plugin that uses the Redis connection pool configured in KrakenD Enterprise.
- Key Features: Go plugins (Enterprise), Redis connection pools.
- Description: A custom middleware plugin that charges the tokens of a streamed LLM response to a quota.
- Key Features: Go plugins (Enterprise), quotas, streaming.
- Description: AI Gateway examples: routing to several LLM providers, RAG, and MCP servers. See its README for the full list.
- Description: API governance with quotas per tier, backed by a single Redis instance and a Redis cluster.
- Key Features: Quotas, API keys, Redis clusters.
- Description: KrakenD as a gRPC client of upstream services (including a TLS one) and as a gRPC server.
- Key Features: gRPC client and server, protocol buffer catalog.
- Description: Various examples demonstrating Lua scripting in KrakenD for different use cases.
- lua_generate_header_from_host: Manipulate HTTP request headers dynamically using Lua scripting.
- lua_merge_grouby: Merge and group data from multiple sources.
- lua_soap_to_csv: Convert SOAP responses to different formats (JSON, XML, CSV).
- lua_merge_and_paginate: Merge and paginate data from multiple sources.
- lua_content_manipulation: The same content manipulation done with Lua, JMESPath, and
allow. - lua_sequential_merge: Enrich a response with data from another service, calling it from Lua.
- Description: Kafka integration: async agents, publisher and subscriber backends, with mTLS.
- Key Features: Kafka, async agents, PubSub.
- Description: Examples demonstrating multiple sequential POST calls in KrakenD.
- enterprise: Sequential POST calls using KrakenD Enterprise.
- community: Aggregating POST requests to SOAP backends.
- Description: OpenTelemetry exporting to Jaeger and, optionally, Datadog, plus custom plugins that add their own spans.
- Key Features: OpenTelemetry, Go plugins (Enterprise).
- Description: Middleware and response modifier plugins that manipulate a streamed response.
- Key Features: Go plugins (Enterprise), streaming.
plugins (deprecated)
- Description: Examples demonstrating how to build and inject custom plugins into KrakenD Community Edition. Deprecated: KrakenD CE 3.0 no longer supports Go plugins, so these only work with CE 2.x.
- Description: AI Gateway Prompt Guard blocking prompt injections, personal data, and custom policies.
- Key Features: Prompt Guard, metrics and traces.
- Description: Test environment for validating
X-KrakenD-Completedheaders andreturn_error_detailsconfiguration parameter. - Key Features: Error details, incomplete response handling.
- Description: Example integration of KrakenD with WebSocket protocol for real-time communication.
- Key Features: WebSocket configuration, real-time bi-directional communication, Socket.IO.
- Description: A backend for frontend that combines parallel and sequential calls with nested workflows.
- Key Features: Workflows, CEL, response body generator.
Each example is designed to showcase specific features and use cases of KrakenD, providing you with practical implementations and configurations to help you get the most out of your API Gateway setup. For more details, refer to the individual README files linked above.