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
Data Graph

GraphQL

Build type-safe GraphQL APIs using the code-first approach. Define your schema using decorators.

Code First

Generate schema from TypeScript classes.

Type Safe

Types are shared between code and schema.

Federation

Build a data graph across services.

Resolvers

Class-based resolvers with DI.

Setup

app.ts
1import { createApp, GraphQLModule } from "canxjs";
2
3const app = createApp({
4 imports: [
5 GraphQLModule.forRoot({
6 autoSchemaFile: 'schema.gql', // Code-first
7 sortSchema: true,
8 playground: true
9 })
10 ]
11});

Object Types

user.type.ts
1import { ObjectType, Field, ID } from "canxjs";
2
3@ObjectType()
4export class User {
5 @Field({ type: ID })
6 id: string;
7
8 @Field()
9 name: string;
10
11 @Field({ nullable: true })
12 email?: string;
13}

Resolvers

user.resolver.ts
1import { Resolver, Query, Mutation, Args, ID } from "canxjs";
2
3@Resolver(User)
4export class UserResolver {
5 constructor(private userService: UserService) {}
6
7 @Query({ type: User })
8 async user(@Args({ name: 'id', type: ID }) id: string) {
9 return this.userService.findOne(id);
10 }
11
12 @Mutation({ type: User })
13 async createUser(@Args({ name: 'name' }) name: string) {
14 return this.userService.create({ name });
15 }
16}