Skip to content

Commit 5835ac0

Browse files
committed
Add Dev.to cross-posting setup and first article
1 parent 03adb30 commit 5835ac0

File tree

2 files changed

+268
-1
lines changed

2 files changed

+268
-1
lines changed

CLAUDE.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,26 @@ Images are saved to `public/og/{slug}.png` (1200x630px).
6767

6868
---
6969

70-
**Last Updated:** 2025-12-16
70+
## Cross-Posting (Dev.to)
71+
72+
**Organization:** [@getlumos](https://dev.to/getlumos) (ID: 12078)
73+
**API credentials:** `~/.claude/lumos/devto-credentials.md`
74+
75+
**Cross-post workflow:**
76+
1. Articles saved to `devto-posts/` directory
77+
2. Use canonical_url pointing to docs.lumos-lang.org
78+
3. Publish via API or manually
79+
80+
**Tags to use:** `solana`, `rust`, `typescript`, `webdev`, `blockchain`
81+
82+
---
83+
84+
## Analytics
85+
86+
**Google Analytics 4:** G-1NZRT4TYL6
87+
**Google Search Console:** Verified (sitemap submitted)
88+
89+
---
90+
91+
**Last Updated:** 2025-12-17
7192
**Status:** Live at https://docs.lumos-lang.org

devto-posts/lumos-vs-codama.md

Lines changed: 246 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,246 @@
1+
---
2+
title: "LUMOS vs Codama: Understanding Solana's Schema Generation Tools"
3+
published: true
4+
description: "A comprehensive comparison of LUMOS and Codama for Solana development - when to use each tool and how they complement each other."
5+
tags: solana, rust, typescript, webdev
6+
canonical_url: https://docs.lumos-lang.org/guides/lumos-vs-codama/
7+
cover_image: https://lumos-lang.org/og-image.png
8+
---
9+
10+
Building on Solana? You've probably wondered: **"Should I use LUMOS or Codama?"**
11+
12+
The answer: **Both. They're complementary, not competing.**
13+
14+
Let me explain why.
15+
16+
## TL;DR
17+
18+
- **LUMOS** = Define data schemas → Generate Rust + TypeScript code (pre-deployment)
19+
- **Codama** = Parse existing programs → Generate client SDKs (post-deployment)
20+
21+
They work at different layers and can be used together.
22+
23+
---
24+
25+
## Where Each Tool Fits
26+
27+
```
28+
┌─────────────────────────────────────────────────────────────┐
29+
│ YOUR SOLANA PROGRAM │
30+
│ ┌────────────────────────────────────────────────────────┐ │
31+
│ │ │ │
32+
│ │ ┌──────────────────┐ │ │
33+
│ │ │ Account Data │ ◄── LUMOS generates this │ │
34+
│ │ │ (structs/enums) │ (data structure code) │ │
35+
│ │ └──────────────────┘ │ │
36+
│ │ │ │
37+
│ │ ┌──────────────────┐ │ │
38+
│ │ │ Instructions │ (you write this manually │ │
39+
│ │ │ (program logic) │ or with Anchor) │ │
40+
│ │ └──────────────────┘ │ │
41+
│ │ │ │
42+
│ └────────────────────────────────────────────────────────┘ │
43+
└─────────────────────────────────────────────────────────────┘
44+
45+
│ Codama parses program
46+
│ and generates...
47+
48+
┌─────────────────────────────────────────────────────────────┐
49+
│ CLIENTS │
50+
│ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │
51+
│ │ JS │ │ Rust │ │ Python │ │ Dart │ │
52+
│ │ Client │ │ Client │ │ Client │ │ Client │ │
53+
│ └─────────┘ └─────────┘ └─────────┘ └─────────┘ │
54+
│ │
55+
│ ◄── Codama generates these (SDK code to interact) │
56+
└─────────────────────────────────────────────────────────────┘
57+
```
58+
59+
**Key insight:** LUMOS generates code that goes *inside* your program. Codama generates code that *interacts with* your program from outside.
60+
61+
---
62+
63+
## What is Codama?
64+
65+
[Codama](https://github.com/codama-idl/codama) is a code generation framework that creates standardized descriptions of Solana programs. It works around a central concept called the **Codama IDL**.
66+
67+
**Core workflow:**
68+
```
69+
Existing Program → Parse → Codama IDL → Generate Clients
70+
or
71+
Anchor IDL → Convert → Codama IDL → Generate Clients
72+
```
73+
74+
**What Codama does:**
75+
- Parses existing Solana programs or Anchor IDL files
76+
- Creates a unified IDL representation with 60+ node types
77+
- Generates client SDKs in multiple languages (JS, Rust, Python, Dart)
78+
- Produces documentation and tooling for program interfaces
79+
80+
**Primary use case:** "I have a deployed Solana program, now I need to generate client libraries."
81+
82+
---
83+
84+
## What is LUMOS?
85+
86+
[LUMOS](https://lumos-lang.org) is a **schema-first DSL** for defining data structures with guaranteed type safety across Rust and TypeScript.
87+
88+
**Core workflow:**
89+
```
90+
.lumos Schema → Parse → IR → Generate Rust + TypeScript
91+
```
92+
93+
**What LUMOS does:**
94+
- Defines data structures in a clean, Rust-like syntax
95+
- Generates Rust structs with proper Borsh serialization
96+
- Generates TypeScript interfaces with matching Borsh schemas
97+
- Ensures type safety between on-chain and off-chain code
98+
- Supports Anchor framework integration via `#[account]` attribute
99+
100+
**Primary use case:** "I want a single source of truth for my data types."
101+
102+
---
103+
104+
## Key Differences
105+
106+
### 1. Workflow Direction
107+
108+
| Aspect | LUMOS | Codama |
109+
|--------|-------|--------|
110+
| **Direction** | Forward (schema → code) | Reverse (program → clients) |
111+
| **Input** | `.lumos` schema files | Existing programs or Anchor IDL |
112+
| **Stage** | Pre-deployment | Post-deployment |
113+
114+
### 2. What They Generate
115+
116+
**LUMOS generates data structure code:**
117+
118+
```rust
119+
// Input: schema.lumos
120+
#[solana]
121+
#[account]
122+
struct PlayerAccount {
123+
wallet: PublicKey,
124+
level: u16,
125+
experience: u64,
126+
}
127+
```
128+
129+
```rust
130+
// Output: generated.rs (goes INTO your program)
131+
use anchor_lang::prelude::*;
132+
133+
#[account]
134+
pub struct PlayerAccount {
135+
pub wallet: Pubkey,
136+
pub level: u16,
137+
pub experience: u64,
138+
}
139+
```
140+
141+
**Codama generates client SDK code:**
142+
143+
```typescript
144+
// Output: client SDK (CALLS your program from outside)
145+
await program.methods
146+
.createPlayer()
147+
.accounts({
148+
player: playerPda,
149+
authority: wallet.publicKey,
150+
})
151+
.rpc();
152+
```
153+
154+
### 3. Feature Comparison
155+
156+
| Feature | LUMOS | Codama |
157+
|---------|-------|--------|
158+
| Struct definitions |||
159+
| Enum definitions |||
160+
| Borsh serialization |||
161+
| Instruction builders |||
162+
| Error types |||
163+
| CLI generation |||
164+
| Go support |||
165+
| Ruby support |||
166+
| Dart support |||
167+
168+
---
169+
170+
## When to Use Each
171+
172+
### Use LUMOS When:
173+
174+
✅ Defining new data structures for a Solana program
175+
✅ Need Rust + TypeScript type synchronization with Borsh
176+
✅ Building new programs and want a single source of truth
177+
✅ Want compile-time guarantees that types match
178+
✅ Need Go or Ruby code generation
179+
180+
### Use Codama When:
181+
182+
✅ Building clients for existing/deployed programs
183+
✅ Need full SDK generation with instruction builders
184+
✅ Want Dart support or Umi framework integration
185+
✅ Generating documentation for your program
186+
✅ Need CLI tools for program interaction
187+
188+
---
189+
190+
## Using Both Together
191+
192+
Here's how a complete workflow looks:
193+
194+
```
195+
┌─────────────────────────────────────────────────────────────┐
196+
│ PHASE 1: Define Data Structures (LUMOS) │
197+
│ │
198+
│ schema.lumos → lumos generate → generated.rs + generated.ts│
199+
└─────────────────────────────────────────────────────────────┘
200+
201+
┌─────────────────────────────────────────────────────────────┐
202+
│ PHASE 2: Build Program (Anchor/Native) │
203+
│ │
204+
│ Use generated.rs in your program + write instructions │
205+
└─────────────────────────────────────────────────────────────┘
206+
207+
┌─────────────────────────────────────────────────────────────┐
208+
│ PHASE 3: Deploy & Generate Clients (Codama) │
209+
│ │
210+
│ Deploy program → Parse IDL → Generate full client SDKs │
211+
└─────────────────────────────────────────────────────────────┘
212+
```
213+
214+
---
215+
216+
## Summary
217+
218+
| Aspect | LUMOS | Codama |
219+
|--------|-------|--------|
220+
| **Philosophy** | Schema-first | IDL-centric |
221+
| **Direction** | Schema → Code | Program → Clients |
222+
| **Stage** | Pre-deployment | Post-deployment |
223+
| **Focus** | Data structures | Full program interface |
224+
225+
**They're complementary tools:**
226+
- Use **LUMOS** when defining your data schemas during development
227+
- Use **Codama** when generating client libraries for distribution
228+
229+
---
230+
231+
## Get Started
232+
233+
- **LUMOS:** [lumos-lang.org](https://lumos-lang.org) | [GitHub](https://github.com/getlumos/lumos)
234+
- **Codama:** [GitHub](https://github.com/codama-idl/codama)
235+
236+
```bash
237+
# Install LUMOS CLI
238+
cargo install lumos-cli
239+
240+
# Generate from schema
241+
lumos generate schema.lumos
242+
```
243+
244+
---
245+
246+
*Have questions? Drop them in the comments below!*

0 commit comments

Comments
 (0)