Skip to main content
Version: 1.47.0

Add Custom Functionality

If you want to extend Platformatic DB features, it is possible to register a plugin, which will be in the form of a standard Fastify plugin.

The config file will specify where the plugin file is located as the example below:

"plugins": {
"paths": ["./plugin/index.js"]

The path is relative to the config file path.

Since it uses fastify-isolate under the hood, all other options of that package may be specified under the plugin property.

Once the config file is set up, you can write your plugin

module.exports = async function (app) {'plugin loaded')
// Extend GraphQL Schema with resolvers
extend type Query {
add(x: Int, y: Int): Int
Query: {
add: async (_, { x, y }) => x + y

// Create a new route, see for more info'/sum', (req, reply) => {
const {x, y} = req.body
return { result: x + y }

// access platformatic entities data
app.get('/all-entities', (req, reply) => {
const entities = Object.keys(app.platformatic.entities)
return { entities }