C
CanxJS
v1.6.2
  • Learn
  • Blog
  • Showcase
C
CanxJS

Ultra-fast async MVC backend framework for Bun. Build production-ready APIs with elegance and speed.

Resources

  • Documentation
  • Learn
  • Blog
  • Showcase

Documentation

  • Introduction
  • Installation
  • Core Concepts
  • CLI Commands
  • API Reference

Legal

  • Privacy Policy
  • Terms of Service

© 2026 CanxJS. All rights reserved.

Built with ❤️ for Candra Kirana

  • CLI Commands
  • API Reference
  • OpenAPI Spec
Specification

OpenAPI (Swagger)

Generate professional API documentation automatically using TypeScript decorators and OpenAPI 3.0.

Auto-Generated

Always up-to-date documentation.

Swagger UI

Built-in interactive documentation UI.

Auth Support

JWT, API Key, and OAuth2 support.

Decorators

Describe your API with metadata decorators.

Setup

main.ts
1import { createApp, SwaggerModule } from "canxjs";
2
3const app = createApp();
4
5const config = {
6 title: 'Canx API',
7 version: '1.0',
8 description: 'The API description'
9};
10
11const document = SwaggerModule.createDocument(config, [UserController]);
12SwaggerModule.setup('/api/docs', document);

Decorators

user.controller.ts
1import { Controller, Get } from "canxjs";
2import { ApiOperation, ApiResponse, ApiTags } from "canxjs/swagger";
3
4@ApiTags('users')
5@Controller('users')
6export class UserController {
7
8 @Get()
9 @ApiOperation({ summary: 'Get all users' })
10 @ApiResponse({ status: 200, description: 'Return all users.' })
11 findAll() {
12 return [];
13 }
14}

Models (DTOs)

create-user.dto.ts
1import { ApiProperty } from "canxjs/swagger";
2
3export class CreateUserDto {
4 @ApiProperty({ example: 'John' })
5 name: string;
6
7 @ApiProperty({ required: false })
8 age: number;
9}

AsyncAPI (Event-Driven)

Document your event-driven microservices using AsyncAPI decorators.

notification.controller.ts
1import { AsyncApiChannel, AsyncApiMessage } from "canxjs/features/AsyncApi";
2
3class NotificationController {
4
5 @AsyncApiChannel({
6 name: 'user/signedup',
7 publish: true
8 })
9 @AsyncApiMessage({
10 payload: UserSignedUpEvent,
11 summary: "User registration event"
12 })
13 handleUserSignup() {}
14}