Instructions to configure Typescript in Catalyst NodeJS advancedio function

Instructions to configure Typescript in Catalyst NodeJS advancedio function

Prerequisites: Catalyst CLI should be installed and a Catalyst project should be initialized in a folder in your local machine.
Then you can follow the below steps:
1. Create a new advanced function by running the command from your project directory
  1. catalyst functions:add
2. Navigate inside your function directory (functions/{your function name}) and then run the command 
  1. npm install typescript --save-dev  
  2. npm i --save-dev @types/express  
3. Create a folder named src and create an index.ts file inside it.
4. You can code your logic in index.ts (you can also refer the code snippet at the end)
5. Include the below script in package.json before “dependencies” key.

For MacOS & Linux :
  1. "scripts": {
  2. "init":"./node_modules/.bin/tsc --init",
  3. "build": "./node_modules/.bin/tsc",
  4. "watch": "./node_modules/.bin/tsc --watch"
  5. }
For Windows :
  1. "scripts": {
  2. "init":"node_modules\\.bin\\tsc --init",
  3. "build": "node_modules\\.bin\\tsc",
  4. "watch": "node_modules\\.bin\\tsc --watch"
  5. }
6. Run the below command to initialise the typescript project
  1. npm run init
7. Modify the below fields in tsconfig.json
  1. "rootDir": "./src", 
  2. "outDir": "./build"  
Add your remaining configurations
8. Create a folder named build inside functions/{your_function_name} directory and modify the below code in your catalyst-config.json
  1. "execution": {
  2. "main": "build/index.js"
  3. }
9. Include the below script inside functions key in catalyst.json file present in your root directory

For MacOS & Linux :
  1. "scripts": {
  2. "{your function name}": "cd {your function name} && rm -rf build && npm run build",
  3. "preserve": "catalyst run functions:{your function name}",
  4. "predeploy": "catalyst run functions:{your function name}"
  5. }
For Windows :
  1. "scripts": {
  2. "{your function name}": "cd {your function name} && del build\\* && npm run build",
  3. "preserve": "catalyst run functions:{your function name}",
  4. "predeploy": "catalyst run functions:{your function name}"
  5. }
10. Navigate to your (functions/{your function name}) directory in the terminal and run the command
  1. npm run watch
11.Open another terminal window and navigate to your project directory in the terminal and run the command in order to serve your function
  1. catalyst serve 
You can run catalyst deploy in order to deploy your application to the development environment.

// sample index.ts code snippet for reference
  1. "use strict";
  2. import catalyst from "zcatalyst-sdk-node";
  3. import express, { Express, Request, Response } from "express";
  4. const app: Express = express();
  5. app.use((req, res, next: any) => {
  6.   console.log("Req", req.method);
  7.   res.header("Access-Control-Allow-Origin", "*");
  8.   next();
  9. });
  10. app.post("/cache", async (req: Request, res: Response) => {
  11.   try {
  12.     const catalystApp = catalyst.initialize(req as Record<string, any>);
  13.     //Insert Cache by passing the key-value pair
  14.     let cache = catalystApp.cache();
  15.     let segment = cache.segment();
  16.     let cachePromise = segment.put("Name", "Linda McCartney");
  17.     cachePromise.then((entity) => {
  18.       console.log(entity);
  19.       res.status(200).send(entity);
  20.     });
  21.   } catch (err) {
  22.     res.status(500).send(err);
  23.   }
  24. });
  25. module.exports = app;

    • Announcements

    • [Webinar] Build smarter HR - Payroll Automation

      If your HR and payroll teams are still relying on manual exports, spreadsheet reconciliations, or constant back-and-forth coordination to keep employee data aligned, this session is for you. We’re hosting a live webinar featuring Kyle Ferrara , CTO of
    • [Webinar] How Raptee.HV accelerates its EV platform

      Curious about how EV platforms work behind the scenes? What does it actually take to run an EV platform from onboarding users to managing connected vehicles and deploying updates seamlessly? In this session, Raptee.HV shares how their platform is built
    • [Webinar] Deploy Docker apps with AppSail's custom runtime | Feb. 19

      Hi everyone, Join us on February 19, 2026 at 8–9 PM IST for a live Catalyst webinar demonstrating how to deploy OCI-compliant Docker images with AppSail's custom runtime. You’ll learn how to: Package your apps as Docker containers Deploy via CLI or connect
    • Catalyst backs Vite.js!

      Hi everyone, We're happy to support the open-source ecosystem that powers modern web development! If you’re building apps with Vite, Catalyst Slate is your go-to platform to deploy blazing-fast frontend apps with ease, scalability, and zero infrastructure
    • Catalyst QuickML 2025 Year In Review

      Hello everyone 👋 It’s been an exciting year for Catalyst QuickML. In 2025, as the Catalyst platform continued to expand its capabilities, QuickML focused on strengthening reliability, developer control, and operational readiness across the AI lifecycle.

      Catalyst Community