Introduction
Before building custom plugins, it is important to understand how Kong Gateway is built, how it integrates with Nginx, and how the high performance Lua language is used.
Lua development is enabled in Nginx with the lua-nginx-module. Instead of
compiling Nginx with this module, Kong is distributed along with
OpenResty, which includes the lua-nginx-module
.
OpenResty is not a fork of Nginx, but a bundle of modules extending its
capabilities.
Kong Gateway is a Lua application, designed to load and execute Lua modules, commonly referred to as plugins. Kong Gateway provides a broad plugin development environment including an SDK, database abstractions, migrations, and more.
Plugins consist of Lua modules interacting with request/response objects or
network streams to implement arbitrary logic. Kong Gateway provides a
Plugin Development Kit (PDK) which is a set of Lua functions that are used
to facilitate interactions between plugins, the Kong Gateway core, and other
components.
This guide will explore in detail the structure of plugins, what they can extend, and how to distribute and install them. For a complete reference of the PDK, see the Plugin Development Kit reference.