Plugin Development
Plugins let you add features to IGC CMS that become part of your site — new
block types, new pages, admin screens, background logic, and data sources
backed by your own database tables. They're written in TypeScript and run on
the server. IGC CMS ships with two working examples, blog and ecommerce,
that you can read and copy.
What a plugin can add
- Block types — a renderer and a settings panel, so the block shows up in the page builder like any built-in one.
- API routes — endpoints under
/api/plugins/<your-plugin>/…. - Admin screens and settings in the dashboard.
- Hooks — run code when something happens, such as after a post is saved.
- Data sources — create, read, update and delete rows in a database table, with per-action role rules, usable by data blocks in the builder.
How a plugin is laid out
plugins/
my-plugin/
plugin.json # name, version, entry file
backend/
index.ts # your plugin's code
... # split into more .ts files as you like
Use explicit .ts extensions in your imports (import "./helper.ts").
Installing a plugin
- While developing: put the plugin folder in the
plugins/directory next to the server and restart it. On startup the server logs what it loaded:plugins loaded: {"loaded":["blog","ecommerce","my-plugin"]}. - On a running site: upload the plugin as a ZIP from the admin plugins screen; it's picked up on the next restart.
Plugin code is read once when the server starts, so restart after editing it.
Checking it works
curl http://localhost:3000/api/plugins/my-plugin/<your-route>
should return your route's response — not a 404 or a 500. If the startup log
shows a load error, check that the entry file named in plugin.json exists and
that the plugin folder is in the directory the server is actually reading
plugins from.