Serverless Functions & Webhooks

Extend the core capabilities of your database by running custom backend code and responding to system events in real time.

Serverless Functions

CredVault Functions allow you to deploy JavaScript or Python code directly to the edge, executed via HTTP requests without provisioning servers.

Functional Tiering

Your ability to execute functions scales with your billing tier:

  • Starter Tier: 100,000 executions/month (128MB Memory).
  • Pro Tier: 5,000,000 executions/month (512MB Memory, longer timeouts).
  • Enterprise: Unlimited executions, Dedicated resources, VPC Peering.

Creating a Function

Write a simple module and deploy it from your Dashboard or via the CLI:

export default async function(req, res, db) {
    // You get authenticated, direct access to your database instance in the context
    const recentSignups = await db.collection('users').find().sort({createdAt: -1}).limit(5);
    return res.json({ latest: recentSignups });
}

Webhooks

Don't poll the database—let the database notify you. Webhooks allow you to listen for specific events across the platform and trigger external systems.

Supported Events

  • document.created: Fired when a new record is inserted.
  • user.registered: Fired upon successful user signup.
  • cluster.scaling: Fired when a cluster automatically scales up due to traffic.
  • billing.invoice.paid: Fired for accounting synchronizations.

Security

CredVault signs all outbound Webhook payloads using a secret key. You can verify the X-CredVault-Signature header to guarantee that incoming HTTP requests genuinely originated from our servers.