Skip to main content
This quickstart guides you through creating, validating, and deploying your first userscript based on a cookbook example.

Before you begin

Step 1: Set up your environment

Create a new TypeScript file for your userscript in your IDE (for example, userscript.ts). For IDE autocomplete and type-checking support, optionally add the Replicator TypeScript definitions. For details, refer to Access this API.

Step 2: Write a userscript

Use the userscript cookbook as a starting point. The cookbook provides ready-to-use examples that you can copy and adapt. Copy and adapt a cookbook example that matches your use case. For example, adapt the template to filter a single table to exclude the audit_logs table from the public schema during replication:
For details on the userscript API and handler functions, refer to the Userscript API.
When writing userscripts, follow the best practices.

Step 3: Use with Replicator

Include the --userscript flag to have MOLT Replicator apply the userscript. For example, to apply your userscript during PostgreSQL replication:

See also