Maybe you were looking for the Enterprise Documentation instead?
Careful! You are browsing documentation for an outdated version of Kong. Go here to browse the documentation for the latest version.

Table of Contents


As mentioned many times in this guide, Kong heavily relies on your modules being available in your LUA_PATH under specific names.

As already mentioned in the [file structure] chapter, we make Kong aware that it has to look for your plugin’s modules by adding it to the plugins_available property in your configuration file. Example:

  - key-auth
  - rate-limiting
  - my-custom-plugin # your plugin name here

Kong will now look for modules named:


You need to make these modules available in your LUA_PATH.

Distribute your modules

The preferred way to do so is to use Luarocks, a package manager for Lua modules. It calls such modules “rocks”. Your module does not have to live inside the Kong repository!, but it can be if that’s how you’d like to maintain your Kong setup.

By defining your modules (and their eventual dependencies) in a rockspec file, you can install those modules on your platform via Luarocks. You can also upload your module on Luarocks and make it available to everyone!

Here is an example rockspec which would use the “builtin” build type to define modules in Lua notation and their corresponding file:

package = "my-kong-plugin"
version = "1.0-1"
source = {
  url = "..."
description = {
  summary = "A Kong plugin.",
  license = "MIT/X11"
dependencies = {
  "lua ~> 5.1"
  -- If you depend on other rocks, add them here
build = {
  type = "builtin",
  modules = {
    [""] = "/path/to/api.lua",
    [""] = "/path/to/daos.lua",
    [""] = "/path/to/handler.lua",
    [""] = "/path/to/migrations.cassandra.lua",
    [""] = "/path/to/schema.lua"

Learn more about creating your rockspec here.