Introduction
Wing is a cloud-oriented programming language created by the Wing Cloud team. It introduces the concept of inflight functions that distinguish between code that runs at deploy time (preflight) and code that runs at request time (inflight). Wing compiles to Terraform for infrastructure provisioning and JavaScript for runtime logic, producing deployable cloud applications from a single source file.
What Wing Does
- Defines cloud resources and runtime logic in one language with preflight/inflight separation
- Compiles to Terraform and JavaScript targeting AWS, Azure, GCP, or a local simulator
- Provides a built-in cloud library with abstractions for buckets, queues, APIs, and functions
- Includes a local simulator for testing cloud applications without deploying
- Supports importing existing Terraform modules and CDKTF constructs
Architecture Overview
The Wing compiler parses .w files and separates code into preflight (infrastructure) and inflight (runtime) phases. Preflight code generates Terraform JSON that provisions cloud resources. Inflight code compiles to JavaScript that runs inside Lambda functions, containers, or the local simulator. The compiler handles permissions and IAM policies automatically based on which resources inflight code accesses.
Self-Hosting & Configuration
- Install via npm with npm install -g winglang
- Initialize a project with wing init in an empty directory
- Write .w files using the Wing standard library for cloud resources
- Test locally with wing it which launches the Wing Console simulator
- Compile to a target platform with wing compile -t tf-aws for Terraform output
Key Features
- Preflight/inflight model separates infrastructure and runtime concerns in the same file
- Automatic IAM permission generation based on resource access patterns
- Local simulator with a visual console for testing without cloud deployment
- Extensible with Terraform modules and custom resource types
- Type-safe language with familiar syntax inspired by TypeScript and Rust
Comparison with Similar Tools
- Pulumi — uses general-purpose languages for IaC but does not unify runtime and infrastructure code
- AWS CDK — defines infrastructure in TypeScript/Python but runtime code is separate
- SST — builds on CDK with better DX for serverless but still uses separate languages
- Terraform — declarative IaC without runtime logic; Wing compiles down to Terraform
- Darklang — deployless language concept but proprietary; Wing is open source and targets standard cloud providers
FAQ
Q: What cloud providers does Wing support? A: Wing targets AWS, Azure, GCP, and a local simulator. AWS support is the most mature.
Q: Can I use existing Terraform modules? A: Yes. Wing can import and use Terraform modules and CDKTF constructs in preflight code.
Q: Is Wing production-ready? A: Wing is in pre-release. The language and toolchain are evolving, and breaking changes may occur.
Q: Do I need to know Terraform to use Wing? A: No. Wing abstracts Terraform behind its cloud library, though understanding IaC concepts helps.