LUMOS vs Codama: Understanding Solana's Schema Generation Tools

Published: (December 17, 2025 at 06:00 PM EST)
4 min read
Source: Dev.to

Source: Dev.to

Cover image for LUMOS vs Codama: Understanding Solana's Schema Generation Tools

LUMOS profile image
RECTOR SOL

Building on Solana? You’ve probably wondered:

“Should I use LUMOS or Codama?”

Answer: Both. They are complementary, not competing.

TL;DR

ToolWhat it doesWhen you use it
LUMOSDefine data schemas → generate Rust + TypeScript code (pre‑deployment)While writing your on‑chain program
CodamaParse existing programs → generate client SDKs (post‑deployment)After your program is deployed

They operate at different layers and can be used together.

Where Each Tool Fits

┌─────────────────────────────────────────────────────────────┐
│                   YOUR SOLANA PROGRAM                       │
│  ┌────────────────────────────────────────────────────────┐ │
│  │                                                        │ │
│  │   ┌──────────────────┐                                 │ │
│  │   │  Account Data    │ ◄── LUMOS generates this        │ │
│  │   │  (structs/enums)│     (data‑structure code)       │ │
│  │   └──────────────────┘                                 │ │
│  │                                                        │ │
│  │   ┌──────────────────┐                                 │ │
│  │   │  Instructions    │   (you write this manually     │ │
│  │   │  (program logic) │    or with Anchor)             │ │
│  │   └──────────────────┘                                 │ │
│  │                                                        │ │
│  └────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘

                              │ Codama parses program
                              │ and generates...

┌─────────────────────────────────────────────────────────────┐
│                        CLIENTS                              │
│  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐         │
│  │   JS    │  │  Rust   │  │ Python  │  │  Dart   │         │
│  │ Client  │  │ Client  │  │ Client  │  │ Client  │         │
│  └─────────┘  └─────────┘  └─────────┘  └─────────┘         │
│                                                             │
│  ◄── Codama generates these (SDK code to interact)          │
└─────────────────────────────────────────────────────────────┘

Key insight:
LUMOS generates code that lives inside your program.
Codama generates code that lives outside, letting you interact with the program.

What is Codama?

Codama is a code‑generation framework that creates a standardised description of Solana programs, centred around the Codama IDL.

Core workflow

Existing Program → Parse → Codama IDL → Generate Clients
        or
Anchor IDL      → Convert → Codama IDL → Generate Clients

What Codama does

  • Parses existing Solana programs or Anchor IDL files
  • Produces a unified IDL representation with 60+ node types
  • Generates client SDKs in multiple languages (JS, Rust, Python, Dart)
  • Emits documentation and tooling for program interfaces

Primary use case: “I have a deployed Solana program; now I need client libraries.”

What is LUMOS?

LUMOS is a schema‑first DSL for defining data structures with guaranteed type safety across Rust and TypeScript.

Core workflow

.lumos Schema → Parse → IR → Generate Rust + TypeScript

What LUMOS does

  • Lets you define data structures in a clean, Rust‑like syntax
  • Generates Rust structs with proper Borsh serialization
  • Generates TypeScript interfaces with matching Borsh schemas
  • Guarantees type safety between on‑chain and off‑chain code
  • Supports Anchor integration via the #[account] attribute

Primary use case: “I want a single source of truth for my data types.”

Key Differences

1. Workflow Direction

AspectLUMOSCodama
DirectionForward (schema → code)Reverse (program → clients)
Input.lumos schema filesExisting programs or Anchor IDL
StagePre‑deploymentPost‑deployment

2. What They Generate

LUMOS – data‑structure code (goes into your program)

// Input: schema.lumos
#[solana]
#[account]
struct PlayerAccount {
    wallet: PublicKey,
    level: u16,
    experience: u64,
}
// Output: generated.rs (included in your program)
use anchor_lang::prelude::*;

#[account]
pub struct PlayerAccount {
    pub wallet: Pubkey,
    pub level: u16,
    pub experience: u64,
}

Codama – client SDK code (calls your program from outside)

// Example: TypeScript client generated by Codama
await program.methods
  .createPlayer()
  .accounts({
    player: playerPda,
    authority: wallet.publicKey,
  })
  .rpc();

Bottom line: Use LUMOS to author the on‑chain data model once, then let Codama read the compiled program (or its Anchor IDL) to generate the off‑chain SDKs you need. Together they give you a full‑stack, type‑safe development experience on Solana.

3. Feature Comparison

FeatureLUMOSCodama
Struct definitions
Enum definitions
Borsh serialization
Instruction builders
Error types
CLI generation
Go support
Ruby support
Dart support

When to Use Each

Use LUMOS When

  • ✅ Defining new data structures for a Solana program
  • ✅ Need Rust + TypeScript type synchronization with Borsh
  • ✅ Building new programs and want a single source of truth
  • ✅ Want compile‑time guarantees that types match
  • ✅ Need Go or Ruby code generation

Use Codama When

  • ✅ Building clients for existing/deployed programs
  • ✅ Need full SDK generation with instruction builders
  • ✅ Want Dart support or Umi framework integration
  • ✅ Generating documentation for your program
  • ✅ Need CLI tools for program interaction

Using Both Together

Here’s a typical workflow:

┌─────────────────────────────────────────────────────────────┐
│  PHASE 1: Define Data Structures (LUMOS)                    │
│                                                             │
│  schema.lumos → lumos generate → generated.rs + generated.ts│
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│  PHASE 2: Build Program (Anchor/Native)                     │
│                                                             │
│  Use generated.rs in your program + write instructions      │
└─────────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────────┐
│  PHASE 3: Deploy & Generate Clients (Codama)                │
│                                                             │
│  Deploy program → Parse IDL → Generate full client SDKs     │
└─────────────────────────────────────────────────────────────┘

Summary

AspectLUMOSCodama
PhilosophySchema‑firstIDL‑centric
DirectionSchema → CodeProgram → Clients
StagePre‑deploymentPost‑deployment
FocusData structuresFull program interface

They’re complementary tools:

  • Use LUMOS when defining your data schemas during development.
  • Use Codama when generating client libraries for distribution.

Get Started

LUMOS:

# Install LUMOS CLI
cargo install lumos-cli

# Generate from schema
lumos generate schema.lumos

Codama:

# Install Codama (example via npm)
npm install -g @codama/cli

# Generate clients from a deployed program
codama generate --program-id <PROGRAM_ID>

Have questions? Drop them in the comments below!

Back to Blog

Related posts

Read more »