Open-source project
appwrite/sdk-generator avatar
appwrite/sdk-generator

Appwrite SDK Generator: A Twig-Based Factory for Multi-Language Client Libraries

Generating SDKs for multiple programming languages and platforms ⚙️

330 stars214 forksTwigMIT

At a glance

What is it?
The Appwrite SDK Generator turns OpenAPI 2, 3.0, and 3.1 specs into SDKs for 15 languages. It uses Twig templates and a canonical model, but its real value depends on how much you trust Appwrite's own spec and template choices.
Who is it for?
Adopt this generator if you manage an API that must ship consistent SDKs for many languages and you can live with Appwrite's opinionated template set. Skip it if you need fine-grained control over each SDK's style, have specs outside OpenAPI 2/3.0/3.1, or want to avoid a PHP and Twig dependency chain.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 1 day ago.
What is it written in?
Mainly Twig, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on November 14, 2026, and from our analysis. They are not legal advice.

From daily snapshots

Star history

  • appwrite/sdk-generator330 ★ · +6
Star history
Repository2026-08-242026-11-14
appwrite/sdk-generator324330

6 Stars in the last 82 days, measured from the daily GitHub snapshot. Compare with other projects

Editorial analysis

What Problem It Solves and Who It Serves

Maintaining separate SDKs for web, mobile, and server platforms is a time sink. Every API change forces edits across multiple codebases, each with its own conventions, package managers, and version constraints. The Appwrite SDK Generator automates that by consuming a single API specification and emitting ready-to-publish client libraries. It targets teams that run a public or internal API and need to ship SDKs for JavaScript, Flutter, Apple, Android, Node.js, PHP, Python, Ruby, Dart, Go, Swift, .NET, Kotlin, and Rust, plus tooling artifacts like CLI and IDE extensions. The README positions it as a PHP library, not a standalone service, so the primary users are developers who can write PHP scripts and run Composer. If you are a solo developer with one language to support, this is overkill. If you are an API platform team with a dozen language ecosystems, it directly attacks the duplication problem.

The Mechanism: From OpenAPI to Canonical Model to Twig Rendering

The generator does not parse OpenAPI documents directly. Instead, it relies on the Utopia OpenAPI parser, which reads OpenAPI 2.0, 3.0, and 3.1 and normalizes them into a single canonical model. That model contains services, methods, models, enums, and union types. Twig templates then render that model into language-specific code. This two-stage design means the parser handles spec variations, and the templates only see a uniform structure. The README gives a concrete example: you call Parser::parse() with a JSON string or an array, get a spec object, then create a language instance like new PHP(), set options such as composer package and vendor, and finally instantiate an SDK with that language and spec. The SDK object's methods, like setName and setVersion, control the generated artifact's metadata. The separation is clean, but it also means any feature not captured in the canonical model, such as a niche OpenAPI extension, will not reach the templates.

Getting It Running: Composer, Docker, and the Example Script

Installation is Composer-based. The README suggests composer update --ignore-platform-reqs --optimize-autoloader for a CLI setup, and provides Docker commands for UNIX and Windows that mount the current directory and run composer install. After installing, you write a PHP script that requires vendor/autoload.php, imports SDK and Language classes, parses a spec, and generates code. The repository includes example.php, which acts as the primary generation entry point. Running php example.php without arguments generates every target using the default console platform spec. You can narrow it down with arguments: php example.php web client, php example.php node server, or php example.php skills. The third argument selects the spec format, either openapi3 or swagger2, and the README notes both produce identical SDKs. For artifacts that need no API operations, like a skills file, you can build a minimal canonical spec with an empty paths array. This is a practical path for generating non-SDK outputs, but it also shows that the tool expects you to understand the spec model, not just feed it a URL.

Supported Targets and Their Version Constraints

The generator's value proposition rests on its target coverage. The README lists five client SDKs: web (ES5+, Node.js >=18 for builds), Flutter (Dart >=3.7 <4, Flutter >=3.29), Apple (iOS 15+, macOS 11+, watchOS 7+, tvOS 13+), Android (Android 6.0+, Java 17 in CI), and React Native (>=0.76.7 <1.0.0, Node.js >=18). Server SDKs cover Node.js (Node 20 in CI), PHP (>=8.2), Python (>=3.9), Ruby (Ruby 3.1 in CI), Dart (>=2.17 <4), Go (Go 1.26.5), Swift (Swift 5.1+, 5.9.2 in CI), .NET (Standard 2.0, Framework 4.6.2), Kotlin (JVM 1.8 target, Java 17 in CI), and Rust (>=1.83). These are not loose suggestions; they are hard constraints baked into the templates. If your users run an older Python or a non-LTS Node, the generated SDK may not work. The version ranges also hint at the maintenance burden: each language's ecosystem moves, and the generator must track those moves in its templates and CI.

Enum Naming and the OneOf Trick

