Wings is a simple, customizable cross-language code generator that helps maintain consistency across your multi-language tech stack. Define your data structures once in .wings files, and generate corresponding code in multiple programming languages automatically.
Script Installation (Recommended)
curl -s https://wings.sh/install.sh | shUsing Nimble
nimble install wingsManual Installation
- Download the appropriate binary from GitHub Releases
- Add to your PATH and rename to
wings - Make executable:
chmod +x wings
Build from Source
git clone https://github.com/binhonglee/wings.git
cd wings
nim c -r src/main/wings.nimCreate a file named person.wings:
# Define output paths for different languages
go-filepath examples/go
ts-filepath examples/ts
py-filepath examples/py
# Define a simple struct
struct Person {
id int -1
name str ""
email str ""
age int 0
is_active bool true
}
Generate code:
wings person.wingsThis creates corresponding struct/class files in the configured languages with proper type definitions and JSON serialization.
*Note: There are also other packages needed for deployment due to cross compilation (like gcc-multilib, gcc-arm-linux-gnueabihf, mingw-w64, libevent-dev etc...).
- Run mkdocs development server for realtime feedback on changes made
docsfolder (requiresmkdocs)nim src/main/scripts/docs.nims
- Build release binaries for distribution
nim src/main/scripts/release.nims(This will only build the version compatible to your environment by default. You can donim src/main/scripts/release.nims --allto try cross-compiling for other environments.)
- Generate / Update the
langfolder (src/main/wingspkg/lang) based on the files in theexamples/input/templatesfoldernim c -r -d:ssl src/main/staticlang/main.nim
- Run tests
./scripts/test.sh(This isn't a proper test for everything. Recommend reading the script, < 20 lines, before running it.)
For some more comprehensive set up / testing procedure, .github/workflows/main.yml file might be a good place to start looking into.
- Core Concepts
- Language Configuration
- Struct Definition
- Enum Definition
- Configuration File
- Examples
- Contributing
Wings solves the problem of maintaining identical data structures across multiple programming languages. Instead of manually keeping structs, classes, and enums synchronized across your different services, you define them once and generate consistent code.
- Single Source of Truth: Define structures once, use everywhere
- Type Safety: Generates proper type definitions for each language
- Consistency: Ensures field names, types, and defaults are identical
- Simplicity: Straightforward syntax and minimal configuration
Define where generated files should be placed:
# Single language
go-filepath src/models
# Multiple languages
go-filepath backend/models
ts-filepath frontend/src/types
py-filepath services/shared/models
Control how imports are handled:
# Import external wings files
import shared/common.wings
import validation/rules.wings
struct StructName {
field_name field_type default_value
another_field another_type
}
struct DataTypes {
# Integers
user_id int 0
count int 0
# Strings
name str ""
description str "No description"
# Booleans
is_active bool true
is_deleted bool false
# Floating point
price float 0.0
}
struct ComplexTypes {
# Arrays/Lists
tags []str
scores []int
# Maps/Dictionaries (if supported)
metadata Map<str,str>
counts Map<str,int>
# Custom types (from other wings files)
address Address
permissions []Permission
}
struct UserProfile {
# Required fields (no default)
id int
email str
# Optional with defaults
name str "Anonymous"
age int 0
bio str ""
# Optional arrays
tags []str
}
enum Status {
Active
Inactive
Pending
Suspended
}
# User account status
enum UserStatus {
# Account is active and user can log in
Active
# Account is temporarily disabled
Inactive
# Account is waiting for email verification
Pending
# Account is suspended due to policy violation
Suspended
}
import enums/status.wings
struct User {
id int
name str
status Status Status.Active
}
Create a wings.json configuration file for advanced settings:
{
"header": [
"This is a generated file",
"Do not edit manually"
],
"acronyms": ["ID", "URL", "API", "HTTP", "JSON"],
"langFilter": ["go", "ts", "py"],
"skipImport": false,
"logging": 2
}| Option | Type | Description |
|---|---|---|
header |
[]string |
Header comments for generated files |
acronyms |
[]string |
Words to keep as ALL_CAPS in naming |
langFilter |
[]string |
Only generate these languages |
skipImport |
bool |
Skip processing imported files |
logging |
int |
Logging verbosity (0-4) |
project/
βββ wings/
β βββ shared/
β β βββ common.wings
β β βββ enums.wings
β βββ models/
β β βββ user.wings
β β βββ product.wings
βββ wings.json
βββ generated/
βββ go/
βββ ts/
βββ py/
- Use
snake_casefor field names in wings files - Wings will automatically convert to language-appropriate naming
- Use descriptive names for structs and enums
- Always provide sensible defaults for optional fields
- Use empty strings
""for optional text fields - Use
falsefor boolean flags that default to off - Use
0for numeric counters
# This comment describes the entire struct
struct User {
# User's unique identifier
id int
# Full name of the user
name str ""
# Email address for authentication
email str
}
# wings/api/user.wings
struct User {
id int
name str
email str
is_active bool true
created_at str
}
enum UserRole {
Admin
User
Guest
}
struct UserWithRole {
id int
name str
email str
role UserRole UserRole.User
}
# wings/ecommerce/product.wings
import shared/common.wings
struct Product {
id int
name str
description str ""
price float
is_available bool true
tags []str
}
enum ProductCategory {
Electronics
Clothing
Books
Home
}
# Clone the repository
git clone https://github.com/binhonglee/wings.git
cd wings
# Build from source (requires Nim)
nim c -r src/main/wings.nim
# Run tests
./scripts/test.sh- Use GitHub Issues for bugs and feature requests
- Include wings file examples and configuration
- Provide generated output when relevant
- Specify operating system and wings version