perry  by PerryTS

TypeScript compiler for native executables

Created 3 months ago
1,864 stars

Top 22.8% on SourcePulse

GitHubView on GitHub
Project Summary

A native TypeScript compiler written in Rust, Perry enables developers to build fast, small, standalone executables without relying on Node.js or browser runtimes. It leverages SWC for parsing and LLVM for native code generation, facilitating cross-platform application development with native performance characteristics.

How It Works

Perry compiles TypeScript directly to native machine code using Rust, SWC for parsing, and LLVM for backend code generation. This approach eliminates runtime dependencies like Node.js or browser engines, resulting in single, self-contained binaries. Key optimizations include scalar replacement of non-escaping objects, inline bump allocators, and specialized numeric handling, allowing it to compete with systems languages.

Quick Start & Requirements

  • Installation: Primary methods include npm/npx (npm install @perryts/perry), Homebrew (brew install perryts/perry/perry), winget, APT, or building from source (cargo build --release).
  • Prerequisites: Requires Node.js (>= 16) and a system C toolchain (e.g., Xcode Command Line Tools, GCC/Clang, or MSVC) for linking. The perry doctor command can verify the environment setup.
  • Setup: Installation via npm is noted as the fastest way to try the tool.

Highlighted Details

  • Cross-Platform UI: A declarative UI system compiles to native widgets across 9 platforms (macOS, iOS, Android, Windows, Linux, Web, WASM) without WebViews or Electron.
  • Native npm Package Compilation: Pure TypeScript/JavaScript npm packages can be compiled directly to native code, bypassing the V8 runtime for improved performance.
  • Multi-Threading: Provides OS threads with compile-time safety, preventing data races. Values are passed via deep-copy.
  • Internationalization (i18n): Compile-time localization offers zero runtime overhead, supporting CLDR plural rules and native locale detection.
  • Home Screen Widgets: Native widgets for iOS, Android, watchOS, and Wear OS can be built directly from TypeScript.
  • Performance: Benchmarks show significant outperformance of Node.js/Bun and competitiveness with Rust/C++ due to advanced compiler optimizations.
  • Ecosystem: Includes packages for native UI (perry-react), databases (Prisma-compatible SQLite, PostgreSQL, MySQL), and more.

Maintenance & Community

  • Release Cadence: Patch releases ship weekly-ish; major releases require verification on all supported platforms.
  • CI/CD: Automated builds and testing are in place, with a detailed release process outlined for ensuring cross-platform stability.
  • Community: No explicit links to Discord/Slack or community forums are provided in the README.

Licensing & Compatibility

  • License: MIT.
  • Compatibility: The permissive MIT license allows for commercial use and closed-source linking.

Limitations & Caveats

Some platform-specific testing (iOS, tvOS, watchOS simulators, Android) requires manual execution and specific toolchains, and is not fully automated in CI. Certain npm packages may still require the embedded V8 runtime, adding ~15MB to binary size. The system lacks runtime type checking; developers must use typeof and instanceof for runtime checks.

Health Check
Last Commit

7 hours ago

Responsiveness

Inactive

Pull Requests (30d)
39
Issues (30d)
172
Star History
1,829 stars in the last 30 days

Explore Similar Projects

Starred by Georgios Konstantopoulos Georgios Konstantopoulos(CTO, General Partner at Paradigm), Jared Palmer Jared Palmer(SVP at GitHub; Founder of Turborepo; Author of Formik, TSDX), and
2 more.

Valdi by Snapchat

0.0%
16k
Build native cross-platform UIs with TypeScript
Created 5 months ago
Updated 15 hours ago
Feedback? Help us improve.