예제

예제로 배우기.

핵심 개념, HTTP 라우팅, 인증, 영속성, 관측성, 프로토콜 어댑터를 다루는 분류별 예제를 탐색하세요. 각 카드는 GitHub 리포지토리의 전체 소스로 연결됩니다.

학습 경로

초급에서 고급까지 단계별 가이드를 따라가세요.

빠른 시작

초급

30분 안에 첫 번째 Axon 워크플로우를 구축하세요.

HTTP 서비스

중급

라우팅, 인증, 실시간 기능을 갖춘 프로덕션 HTTP API를 구축하세요.

고급 패턴

고급

장애 복원력, 영속성, 엔터프라이즈 패턴을 마스터하세요.

거버넌스와 풀스택

고급

명시적 요청 거버넌스를 적용하고 유지되는 풀스택 레퍼런스를 연결하세요.

공식 예제 트랙

공식 학습 순서입니다. Hello World에서 시작해 CRUD와 워크플로를 거쳐 bridge/reference surface로 이동합니다.

Hello World

canonical 초급

최소 Flat API 예제 — 트랜지션을 체이닝하여 인사말 생성 및 변환.

3줄로 만드는 최소 Axon 파이프라인

~5분 basics general
cargo run -p hello-world
  • server startup log
  • simple greeting response
#[transition]
async fn greet(input: String) -> Outcome<String, String> {
    Outcome::Next(format!("Hello, {input}!"))
}

레퍼런스 Todo API

supported 중급

JWT 인증, Bus 의존성 주입, HTTP 라우팅, 컬렉션 기반 테스트를 갖춘 완전한 CRUD 애플리케이션.

JWT와 Bus DI를 갖춘 완전한 CRUD

~30분 crud general
사전 준비: flat-api, routing-params
cargo run -p reference-todo-api
  • POST /login
  • GET/POST/PUT/DELETE /todos
// Single-transition Axon circuits per endpoint
POST /login   -> [login]       -> JWT token
GET  /todos   -> [list_todos]  -> Vec<Todo>
POST /todos   -> [create_todo] -> Todo
PUT  /todos/:id  -> [update_todo] -> Todo
DELETE /todos/:id -> [delete_todo] -> { deleted }

주문 처리 워크플로우

supported 중급

도메인 주도 워크플로우: 검증, 결제, 재고 예약, 배송 처리.

다단계 도메인 주도 워크플로우

~20분 pipelinesaga commerce
사전 준비: routing-demo
cargo run -p order-processing-demo
  • validation -> inventory -> payment -> shipping flow
  • success and failure-path logs
Axon::new("order")
    .then(validate_order)
    .then(process_payment)
    .then(reserve_inventory)
    .then(arrange_shipping)

브리지 & 레퍼런스

공식 트랙 다음 단계의 관리자형 backend와 public-only reference app을 여기서 이어서 봅니다.

관리자형 CRUD 데모

supported 중급

브리지 예제: JWT 로그인, SQLite 기반 관리자형 CRUD, 페이지네이션/검색, OpenAPI를 하나로 묶은 중간 규모 백엔드.

공식 트랙 다음 단계의 관리자형 CRUD 백엔드

~35분 crud general
사전 준비: reference-todo-api, openapi
cargo run -p admin-crud-demo
  • JWT login
  • users CRUD
  • OpenAPI JSON
  • Swagger UI parity
Ranvier::http()
    .post_typed_json_out("/login", login)
    .get_json_out("/users", list_users)
    .post_typed_json_out("/users", create_user)
    .put_typed_json_out("/users/:id", update_user)
    .delete_json_out("/users/:id", delete_user)

레퍼런스 풀스택 관리자 앱

supported 고급

Ranvier 백엔드, SvelteKit 프론트엔드, JWT 로그인, 대시보드, 사용자 관리를 포함한 public-only 풀스택 레퍼런스 앱.

