You are browsing documentation for an outdated version.
See the latest documentation here.
Plugin Development - Introduction
Before going further, it is necessary to briefly explain how Kong is built,
especially how it integrates with Nginx and what Lua has to do with it.
lua-nginx-module enables Lua scripting capabilities in Nginx. Instead of
compiling Nginx with this module, Kong is distributed along with
OpenResty, which already includes lua-nginx-module.
OpenResty is not a fork of Nginx, but a bundle of modules extending its
Hence, Kong is a Lua application designed to load and execute Lua modules
(which we more commonly refer to as plugins) and provides an entire
development environment for them, including an SDK, database abstractions,
migrations, and more.
Plugins consist of Lua modules interacting with the request/response objects or
streams via the Plugin Development Kit (PDK) to implement arbitrary logic.
The PDK is a set of Lua functions that a plugin can use to facilitate interactions
between plugins and the core (or other components) of Kong.
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.