One of the more interesting details is how the generator handles enum values. OpenAPI enums are wire values, but each language needs a valid identifier. The README explains that enum wire values are converted into identifiers, and to give values explicit semantic names, you describe the enum as titled oneOf branches. For example, a string enum with values in Khmer script can be represented as oneOf branches with titles Capital and Province, mapping to the actual enum values. Without a title, the generator falls back to a deterministic positional name like Value1. This is a clever workaround for non-Latin text, but it also means your spec authoring must follow this pattern to get readable SDK code. If you have a large existing spec with plain enums, you will need to refactor it. OpenAPI 3.1 allows const instead of a single-value enum, and the generator handles that, but the requirement to add titles for non-Latin values is a real spec-side constraint.

Limitations and Wrong-Tool Scenarios

The README is honest about incomplete spec support. RAML 1.0, RAML 0.8, Postman 2.0, Postman 1.0, and API Blueprint are all listed as Not Ready. If your API is defined in RAML or Postman, this generator will not help you today. Even within OpenAPI, the parser only supports versions 2, 3.0, and 3.1, so any future OpenAPI version will require upstream changes. Another limitation is that the generated SDKs are Appwrite-shaped. The templates encode Appwrite's API conventions, naming patterns, and even its coding standards. If your API has a different structure, such as deeply nested resources or non-standard error formats, the templates may produce awkward or incorrect code. The README also notes that djLint formatting is disabled because it breaks code generation syntax, which suggests the templates are sensitive to whitespace and formatting changes. That fragility means modifying templates is risky without thorough testing.

Maintenance, Licensing, and Upgrade Cost

The project is MIT licensed, which gives you freedom to fork and modify. The recent release history shows 4.7.4, 4.7.3, and 4.7.2 pushed on consecutive days, indicating a rapid release cadence. That is good for bug fixes but bad for stability if you fork. Every upstream release may change template behavior or add new language version constraints. The README mentions that the linter runs automatically on pull requests via GitHub Actions, so there is CI in place. However, the maintenance cost for you as a user is not zero: you must track new releases, regenerate your SDKs, and re-run your own test suites. The dependency on Utopia OpenAPI parser means you inherit its release cycle too. If you customize templates, you must merge upstream changes manually, and the formatting sensitivity makes conflicts painful. The README does not document a migration path between generator versions, so you should assume breaking changes are possible, given the rapid versioning.

Alternatives and How They Differ

The most direct alternative is OpenAPI Generator, a well-known project that also generates SDKs from OpenAPI specs. The key difference is that OpenAPI Generator uses Mustache templates and a Java-based codebase, while Appwrite's generator uses Twig and PHP. OpenAPI Generator supports a broader range of languages and has a larger template ecosystem, but it also produces more generic code that often needs manual adjustment. Appwrite's generator is tightly coupled to Appwrite's own API style, which can be an advantage if your API follows similar patterns, because the generated code is more idiomatic to Appwrite's conventions. Another alternative is writing SDKs by hand, which gives full control but defeats the automation purpose. For teams already on Appwrite, the generator is the natural fit. For teams with a diverse API surface and a need for customization, OpenAPI Generator's template overrides and community templates may be more flexible, though the learning curve is steeper.

Editorial conclusion

Adopt this generator if you manage an API that must ship consistent SDKs for many languages and you can live with Appwrite's opinionated template set. Skip it if you need fine-grained control over each SDK's style, have specs outside OpenAPI 2/3.0/3.1, or want to avoid a PHP and Twig dependency chain. Before adopting, verify that your spec's edge cases (enums with non-Latin text, union types, version-specific quirks) render correctly in every target, and check the generated code against your own linting and build pipelines. The generator is MIT licensed, so you can fork and modify templates, but doing so means maintaining your own fork against a project that releases several times a week.

Frequently asked questions

What is the Appwrite SDK generator?

It is a PHP library that uses Twig templates to auto-generate SDK libraries for multiple languages and platforms. Utopia OpenAPI parses an OpenAPI 2.0, 3.0 or 3.1 document into one canonical model, and the generator renders services, methods, models, enums and union types from that model.

How do I create my own SDK with the Appwrite SDK generator?

Create a language instance and an SDK object, pass in the parsed specification, then generate into a target directory. Run a single target with php example.php <target> <platform>, or run the file with no arguments to generate every target using the console platform.

What is an SDK example in the Appwrite sdk-generator?

Each target writes into its own examples/ subdirectory: examples/web/ for the web target, examples/node/ for the Node.js server target, and separate directories for flutter, apple, android, react-native, php, python, ruby, dart, go, swift, dotnet, kotlin and rust.

What is an SDK versus an API in the Appwrite SDK generator?

The API side is the spec file the generator reads from the appwrite/specs repository, picked by version and by the openapi3 or swagger2 format. The SDK side is the code rendered from it: services, methods, models, enums and union types, emitted through Twig templates for a given language and platform.

Official sources

  1. Official documentation
  2. Official README
  3. Project repository
  4. Release notes
Community

Where developers are discussing it

Posts on Hacker News, dev.to and Lobsters that link to this repository, found by our scan of those communities. 1 in the last 30 days; newest first.

Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/appwrite-sdk-generator.svg)](https://hysenlabs.com/projects/appwrite-sdk-generator)

Star history chart for your README

markdown
[![Star history](https://hysenlabs.com/chart/appwrite-sdk-generator.svg)](https://hysenlabs.com/projects/appwrite-sdk-generator)

Was this useful?