Complete Node.js Development Toolkit

Katax Ecosystem

Build production-ready APIs with type-safe validation, service management, and CLI scaffolding

3
Packages
100%
TypeScript
MIT
License
ESM
Modern

Ecosystem Projects

katax-core

Schema validation library for TypeScript/JavaScript

Features

  • ✓ Full TypeScript type inference
  • ✓ Async validation support
  • ✓ 8+ built-in schema types
  • ✓ Custom validators & transforms
  • ✓ Zero dependencies (except date-fns)

Installation

npm install katax-core
Version: 1.5.3

katax-service-manager

Runtime service container for Node.js applications

Features

  • ✓ Singleton service container
  • ✓ Auto .env loading
  • ✓ Logger with custom transports (Redis, Telegram, Callback)
  • ✓ Database connection pools (PostgreSQL, MySQL, MongoDB)
  • ✓ WebSocket & Cron services
  • ✓ Graceful shutdown handling

Installation

npm install katax-service-manager
Version: 0.5.0

katax-cli

CLI scaffolding tool for Express APIs with TypeScript

Features

  • ✓ Project scaffolding with Express + TypeScript
  • ✓ Generate endpoints, CRUD operations, docs
  • ✓ Built-in auth & stream utilities
  • ✓ Database support (PostgreSQL, MySQL, MongoDB)
  • ✓ Auto-integration with katax-core & katax-service-manager
  • ✓ Production-ready templates

Installation

npm install -g katax-cli
Version: 1.4.1

GitHub Copilot Skill

Get expert guidance for the entire Katax ecosystem directly in VS Code with our custom GitHub Copilot skill.

What You Get

  • Expert guidance for all 3 Katax packages
  • Bootstrap & service configuration examples
  • Validation patterns & best practices
  • Database, WebSocket, cron setup guides
  • Troubleshooting common issues

How to Install

1

Download the SKILL.md file from the button below

2

Place it in ~/.claude/skills/katax-ecosystem/ (Claude Desktop) or your Copilot skills folder

3

Restart VS Code and invoke with @katax-ecosystem

Example Usage
// In VS Code with GitHub Copilot
// Type: @katax-ecosystem how do I set up Redis logging?

// The skill provides context-aware guidance:
import { Katax } from 'katax-service-manager';

await Katax.getInstance().init({
  loadEnv: true,
  logger: {
    level: 'info',
    transports: {
      redis: {
        host: process.env.REDIS_HOST || 'localhost',
        port: parseInt(process.env.REDIS_PORT || '6379'),
        streamKey: 'app-logs',
        maxLen: 10000
      }
    }
  }
});

Quick Start

Validation

npm install katax-core

Type-safe schema validation

Services

npm install katax-service-manager

Runtime service container

Scaffolding

npm install -g katax-cli

Project generator tool

Complete Setup with CLI
# Install CLI globally
npm install -g katax-cli

# Create new API project
katax init my-api

# Generate a CRUD endpoint
katax generate-crud products

# Start development
npm run dev

Quick Examples

01. katax-core - Request Validation

TypeScript - Schema Validation
import { k, type kataxInfer } from 'katax-core';

const createUserSchema = k.object({
  name: k.string().minLength(2).maxLength(100),
  email: k.email().corporate(),
  age: k.number().min(18).max(100),
  roles: k.array(k.enum(['admin', 'user', 'moderator'] as const)),
  acceptedTerms: k.boolean().refine(val => val === true, {
    message: 'Must accept terms'
  })
});

// Type inference
type CreateUserData = kataxInfer<typeof createUserSchema>;

// In your Express handler
export async function createUser(req: Request, res: Response) {
  const result = createUserSchema.safeParse(req.body);
  
  if (!result.success) {
    return res.status(400).json({ errors: result.issues });
  }
  
  // result.data is fully typed
  const user = await database.createUser(result.data);
  res.status(201).json(user);
}

02. katax-service-manager - Bootstrap Setup

