Serverless Guide

Azure Functions + Meridian

Deploy serverless Meridian license validation at the edge. Validate keys, check hardware fingerprints, and enforce entitlements from Azure Functions with sub-50ms cold starts.

Quickstart

Install the Meridian SDK in your Azure Functions project, set your license key as an environment variable, and call the validation endpoint on each invocation.

npm install @getnimbus/meridian-sdk

// functions/validate-license.ts
import { Meridian } from "@getnimbus/meridian-sdk";

const meridian = new Meridian({
  apiKey: process.env.MERIDIAN_API_KEY!,
});

export async function run(context: Context, req: HttpRequest) {
  const { licenseKey, fingerprint } = req.body;
  const result = await meridian.validate({ licenseKey, fingerprint });

  return {
    status: result.valid ? 200 : 403,
    body: { tier: result.tier, expiresAt: result.expiresAt },
  };
}

Environment Variables

Store your Meridian API key in Azure Function App Settings. Never hardcode secrets.

VariableRequiredDescription
MERIDIAN_API_KEYYesYour Meridian dashboard API key
MERIDIAN_REGIONNoOverride API region (default: us-east)

Cold Start Optimization

Meridian SDK lazy-loads its crypto primitives. For the fastest cold starts, initialize the client outside your handler so it reuses the instance across warm invocations. Typical cold start with Meridian: 38ms on a Consumption plan.

Error Handling

Wrap validation in a try/catch. Network timeouts and invalid keys throw typed errors you can handle gracefully.

try {
  const result = await meridian.validate(payload);
} catch (err) {
  if (err instanceof Meridian.TimeoutError) {
    // fall back to cached validation
  }
}

Next Steps

Ready to go deeper? Explore hardware fingerprinting, offline grace caches, and tiered entitlements in the full Meridian documentation.

Browse All Docs →