โœจ

Sparkling โ€” TikTok's Cross-Platform Infrastructure

Production framework for running real apps on the Lynx engine

Lynx is TikTok's cross-platform UI rendering engine. Write code similar to React, and it renders native Android/iOS screens. But Lynx itself is just a "rendering engine."

To run real apps, you need build pipelines, JSโ†”native communication, page navigation, storage/media access. Sparkling handles this infrastructure layer.

One-Line App Creation

npm create sparkling-app@latest my-app creates a complete project with Android/iOS native shells.

npx sparkling build builds the Lynx bundle, npx sparkling run:android or run:ios builds, installs, and runs in one command. npx sparkling dev starts a hot-reload dev server. Default port 5969 โ€” that's LYNX typed on a phone keypad.

npx sparkling doctor auto-diagnoses your dev environment: Node.js, JDK, Android SDK, Xcode, CocoaPods.

Sparkling Method โ€” Type-Safe JSโ†”Native Bridge

The most interesting part. Write function declarations in a TypeScript .d.ts file, and the CLI auto-generates Kotlin/Swift native code plus TS implementation.

Inherit the generated abstract class, implement your native business logic, and call it directly from JS. Types are guaranteed on both sides, reducing runtime errors.

Built-in methods include Navigation (router), Storage (key-value), Media (camera/album/files).

Scheme-Based Unified Navigation

hybrid://lynxview_page?bundle=main.lynx.bundle&title=Home โ€” a unified URL scheme routes both Lynx pages and native screens identically.

Each page has an independent bundle entry point (multi-page architecture), suited for large-scale apps.

Incremental Adoption (Brownfield)

You can embed Sparkling containers into existing Android/iOS apps for gradual adoption.

Android: add Maven artifact, then HybridKit.init() โ†’ Sparkling.build(context).navigate(). iOS: add via CocoaPods, then SPKRouter.create(withURL:) to push a controller or use SPKContainerView to embed a view.

Current Status

Public beta. Apache 2.0 license. Requires Node.js ^22 || ^24, pnpm v10. Android needs JDK 11+ and android-34 SDK, iOS needs Xcode 16+.

How It Works

1

`npm create sparkling-app@latest` creates project with Android/iOS native shells

2

Declare functions in TypeScript `.d.ts` โ†’ Sparkling Method CLI auto-generates Kotlin/Swift code

3

Inherit generated abstract class โ†’ implement native logic โ†’ call type-safely from JS

4

`hybrid://` URL scheme routes Lynx pages and native screens uniformly

5

`npx sparkling build` โ†’ `run:android/ios` for buildโ†’installโ†’run in one step

Use Cases

Building production infrastructure for Lynx-based cross-platform apps Gradually adding Lynx pages to existing native apps (Brownfield) Implementing type-safe native bridges based on TypeScript declarations

References