Back to AXON

Examples

Real-world usage patterns and code examples

E-commerce Product Catalog

import { encode, defineSchema } from '@axon-format/core';

const productSchema = defineSchema({
  id: 'u8',
  sku: 'str',
  name: 'str',
  price: 'f64',
  inStock: 'bool',
  categories: 'str[]'
});

const products = { products: [/* ... */] };
const encoded = encode(products, { schema: productSchema });

User Analytics Dashboard

const analyticsData = {
  events: [
    { timestamp: "2025-01-15T10:00:00Z", userId: 123, action: "login" },
    { timestamp: "2025-01-15T10:05:00Z", userId: 123, action: "view_product" },
    // Time-series data works great with AXON
  ]
};

const axon = encode(analyticsData);
// Automatically uses Stream mode + delta encoding

More Examples

Find complete working examples in the GitHub repository: