Welcome to the LLM-Forge documentation. This directory contains comprehensive design specifications for the multi-language SDK generator.
Comprehensive design patterns for all supported languages:
- Type System Mapping: How OpenAPI/JSON Schema types map to language-specific types
- Async Patterns: Language-specific async/await, promises, and concurrency patterns
- Error Handling: Exception vs Result types, error hierarchies
- Package Structure: Recommended directory layouts and module organization
- Idioms and Conventions: Builder patterns, naming conventions, documentation styles
Supported Languages:
- Rust
- TypeScript
- Python
- JavaScript
- C#
- Go
- Java
Concrete code examples showing what generated SDKs look like:
- Reference OpenAPI Spec: A sample User API specification
- Generated Code Examples: Complete, production-ready code for each language
- Type Definitions: How types are generated from schemas
- Client Implementation: HTTP client with authentication, error handling
- Method Generation: Endpoint methods with validation and documentation
- Code Generation Patterns: Common patterns across all languages
Language-specific code style and formatting rules:
- Naming Conventions: PascalCase, camelCase, snake_case rules per language
- Code Formatting: Indentation, line length, brace styles
- Import Organization: How imports/uses/requires are organized
- Documentation Standards: Doc comments format (JSDoc, GoDoc, rustdoc, etc.)
- Formatter Configuration: Settings for rustfmt, prettier, black, gofmt, etc.
- Linter Configuration: ESLint, clippy, ruff, golangci-lint settings
System architecture and implementation details:
- System Architecture: High-level component diagram
- Core Components: Parser, Analyzer, IR Generator, Language Generators
- Data Flow: From OpenAPI spec to generated code
- IR Structure: Intermediate representation format
- Type Mapping Strategy: Cross-language type mapping tables
- Error Handling Strategy: Error type hierarchies
- Configuration: Generator configuration format
- Plugin Architecture: Extensibility through plugins
- Testing Strategy: How to test generated code
- Performance Considerations: Optimization strategies
| OpenAPI Type | Rust | TypeScript | Python | Go | Java | C# |
|---|---|---|---|---|---|---|
| string | String | string | str | string | String | string |
| integer | i64 | number | int | int64 | Long | long |
| number | f64 | number | float | float64 | Double | double |
| boolean | bool | boolean | bool | bool | Boolean | bool |
| array | Vec<T> | T[] | List[T] | []T | List<T> | List<T> |
| object | struct | interface | @dataclass | struct | class | class |
- Rust:
async/awaitwith tokio runtime - TypeScript/JavaScript:
Promiseandasync/await - Python:
asynciowithasync/await+ optional sync wrappers - C#:
Task-based async withasync/await - Go: Goroutines with channels and
context.Context - Java:
CompletableFutureor reactive streams
- Rust:
Result<T, E>(no exceptions) - TypeScript: Exceptions + optional Result types
- Python: Exceptions (Pythonic way)
- JavaScript: Exceptions
- C#: Exceptions + optional Result types
- Go: Multiple return values
(value, error) - Java: Checked exceptions + modern sealed Result types
Rust:
let client = Client::new("https://api.example.com")
.with_api_key("sk-...");
let user = client.get_user("user_123").await?;
println!("User: {}", user.name);TypeScript:
const client = new Client({
baseUrl: 'https://api.example.com',
apiKey: 'sk-...',
});
const user = await client.getUser('user_123');
console.log(`User: ${user.name}`);Python:
async with Client("https://api.example.com", api_key="sk-...") as client:
user = await client.get_user("user_123")
print(f"User: {user.name}")Go:
client := NewClient(
"https://api.example.com",
WithAPIKey("sk-..."),
)
user, err := client.GetUser(ctx, "user_123")
if err != nil {
return err
}
fmt.Println("User:", user.Name)- Type Safety First: Leverage each language's type system to catch errors at compile time
- Idiomatic Code: Follow language-specific conventions and best practices
- Async by Default: Modern async patterns are the primary interface
- Error Transparency: Make errors explicit and easy to handle
- Zero-Runtime Dependencies (where possible): Minimize external dependencies
- Documentation Rich: Generate comprehensive inline documentation
docs/
├── README.md # This file
├── language-strategy.md # Multi-language design patterns
├── template-examples.md # Example generated code
├── code-style-guidelines.md # Code formatting and style rules
└── architecture-overview.md # System architecture and design
When adding support for new languages:
- Add language-specific section to
language-strategy.md - Add example generated code to
template-examples.md - Add code style rules to
code-style-guidelines.md - Update type mapping tables in
architecture-overview.md
- Phase 1: Implement OpenAPI parser and IR generator
- Phase 2: Implement Rust and TypeScript generators (reference implementations)
- Phase 3: Implement remaining language generators
- Phase 4: Add testing framework and CI/CD integration
- Phase 5: Add plugin architecture and customization options
- Review language-specific patterns for your target language
- Check generated code examples to understand output
- Customize code style guidelines for your organization
- Configure generator options in
llm-forge.yaml
| Language | Status | Async Support | Validation | Tests | Examples |
|---|---|---|---|---|---|
| Rust | Planned | ✅ | ✅ | ✅ | ✅ |
| TypeScript | Planned | ✅ | ✅ | ✅ | ✅ |
| Python | Planned | ✅ | ✅ | ✅ | ✅ |
| JavaScript | Planned | ✅ | ✅ | ✅ | ✅ |
| Go | Planned | ✅ | ✅ | ✅ | ✅ |
| Java | Planned | ✅ | ✅ | ✅ | ✅ |
| C# | Planned | ✅ | ✅ | ✅ | ✅ |
- OpenAPI Specification
- JSON Schema
- Language Documentation:
See LICENSE file in the repository root.