tpt-cortex

Rust

Give PWAs native superpowers without an app store — a statically-typed DSL + lightweight VM that lets web apps declare background tasks, hardware access, and local data ops, executed by a native companion process. Rust engine, Go daemon, Svelte frontend.

1 stars0 forks1 watchers
bytecode-vmcompilerdslgolangnative-bridgeprogressive-web-appspwarustsveltevirtual-machine

Languages

Rust53.1%Go18.1%Kotlin13.7%Svelte13.7%TypeScript1.2%HTML0.1%JavaScript0.1%
README

TPT Cortex

Give PWAs native superpowers — without the app store.

TPT Cortex is a custom statically-typed DSL and lightweight VM that lets web apps declare background tasks, hardware interactions, and local data operations executed by a native companion process. No WebView jail. No Play Store. No iOS App Store.

Architecture

PWA (Svelte)  <──WebSocket──>  cortex-daemon (Go)  <──FFI──>  cortex-engine (Rust)
                127.0.0.1:9911                                  Lexer → Parser → VM

Components

ComponentLanguagePurpose
cortex-engineRustCompiler (lexer, parser, type checker, bytecode) + VM + CLI
cortex-daemonGoNative IPC host, WebSocket server, background scheduler
cortex-shellRustDesktop WebView host (Tauri WRY) — Phase 3
cortex-pwaSvelte + TSDemo PWA frontend — Phase 3
cortex-androidKotlinAndroid companion app (TPT Core) — Phase 4

Quick Start

# Phase 1 — compile a Cortex script
cargo run -p cortex-engine -- compile examples/hello.ctx --allow=native.log

# Phase 2 — run a Cortex script
cargo run -p cortex-engine -- run examples/hello.ctx --allow=native.log

The Cortex Language

task syncNotes(userId: string) -> void {
    let notes: list<string> = native.db.query("SELECT * FROM notes WHERE synced = 0");

    if native.net.isConnected() {
        let payload: string = native.json.encode(notes);
        native.http.post("https://api.example.com/sync", payload);
    }

    native.log("Done");
}

Roadmap

  • Phase 1 (Weeks 1–3): Core compiler — lexer, parser, type checker, CLI
  • Phase 2 (Weeks 4–6): VM — bytecode compiler, stack-based execution, op budgeting
  • Phase 3 (Weeks 7–9): Native bridging — Go daemon, IPC, Svelte PWA
  • Phase 4 (Weeks 10–12): Pulse daemon, background scheduler, Android companion

Distribution

TPT Core (Android) is distributed via direct APK download — no app store required.