Firebase
The Firebase Stack is a wrapper for the node client running on Cloud Functions for Firebase v2. The serverless function is designed to receive incoming walkerOS events via the HTTPS trigger, and send them to node destinations. It allows server-side data processing within an own infrastructure.
Features
- Event Ingestion: Receives incoming from clients via API.
- Data Validation: Ensures incoming data meets predefined schemas and data contracts.
- Event Processing: Enriches and transforms data before sending it to destinations server-side.
This stack is currently in beta. Please report any issues you encounter.
Installation
Read the official Get started guide for Firebase Cloud Functions, and install the Firebase CLI.
There is a demo setup for the Firebase stack available.
After creating a Firebase project, and a
new functions
code directory (e.g., by running firebase init functions
) install the
walkerOS Firebase Stack:
npm install @elbwalker/stack-firebase
In the firebase/functions/src/index.ts
file, import the Firebase Stack and
create a new instance:
import { firebaseStack } from '@elbwalker/stack-firebase';
const { elb, push } = firebaseStack({
// see Configuration
});
The firebaseStack
returns the created node client instance
, and two
functions:
elb
to configure the instance using node commandspush
: A FirebaseHttpsFunction
function to export and deploy
Configuration
Set up the Stacks behavior using node commands.
elb('walker user', { session: createFingerprint() });
elb('walker destination', { push: console.log });
Deployment
Export the initially created push
function with the name (here ingest
) that
will be the publicly available endpoints name. The push
function accepts
a HttpsOptions
config.
export const ingest = push({ cors: true, region: 'europe-west1' });
To deploy the function run:
firebase deploy --only functions