브리지 예제 다음 단계의 public-only 풀스택 레퍼런스 앱

~40분 crud general
사전 준비: admin-crud, openapi
cargo run -p reference-fullstack-admin
cd examples/reference-fullstack-admin/frontend && npm install && npm run dev
  • backend login/dashboard/users surface
  • frontend login/dashboard/users surface
Ranvier::http()
    .guard(CorsGuard::<AppState>::permissive())
    .post_typed_json_out("/login", login)
    .get_json_out("/dashboard", dashboard)
    .get_json_out("/users", list_users)

레퍼런스 이커머스 주문

supported 고급

보상 처리, 감사 추적, 멀티테넌시, RFC 7807 에러를 갖춘 완전한 Saga 파이프라인.

보상 처리와 감사를 갖춘 완전한 Saga

~40분 saga commercefintech
사전 준비: order-processing, audit, multitenancy
cargo run -p reference-ecommerce-order
  • saga compensation flow
  • order reference app surface
// Saga: CreateOrder → ProcessPayment → ReserveInventory → ScheduleShipping
//          ↓ (comp)          ↓ (comp)
//      RefundPayment    ReleaseInventory

레퍼런스 채팅 서버

supported 고급

canonical WebSocket 레퍼런스: JWT 인증, REST + WS 하이브리드 라우팅, health/readiness probe, graceful shutdown을 갖춘 멀티룸 채팅.

canonical WebSocket 운영성 레퍼런스

~35분 streaming general
사전 준비: websocket, session-pattern
cargo run -p reference-chat-server
  • health/ready/live probes
  • unauthenticated websocket auth_failed frame
  • authenticated join/history/message websocket flow

거버넌스 & 운영성

OpenAPI 표면과는 별도로, 구조화 에러, 감사 로그, 가드 기반 관측성을 한 서비스에 묶은 운영성 예제를 봅니다.

요청 거버넌스 데모

supported 고급

JWT 인증, 정책 검사, 감사 로그, SQLite 영속성, RFC 7807 스타일 에러를 결합한 횡단 관심사 백엔드 예제.

인증 + 정책 + 감사 + DB + 구조화 에러를 한 흐름에 통합

~30분 guardobservability general
사전 준비: admin-crud
cargo run -p request-governance-demo
  • 403 application/problem+json on insufficient-role approval
  • 200 on approver approval
  • audit event writes
Ranvier::http()
    .post_typed_json_out("/login", login)
    .post_typed_json_out("/requests", create_request)
    .get_with_error("/requests/:id", get_request, governance_error_response)
    .post_with_error("/requests/:id/approve", approve_request, governance_error_response)

전체 예제

17개 예제가 현재 필터에 일치합니다.

기본 필터: Core 예제
티어
카테고리
패턴
도메인

Hello World

canonical 초급

최소 Flat API 예제 — 트랜지션을 체이닝하여 인사말 생성 및 변환.

3줄로 만드는 최소 Axon 파이프라인

~5분 basics general
cargo run -p hello-world
  • server startup log
  • simple greeting response
#[transition]
async fn greet(input: String) -> Outcome<String, String> {
    Outcome::Next(format!("Hello, {input}!"))
}

타입 안전 상태 트리

canonical 초급

Axon, Transition, Outcome을 사용한 타입 안전 의사결정 흐름.

Rust enum을 활용한 타입 안전 의사결정 흐름

~10분 basicsbranching general
사전 준비: hello-world
cargo run -p typed-state-tree
let flow = Axon::new("flow")
    .then(validate)
    .then(process);

기본 스케매틱

canonical 초급

디버깅 및 문서화를 위한 스케매틱 추출을 통한 Axon 흐름 시각화.

Axon 파이프라인을 스케매틱으로 시각화

~10분 basicsobservability general
사전 준비: hello-world
cargo run -p basic-schematic

주문 처리 워크플로우

supported 중급

