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

  • Routing
  • Controllers
  • API Resources
  • Dependency Injection
  • Service Providers
  • Middleware
  • Request & Response
  • Authentication
  • Validation
  • Session
  • I18n
  • Utilities
Core Utilities

Utilities

Essential helper classes for common tasks like hashing, encryption, collections, and more.

Security Utilities

Use Bcrypt for secure password hashing.

hash.ts
1import { Hash } from "canxjs";
2
3// Hash a password
4const hashedPassword = await Hash.make("password123");
5
6// Verify a password
7if (await Hash.check("password123", hashedPassword)) {
8 // Passwords match
9}

Encryption

Two-way encryption using AES-256-CBC.

encrypt.ts
1import { Encrypt } from "canxjs";
2
3// Encrypt data
4const encrypted = Encrypt.make("Sensitive Data");
5
6// Decrypt data
7const decrypted = Encrypt.audit(encrypted);

Collections

Fluent wrapper for working with arrays of data, inspired by Laravel Collections.

collection.ts
1import { collect } from "canxjs";
2
3const users = [
4 { id: 1, name: "Alice", role: "admin" },
5 { id: 2, name: "Bob", role: "user" },
6];
7
8const admins = collect(users)
9 .where("role", "admin")
10 .map(user => user.name)
11 .all(); // ["Alice"]

Pipelines

Send an object through a series of "pipes" (middleware/actions).

pipeline.ts
1import { Pipeline } from "canxjs";
2
3const result = await Pipeline
4 .send(request)
5 .through([
6 AuthMiddleware,
7 ValidationMiddleware,
8 LoggingMiddleware
9 ])
10 .thenReturn();

API Versioning

Manage multiple versions of your API with ease.

app.ts
1import { ApiVersioning } from "canxjs";
2
3// In your app setup
4ApiVersioning.enable({
5 type: 'uri', // or 'header', 'media-type'
6 defaultVersion: 'v1',
7 prefix: 'v'
8});

Global Helpers

Convenient global functions available throughout your application.

HelperDescription
view(name, data)Render a JSX view
env(key, default)Get environment variable
abort(code, msg)Throw an HTTP exception
redirect(url)Create a redirect response

String Utilities

str.ts
1import { Str } from "canxjs";
2
3const slug = Str.slug("Hello World"); // "hello-world"
4const id = Str.randomUuid(); // "a1b2..."
5const random = Str.randomString(16); // "Ab3..."