Platforms

Google Cloud Functions

Running mion APIs on Google Cloud Functions for serverless deployments.

@mionjs/platform-gcloud provides a handler for Cloud Functions events.

Installing the Adapter

npm install @mionjs/platform-gcloud @mionjs/router

Creating the Handler

import {createGoogleCFHandler} from '@mionjs/platform-gcloud';
import './gcloud-routes.ts';

export const api = createGoogleCFHandler();

Deployment

Deploy with the gcloud CLI:

gcloud functions deploy api \
  --runtime nodejs22 \
  --trigger-http \
  --allow-unauthenticated

Adapter Options

Pass options such as maxBodySize (128 KB by default) and maxBodySizeCap to createGoogleCFHandler. maxBodySizeCap defaults to the 10 MB Google allows on a 1st gen function; override it on 2nd gen (32 MB). Set router options like basePath once in createMionRouter, and see Request Size for body limits.

import {createGoogleCFHandler} from '@mionjs/platform-gcloud';
import './gcloud-routes.ts';

export const api = createGoogleCFHandler({});
For faster cold starts, keep dependencies minimal. Consider Cloud Run for more control over the runtime.
Copyright © 2026