도메인 주도 워크플로우: 검증, 결제, 재고 예약, 배송 처리.

다단계 도메인 주도 워크플로우

~20분 pipelinesaga commerce
사전 준비: routing-demo
cargo run -p order-processing-demo
  • validation -> inventory -> payment -> shipping flow
  • success and failure-path logs
Axon::new("order")
    .then(validate_order)
    .then(process_payment)
    .then(reserve_inventory)
    .then(arrange_shipping)

Bus 접근 제어 시스템

supported 중급

@transition bus 속성을 통한 선언적 허용/거부 접근 제어.

선언적 Bus 접근 제어

~15분 basics general
사전 준비: typed-state-tree
cargo run -p bus-capability-demo
#[transition(bus_allow = "db,cache")]
async fn fetch(input: Req) -> Outcome<Resp, String> { .. }

Outcome 변형

canonical 초급

5가지 Outcome 변형: Next(선형), Fault(에러), Branch(조건부), Jump(루프), Emit(사이드이펙트).

5가지 Outcome 제어 흐름 변형

~15분 basicsbranching general
사전 준비: hello-world, typed-state-tree
cargo run -p outcome-variants-demo
// Outcome<T, E> — control flow as data
Outcome::Next(value)       // linear progression
Outcome::Fault(err)        // error path
Outcome::Branch("name", v) // conditional routing
Outcome::Jump("node", v)   // goto / loop
Outcome::Emit(event)       // side-effect event

타입 안전 JSON API

supported 중급

get_json_out, post_typed_json_out, BusHttpExt, CorsGuard::permissive()를 사용하는 타입 안전 JSON 엔드포인트.

타입 안전 JSON 자동 직렬화

~20분 crud general
사전 준비: flat-api, routing-params
cargo run -p typed-json-api
Ranvier::http()
    .get_json_out("/items", list_items_axon)
    .post_typed_json_out::<CreateItem, _, _>("/items", create_item_axon)
    .delete_json_out("/items/:id", delete_item_axon)

관리자형 CRUD 데모

supported 중급

브리지 예제: JWT 로그인, SQLite 기반 관리자형 CRUD, 페이지네이션/검색, OpenAPI를 하나로 묶은 중간 규모 백엔드.

공식 트랙 다음 단계의 관리자형 CRUD 백엔드

~35분 crud general
사전 준비: reference-todo-api, openapi
cargo run -p admin-crud-demo
  • JWT login
  • users CRUD
  • OpenAPI JSON
  • Swagger UI parity
Ranvier::http()
    .post_typed_json_out("/login", login)
    .get_json_out("/users", list_users)
    .post_typed_json_out("/users", create_user)
    .put_typed_json_out("/users/:id", update_user)
    .delete_json_out("/users/:id", delete_user)

장애 복구 & 영속성

supported 중급

워크플로우 장애 복구, 체크포인팅, 보상 훅.

보상 훅을 갖춘 장애 복구

~20분 saga general
사전 준비: hello-world
cargo run -p persistence-production-demo
Axon::new("resilient")
    .then(step_a)
    .then(step_b)
    .with_persistence(store)
    .with_compensation(rollback);

Traced 래퍼

canonical 중급

Traced 래퍼와 ConnectionBus를 사용한 트랜지션의 자동 스팬 생성.

Traced 래퍼를 통한 자동 스팬 생성

~20분 observability general
사전 준비: hello-world
cargo run -p otel-concept

테스팅 패턴

supported 초급

Transition 및 Axon 체인을 위한 단위 및 통합 테스트 전략.

단위 및 통합 테스트 전략

~15분 basics general
사전 준비: hello-world
cargo run -p testing-patterns

재시도 & 데드레터 큐

supported 중급

지수 백오프를 갖춘 DLQ 재시도, 타임아웃 패턴, 서킷 브레이커.

지수 백오프를 갖춘 DLQ 재시도

