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

  • Aspect-Oriented (AOP)
  • CQRS Architecture
  • GraphQL API
  • Tracing
  • Health Checks
Architecture

Aspect-Oriented Programming

Cross-cutting concerns made easy. Use Interceptors, Guards, and Pipes to decouple logic from your business code.

Interceptors

Intercept/transform requests and responses.

Guards

Determine if a request should be handled.

Pipes

Validate and transform input data.

Interceptors

Inspired by NestJS, interceptors allow you to wrap the execution stream. Perfect for logging, transformation, or caching.

logging.interceptor.ts
1import { createInterceptor, UseInterceptors } from "canxjs";
2
3// Define an Interceptor
4const LoggingInterceptor = createInterceptor(async (context, next) => {
5 console.log('Before...');
6 const now = Date.now();
7
8 const result = await next();
9
10 console.log(`After... ${Date.now() - now}ms`);
11 return result;
12});
13
14// Apply to Controller or Method
15@UseInterceptors(LoggingInterceptor)
16class CatsController {
17 // ...
18}

Guards

auth.guard.ts
1import { createGuard, UseGuards } from "canxjs";
2
3const AuthGuard = createGuard((context) => {
4 const req = context.getRequest();
5 return validateRequest(req);
6});
7
8@UseGuards(AuthGuard)
9class protectedController {}

Pipes

validation.pipe.ts
1import { ParseIntPipe, UsePipes } from "canxjs";
2
3@Post()
4@UsePipes(ParseIntPipe) // Transforms params automatically
5create(@Body() createCatDto: CreateCatDto) {
6 // ...
7}

Next Steps

Explore the validation system.