Home>Catalyst 101>Deploying your first function on Catalyst

Deploying your first function on Catalyst

catalyst usecase author
Srilakshmi | Technical writer

Inside the Cookbook

    • Install the Catalyst CLI
      • Initialize a Catalyst project
        • What is Basic IO?
          • What is the Crypto Module?
            • Test locally
              • Deploying to the cloud
                • And you’re done!

                  This chapter will walk you through the process of deploying your very first function in Catalyst. You’ll learn:

                  • How to structure a function for deployment.

                  • The steps to deploy and test it.

                  • How triggers work and when to use them.


                  By the end, you'll have a fully working backend function deployed, callable, and integrated into your workflow all without managing a single server.

                  Curious how it works? Check out the deployed function here.

                  Let’s begin with the fundamentals.

                  Catalyst account: If you don’t already have one, sign up here.

                  Node.js: The recommended version for Catalyst is Node.js v12+. You can download it here.

                  Install the Catalyst CLI

                  If you haven't already, install the Catalyst CLI & Login

                  npm install -g catalyst-cli  
                  catalyst login  

                   

                  Follow the link that opens in your browser and log in with your Catalyst account.

                  Initialize a Catalyst project

                  Check out this doc for further reference

                  Create a new folder and initialize your project:

                  
                  mkdircatalyst-fn
                  cd catalyst-fn
                  catalyst init 

                   

                  During the setup:

                  • Choose Function as the component.

                  • Select Basic IO as the function type.

                  • When prompted for the runtime, select Node.js.

                  We choose Basic IO because it provides the simplest and most flexible structure for handling HTTP requests and responses in a Catalyst function. It’s ideal when you want complete control over the request and response flow, such as reading input data, processing it, and returning a custom response.

                  What is Basic IO?

                  Basic IO (Input/Output) is a function type in Catalyst that allows you to:

                  • Receive input data (like JSON, form data, query params) from an HTTP request.

                  • Process that data using your logic in the function.

                  • Send back a custom response in the format you choose (JSON, text, etc.).

                  In this function, we will generate a unique UUID using Node.js’s Crypto module. The function returns the UUID in a JSON response, handles any errors gracefully, and ensures the process closes properly after execution. This is useful for creating secure, unique identifiers for tasks like session management, resource labeling, or tracking.

                  What is the Crypto Module?

                  The crypto module in Node.js is part of the core libraries, which means it is built into Node.js and does not require any external dependencies. It provides functionalities for performing various cryptographic operations, such as:

                  • Creating secure random numbers and keys

                  • Hashing data to produce fixed-size digests (e.g., SHA-256, SHA-512)

                  • Encrypting and decrypting data using symmetric (AES, DES) and asymmetric (RSA, ECDSA) algorithms

                  • Generating cryptographic signatures and verifying them

                   

                  Since it’s built-in, you can use it directly in your script:

                  Copy paste this your Node.js function

                  
                  
                  const { randomUUID } = require('crypto');
                  
                  module.exports = (context, basicIO) => {
                      try {
                          const uuid = randomUUID();
                  
                          const response = {
                              message: "✅ UUID generated successfully.",
                              uuid: uuid
                          };
                  
                          basicIO.write(JSON.stringify(response)); // ✅ Convert object to string
                          console.log(`Generated UUID: ${uuid}`);
                      } catch (err) {
                          const errorResponse = {
                              message: "⚠️ An error occurred while generating UUID.",
                              error: err.message
                          };
                  
                          basicIO.write(JSON.stringify(errorResponse)); // ✅ Convert error object to string
                          console.error('UUID generation error:', err);
                      } finally {
                          context.close();
                      }
                  };
                  
                    

                   

                  Test locally

                  Before pushing your code live, it's good to test it locally.

                  Run:

                  catalyst serve 

                   

                  Catalyst spins up a local server.

                  Everything working? Great—let’s go live.

                  Deploying to the cloud

                  When you're ready to push your function to the Catalyst cloud,

                  run:

                  catalyst deploy 

                   

                  Catalyst uploads your function and gives you a public URL where your code is now live. You can use it from a frontend app, test it with curl, or call it from other Zoho services.

                  For example:

                  https://demo-875627827.development.catalystserverless.com/server/sampleapp/execute

                  And you’re done!

                  • In just a few steps, you’ve created a live, cloud-hosted backend function without worrying about infrastructure. It’s lightweight, fast, and perfect for building small services, automation tasks, and APIs.

                  • From here, you can connect to Catalyst's built-in data store, trigger functions on events, add user authentication, or chain multiple functions together to build more powerful backends.