~25분 saga general
사전 준비: custom-error-types
cargo run -p retry-dlq-demo
let axon = Axon::new("payment")
    .then(gateway)
    .with_dlq_policy(DlqPolicy::RetryThenDlq {
        max_attempts: 5,
        backoff_ms: 100,
    })
    .with_dlq_sink(dlq);

요청 거버넌스 데모

supported 고급

JWT 인증, 정책 검사, 감사 로그, SQLite 영속성, RFC 7807 스타일 에러를 결합한 횡단 관심사 백엔드 예제.

인증 + 정책 + 감사 + DB + 구조화 에러를 한 흐름에 통합

~30분 guardobservability general
사전 준비: admin-crud
cargo run -p request-governance-demo
  • 403 application/problem+json on insufficient-role approval
  • 200 on approver approval
  • audit event writes
Ranvier::http()
    .post_typed_json_out("/login", login)
    .post_typed_json_out("/requests", create_request)
    .get_with_error("/requests/:id", get_request, governance_error_response)
    .post_with_error("/requests/:id/approve", approve_request, governance_error_response)

레퍼런스 이커머스 주문

supported 고급

보상 처리, 감사 추적, 멀티테넌시, RFC 7807 에러를 갖춘 완전한 Saga 파이프라인.

보상 처리와 감사를 갖춘 완전한 Saga

~40분 saga commercefintech
사전 준비: order-processing, audit, multitenancy
cargo run -p reference-ecommerce-order
  • saga compensation flow
  • order reference app surface
// Saga: CreateOrder → ProcessPayment → ReserveInventory → ScheduleShipping
//          ↓ (comp)          ↓ (comp)
//      RefundPayment    ReleaseInventory

레퍼런스 채팅 서버

supported 고급

canonical WebSocket 레퍼런스: JWT 인증, REST + WS 하이브리드 라우팅, health/readiness probe, graceful shutdown을 갖춘 멀티룸 채팅.

canonical WebSocket 운영성 레퍼런스

~35분 streaming general
사전 준비: websocket, session-pattern
cargo run -p reference-chat-server
  • health/ready/live probes
  • unauthenticated websocket auth_failed frame
  • authenticated join/history/message websocket flow

레퍼런스 풀스택 관리자 앱

supported 고급

Ranvier 백엔드, SvelteKit 프론트엔드, JWT 로그인, 대시보드, 사용자 관리를 포함한 public-only 풀스택 레퍼런스 앱.

브리지 예제 다음 단계의 public-only 풀스택 레퍼런스 앱

~40분 crud general
사전 준비: admin-crud, openapi
cargo run -p reference-fullstack-admin
cd examples/reference-fullstack-admin/frontend && npm install && npm run dev
  • backend login/dashboard/users surface
  • frontend login/dashboard/users surface
Ranvier::http()
    .guard(CorsGuard::<AppState>::permissive())
    .post_typed_json_out("/login", login)
    .get_json_out("/dashboard", dashboard)
    .get_json_out("/users", list_users)

레퍼런스 Todo API

supported 중급

JWT 인증, Bus 의존성 주입, HTTP 라우팅, 컬렉션 기반 테스트를 갖춘 완전한 CRUD 애플리케이션.

JWT와 Bus DI를 갖춘 완전한 CRUD

~30분 crud general
사전 준비: flat-api, routing-params
cargo run -p reference-todo-api
  • POST /login
  • GET/POST/PUT/DELETE /todos
// Single-transition Axon circuits per endpoint
POST /login   -> [login]       -> JWT token
GET  /todos   -> [list_todos]  -> Vec<Todo>
POST /todos   -> [create_todo] -> Todo
PUT  /todos/:id  -> [update_todo] -> Todo
DELETE /todos/:id -> [delete_todo] -> { deleted }
모든 예제는 GitHub 리포지토리의 ranvier/examples 에 있습니다. 클론 후 cargo run -p <package>로 실행하세요.