TypeScript - Service Container
import { Katax } from 'katax-service-manager';

// Initialize once at app startup
await Katax.getInstance().init({
  loadEnv: true,  // Auto-load .env file
  config: {
    port: process.env.PORT || 3000,
    env: 'production'
  },
  logger: {
    level: 'info',
    transports: {
      redis: {
        host: process.env.REDIS_HOST,
        streamKey: 'app-logs'
      }
    }
  },
  database: {
    type: 'postgresql',
    host: process.env.DB_HOST,
    port: parseInt(process.env.DB_PORT || '5432'),
    user: process.env.DB_USER,
    password: process.env.DB_PASSWORD,
    database: process.env.DB_NAME
  }
});

// Use anywhere in your app
const katax = Katax.getInstance();
katax.logger.info('Server starting');
const users = await katax.db.query('SELECT * FROM users');

// Graceful shutdown handled automatically
katax.onShutdown(async () => {
  katax.logger.info('Cleaning up...');
  await cleanupResources();
});

03. katax-cli - Generate Full API

Bash - CLI Commands
# Install CLI globally
npm install -g katax-cli

# Create new project with interactive prompts
katax init my-api
  ✓ Project name: my-api
  ✓ Validation: katax-core
  ✓ Database: PostgreSQL
  ✓ Auth: JWT
  ✓ WebSocket: Yes

# Generate CRUD endpoints
cd my-api
katax generate-crud products
  ✓ Created src/api/products/products.controller.ts
  ✓ Created src/api/products/products.handler.ts
  ✓ Created src/api/products/products.validator.ts
  ✓ Created src/api/products/products.routes.ts
  ✓ Updated src/router.ts

# Add custom endpoint
katax add-endpoint users/profile --method GET

# Generate OpenAPI documentation
katax generate-docs

# Start development
npm run dev
# Server running on http://localhost:3000

04. Complete Endpoint (All 3 Packages)

TypeScript - Handler with Validation & Services
import { Request, Response } from 'express';
import { k, type kataxInfer } from 'katax-core';
import { Katax } from 'katax-service-manager';

// Validation schema
const createProductSchema = k.object({
  name: k.string().minLength(3).maxLength(100),
  price: k.number().min(0),
  categoryId: k.number().integer(),
  tags: k.array(k.string()).optional()
});

type CreateProductData = kataxInfer<typeof createProductSchema>;

// Handler
export async function createProduct(req: Request, res: Response) {
  const katax = Katax.getInstance();
  
  // Validate request body
  const validation = createProductSchema.safeParse(req.body);
  if (!validation.success) {
    return res.status(400).json({ errors: validation.issues });
  }
  
  try {
    // Use database service
    const result = await katax.db.query(
      'INSERT INTO products (name, price, category_id) VALUES ($1, $2, $3) RETURNING *',
      [validation.data.name, validation.data.price, validation.data.categoryId]
    );
    
    // Log with service
    katax.logger.info('Product created', { productId: result.rows[0].id });
    
    // Broadcast via WebSocket
    katax.ws?.emit('product:created', result.rows[0]);
    
    return res.status(201).json(result.rows[0]);
  } catch (error) {
    katax.logger.error('Failed to create product', { error });
    return res.status(500).json({ error: 'Internal server error' });
  }
}

Available Schemas

String Schema

k.string()
  .minLength(3)
  .maxLength(50)
  .email()
  .url()
  .regex(/^[a-zA-Z]+$/)

Number Schema

k.number()
  .min(0)
  .max(100)
  .positive()
  .integer()

Date Schema

k.date()
  .min('2024-01-01')
  .max('2024-12-31')
  .isFuture()
  .isPast()

Email Schema

k.email()
  .domain('company.com')
  .corporate()
  .noPlus()

Array Schema

k.array(k.string())
  .minLength(1)
  .maxLength(10)
  .unique()

File Schema

k.file()
  .image()
  .maxSize(5 * 1024 * 1024)
  .extensions(['.jpg'])

Resources