Catalyst Configurations for AppSail Services

Although AppSail does not include many Catalyst-specific configurations or format restrictions, there are certain definitions that are bundled with your app containing information pertaining to hosting and executing the app. These are discussed below.

The app-config.json File

When you initialize an AppSail service from the CLI during project initialization or by adding it, Catalyst creates a configuration file app-config.json based on the input you provide. This file is created in the directory you initialize the app in, otherwise called the source directory.

Note: The app-config.json file is not created when you do a standalone deploy to deploy an app without initializing it. The information that this file carries is fetched as input from you in the CLI during the deployment.

An example of the default code of app-config.json created for a Java app is given below:

{ "command": "java -jar demo-0.0.1-SNAPSHOT.jar", "buildPath": "/Users/emma-426/CatalystDirectories/DemoApp", "stack": "java8", "env_variables": { "clientid":xxxxxxx, "clientsecret":xxxxxx}, "memory": 256, "platform": "javase" }

The parameters defined in this configuration file are explained in the next few sections.

Note: Catalyst enables you to select one of the two standard formats of the Java environment: Java SE and Java WAR. These are explained in this section. Therefore, the app-config.json file or configuration definitions for a Java app alone includes the additional parameter platform, which specifies the template. This definition will not be available for Python or Node.js apps.

Source Directory

  • By default, the source directory of your application is the directory that you execute the app initialization or app addition command from.

  • You can also select another directory besides the current directory to be the source during the initialization.

  • You must add the source files of your app in this directory.

  • The app-config.json file gets created in the source directory of your app.

  • The source directory can also be your Catalyst project directory. That is, you can initialize a project in your AppSail service’s root folder.

Build Path

  • The target directory is the directory that will contain the build files of your deployable application.

  • You can specify the target directory of your app through the parameter build-path when you initialize or add the app.

  • When you do a standalone deploy, the current directory will be the build directory.

  • Depending on the programming environment, the frameworks, and dependencies you build your app with, your deployable app could be a single file or multiple files. Some example file formats are discussed in this section.

  • You need not bundle or zip all the build files together, as AppSail will automatically bundle them during the application serve or deployment from the build-path specified.

  • You can name the main file of your app’s build anything you prefer. However, when you build your app as a Java WAR file, you will need to name the main file root.war. This is to ensure further configurations are prevented from your end when the endpoint URL is generated for your application. If you name your WAR file anything else, you will need to add some necessary controllers in your code accordingly.

Implementing Catalyst SDK in AppSail

Catalyst enables you to implement the SDK packages of the supported development environments in your AppSail applications. This enables you to avail other Catalyst services and components in your app’s functionality. You can implement the development SDKs of various programming environments in your app as specified below.


You can download the Catalyst Java SDK package from the Developer Tools settings in your Catalyst console and include it in your app’s source code. You can then initialize the Java SDK in your application’s code by adding this line as the first statement in your business logic:


Refer Catalyst Java SDK help for details about the various functionalities of the SDK toolkit and sample code snippets.


You can install the Catalyst Node.js SDK package by executing the following command in your terminal and including it in your app’s source code:

npm install zcatalyst-sdk-node

This will install the latest supported version of the Node.js SDK. You can also install a specific supported version in this way:

npm install zcatalyst-sdk-node@2.1.1

You can then initialize the Node.js SDK in your application’s code in the same way you would initialize it for an Advanced I/O function. Refer Catalyst Node.js SDK help for details. The SDK documentation also provides sample code snippets for all supported functionalities.


You can install Catalyst Python SDK for your AppSail solution by executing the following command in your terminal and including it in your app’s source code:

pip install zcatalyst-sdk

You can then import the Python SDK in your code for your Catalyst app. The SDK will need to be initialized with the request object before each request, and in the filter layer. An example code snippet for importing and initializing Python SDK in a Flask web app is shown below:

from flask import Flask, request, g import os import zcatalyst_sdk from zcatalyst_sdk.catalyst_app import CatalystApp app = Flask(__name__) @app.before_request def before_request(): if request.path.startswith('/admin'): return 'Unauthorized', 401 # if authorized user g.zc_app = zcatalyst_sdk.initialize(req=request) @app.route('/') def index(): return 'Web App with Python Flask!' @app.route('/cache') def cache(): app: CatalystApp = g.zc_app resp = app.cache().segment().put('key', 'value') return resp, 200 listen_port = os.getenv('X_ZOHO_CATALYST_LISTEN_PORT', 9000)'', port = listen_port)

Refer to Catalyst Python SDK help for details about the various functionalities of the SDK toolkit and sample code snippets.

Last Updated 2023-09-27 18:13:47 +0530 +0530