Skip to content
nirvanacpPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Genesis

Genesis is an Android app that runs apps you build on top of the websites you already use.

You describe the app you want to a coding agent: "a Hacker News app with a saved library and categories", "Gmail, but every email can become a reminder". The agent writes an applet, a phone UI that reads the real website underneath, signed in as you, and acts on it. Screens you designed look and behave like a native app. Pages you didn't redesign show the website itself, in the same session and history, so nothing the website can do is lost.

Genesis is an alpha. It runs five example applets today, and expect breaking changes until the first stable release. See download and status.

Why

Many websites are hard to use on a phone. Some have no app, and the apps that exist rarely do exactly what you want. You can't build your own app for a website you don't own, because you have no access to its server API.

The website does give you one thing. Its pages already open in a browser, signed in as you, with all your data on screen, and a person can read that data and press those buttons. Genesis lets your own code do the same, then draws your screens over the result. The website keeps its sign-in, cookies, server rules and history. Your applet owns the screens, the extra data and the rules you asked for.

An applet can:

  • show a website's pages as native screens, with tabs, loading skeletons, transitions and an Android Back button that works as expected;
  • act on the website: vote, follow, post with photos, fill and submit forms, using the website's own requests and your session;
  • add features the website doesn't have, such as categories for bookmarks, reminders on emails or search over saved items, with the data kept on the phone;
  • combine several websites in one app;
  • hand anything it doesn't customize back to the real website, including sign-in, captchas and settings.

How it works

┌─────────────────────────────────────────────────────────┐
│ Applet UI: your web app, in any framework               │  visible
│ screens, application rules, stored records              │
└──────────────┬──────────────────────────────────────────┘
               │ watches, inputs, navigation  (@nirvanacp/sdk)
┌──────────────▼──────────────────────────────────────────┐
│ Genesis                                                 │
│ Rust host: routes every message, deadlines, limits,     │
│            storage, services                            │
│ Java shell: windows, WebViews, Back, menus, downloads   │
└──────┬─────────────────────┬───────────────────┬────────┘
       │                     │                   │
┌──────▼───────┐     ┌───────▼──────┐     ┌──────▼───────┐
│ Context      │     │ Context      │     │ Servelet     │
│ real website │ ... │ real website │     │ Go + SQLite  │
│ + page agent │     │ + page agent │     │ (WebAssembly)│
└──────────────┘     └──────────────┘     └──────────────┘
  • Contexts are the live website sessions an applet declares, up to three. Each is an Android WebView (or GeckoView, chosen per applet) with its own history, loading the real website with your cookies. A context stays hidden while the applet shows its own screen for the page, and appears in place when it doesn't.
  • The page agent is Genesis code that runs inside every page on the applet's declared origins, before the website's scripts. The UI asks it to read the page into keyed JSON records, either with a JSON read specification or with readers in the applet's own page module. A watch sends the records once, then only what changes. The page agent also runs inputs on the page: click, fill, type, select, submit and more. It refuses password, one-time-code and payment fields.
  • The applet UI is a web app in its own WebView, built with any web framework. React bindings are included. For each page it decides whether to show its own screen or the website; the router helper makes that choice from a route table unless the applet sets its own rules.
  • The host is a Rust core that every message passes through. It counts each page load as a separate document, so an answer from a page the user has already left is dropped instead of shown. It owns the applet's storage, the deadlines and the limits.
  • The shell is the Android app in Java. It creates the windows and WebViews, the Genesis menu and the website bar, and handles Back, downloads, file uploads, permission prompts, sharing and notifications.
  • Servelets are an applet's optional backend: a small Go service with a SQLite database, compiled to WebAssembly and run by Genesis on the phone. There is no server to host and no account to create. Genesis keeps one database per servelet id, shared by the applets that bundle the same build of it, and tells the servelet which applet sent each request.

Website HTML never reaches the applet UI. The UI only sees the records a reader chose to extract. The website's own scripts never get Genesis's message channel, and page code can't reach the applet's storage or services.

The projects

Genesis is split into sibling repositories that sit side by side in one workspace folder. The folder itself is not a repository.

Project Location in the workspace What it is
Runtime runtime/, this repository Everything that runs applets on a device. Today that is the Genesis Android app: the Java shell, the Rust host, the servelet runtime and the APK build
Let let/ The framework applets and servelets are built with: @nirvanacp/sdk, @nirvanacp/let, the let-applet and let-servelet tools, the Go servelet library, and the instructions coding agents follow
Applets applets/ A plain folder of applet repositories, at any depth, such as the examples. An applet's servelet lives in its own repository, under servelets/<id>/

If you want to build an app, you only need the Let packages and the Genesis developer build. You don't need this repository, and you don't need to read any Java or Rust.

Download

Each release on the Genesis releases page holds:

File What it is
genesis-<version>.apk The app, app.nirvana.genesis
genesis-<version>-developer.apk Genesis Dev, app.nirvana.genesis.dev: the same app and bundled applets, debuggable, and it accepts development installs from the applet tools. It installs beside the app. Install it to build applets
genesis-<version>.aab The Android App Bundle of the app, for app stores
genesis-<version>-native-symbols.zip The unstripped native libraries, for reading crash reports
genesis-<version>.sigstore.json The build provenance attestation of the two APKs and the App Bundle
SHA256SUMS The checksums of the files above

Check the files you downloaded, then install over adb or by opening the APK on the phone:

shasum -a 256 --check --ignore-missing SHA256SUMS
gh attestation verify genesis-<version>.apk --owner nirvanacp --bundle genesis-<version>.sigstore.json
adb -s <serial> install genesis-<version>.apk

The attestation bundle on the release lets anyone with the GitHub CLI check that a file was built by the Genesis release workflow. The attestations are stored in the repository that builds the app, which is private, so gh attestation verify genesis-<version>.apk --repo nirvanacp/runtime, without --bundle, works only for members of the nirvanacp organization.

A version with a -, such as 0.3.0-beta.1, is published as a prerelease. Genesis runs on Android 8.0 (API 26) and later.

Example applets

Applet Website What it adds
Hacker News news.ycombinator.com Home, Search, Post, Saved and Me tabs, with a Saved library and categories stored in a servelet
X x.com Home, Explore, Notifications, Saved and Profile, a photo composer, and a private Categories library in a servelet
Instagram instagram.com Feed, stories tray, posts, comments, profiles, Explore, search, notifications and messages
Spotify open.spotify.com A native player frame over the web player: tabs, mini-player, Now Playing, albums, playlists, artists and search. In progress
Discord discord.com Direct messages, servers, channels and chat in a phone UI over the signed-in Discord session

Each one is its own repository with the applet at its root. The Hacker News and X applets keep their ids, hn-bookmarks and x-bookmarks, which are what Genesis and genesis.packages.json know them by.

For applet developers and testers

This section is for people who build or test applets and only need the app, not its source.

What Genesis is

Genesis is the Android app that runs applets. An applet is a bundle built with Let. It holds:

  • its own UI, a web app;
  • a page module that runs inside the website's pages;
  • an optional servelet.

Genesis opens the applet's websites in up to three contexts, hidden while the applet shows its own screens. Each applet has a Genesis menu with:

  • Open Genesis, back to the list of applets, where Add applet installs one;
  • Reload, Open in browser and Copy link;
  • View website, which shows the website itself;
  • Service connections;
  • Applet info: version, sites, website engine, data and removal.

Installing the APK

Genesis needs Android 8.0 (API 26) or later. Pick the APK from the Genesis releases page by what you do:

You want to Install Package
Use applets, or test released applets as users get them genesis-0.3.0.apk app.nirvana.genesis
Build applets and install your own builds over adb genesis-0.3.0-developer.apk (Genesis Dev) app.nirvana.genesis.dev

The two install side by side, each with its own applets and data. Install with adb -s <serial> install <file>, or open the APK on the phone and allow installs from that source.

Developer installs

Genesis Dev, and debug builds from source, accept applets from your computer. The regular app refuses them. The commands come from @nirvanacp/applet-tools. Each needs --device <serial> (from adb devices) and, for Genesis Dev, --application app.nirvana.genesis.dev:

Command What it does
let-applet dev install <dir> Copies the build into Genesis's private folder with adb run-as, opens Genesis, and waits up to 15 s for the receipt. It fails when Genesis refuses the bundle or lists it as incompatible
let-applet dev status [<applet-id>] Lists the installed applets with their revision and status, and each mismatched version for an incompatible one
let-applet dev cookies <dir> Copies the sign-in cookies for the applet's websites from a desktop Chrome started with --remote-debugging-port=9222. Only Android WebView sees them

When no receipt comes back (UNKNOWN_STATUS), open Genesis on the phone and run dev status.

Website engines

Each applet picks the engine that shows its websites, in Genesis menu > Applet info > Website engine:

Engine What it is
Android WebView (default) The phone's system WebView
GeckoView Firefox's engine, included in Genesis

The applet's own screens always use Android WebView. Switching reopens the applet. Each engine keeps its own sign-ins, so you sign in again after a switch. When a feature needs the other engine, Genesis offers to switch:

Feature WebView GeckoView
Google sign-in No: Google refuses embedded WebViews Yes
Sign-in import (dev cookies) Yes No
A separate sign-in per applet Only where the phone's WebView supports profiles Yes

GeckoView has no colour picker, and its full screen covers only the page that asked for it.

How servelets run

A servelet is a Go backend compiled to WebAssembly and bundled in the applet. The applet calls it as a local service, with genesis.services.request.

Rule Detail
One per id Genesis keeps one database per servelet id. The first applet that uses it becomes a member, and another applet joins only when it bundles the module (the same SHA-256) a member runs now. An applet that may not join gets a database of its own. Applets with the same build share one running instance
Updates A member keeps the database when its build changes: a newer build opens it and migrates it
The caller Each request carries the id of the applet that sent it. The servelet reads it with servelet.Caller(r); an applet cannot set it
Owners A servelet shared by several applets keeps each applet's data apart by the caller. A common pattern gives each namespace an owner: the applet that created it. Another applet's namespace answers 404, a request that would take it answers 409, and a namespace without an owner goes to the first applet that writes to it
Clearing data Clearing an applet's data deletes the database of a servelet only that applet bundles. For a shared one, Genesis instead sends the servelet an ERASE request for that applet, the servelet deletes what that applet owns, and the applet stops being a member; the database goes with its last member
Removing an applet Same as clearing for a shared servelet. When no installed applet bundles the servelet any more, its database is deleted
Lifetime A servelet starts with its first request and stops when no open applet uses it. Timers do not run between requests
One thread Every servelet runs on one worker thread, one request at a time

Limits

Limit Value
Website contexts per applet 3
Servelet request body and reply body 256 KiB each
Servelet time per request 5 s (10 times more for the module's start)
Servelet memory 256 MiB
Servelet SQL 10 000 rows and 4 MiB per query
Servelet log line 4096 bytes
Queued servelet requests 64 in all and 32 per applet, then QUOTA_EXCEEDED
Servelet instances kept running 3; the least recently used one stops first
Stored document 32 768 bytes
Message between the applet and Genesis 262 144 bytes
Picked files 16 files of at most 64 MiB each

A servelet whose servelet.json is not valid, whose interface version differs, or whose module does not match its recorded hash fails with SERVICE_FAILURE. The applet shows "This feature is temporarily unavailable. Try again in a moment."

Build your own applet

Applets are built with Let, in any directory; its quick start takes you from nothing to an applet on a device. You need Node 24.15.0 or later, a device or emulator with the Genesis developer build (download) reachable over adb, and Go 1.24 or later if your app needs a servelet. You don't need this repository.

npx @nirvanacp/applet-tools@0.3.0 create my-applet --origin https://example.com --name "Example"
cd my-applet
npm install
npm run check                              # manifest, compatibility, TypeScript and page module
npm run build                              # writes dist/ with the bundle
npx let-applet dev install . --device emulator-5554 --application app.nirvana.genesis.dev

dev install sends the last build to Genesis Dev, which imports it and answers with a receipt. The new applet carries Let's instructions for coding agents in let/; give an agent let/AGENTS.md and a request in your own words:

Read let/AGENTS.md. Build an app for https://example.com that keeps my reading list with tags and lets me search it.

The agent decides whether the app needs a servelet, inspects the website, writes the page module, the screens and the backend, and checks the result on the device. The getting started guide walks through the first watch and the first input, and the publishing guide covers releases that people add to Genesis from GitHub.

Build the Genesis app

Requirements:

  • Node 24.15.0 and npm 11.14.1 (.nvmrc names the Node version)
  • Rust 1.94.0 (rust-toolchain.toml installs the toolchain and Android targets) and cargo-ndk 4.1.2
  • The Android SDK with NDK 28.2.13676358, and ANDROID_HOME set
  • Go 1.24 or later, to build the servelets of bundled applets

android/tools/build.mjs checks each version and prints the install command for a missing one.

A debug build builds the bundled applets from their source, so it needs the whole workspace. Clone the repositories side by side in an empty folder:

git clone -b develop https://github.com/nirvanacp/let.git let
git clone -b develop https://github.com/nirvanacp/runtime.git runtime
mkdir applets
git -C applets clone -b develop https://github.com/nirvana-applets/hacker-news.git   # and any other applet

(cd let && npm ci && npm run typecheck)
node let/scripts/link-framework.mjs applets/hacker-news   # each applet builds against the Let checkout

cd runtime
npm ci
npm run workspace -- check     # Let and the applets are where genesis.workspace.json says
npm run check:packages
npm run build                  # native library, packages and bundled applets

# Build the APK and install it on one device.
ANDROID_SERIAL=emulator-5554 android/gradlew -p android :app:installDebug

A selected applet missing from the applets folder is taken from its pinned release instead. A release-type build takes every bundled applet from its pinned published release, so it needs this repository and Let at the tag the runtime's package.json version names, but no applet source:

git clone -b v<version> https://github.com/nirvanacp/let.git let   # the version in runtime/package.json
(cd let && npm ci)
cd runtime
npm ci
android/gradlew -p android :app:assembleRelease     # app-release.apk; :app:bundleRelease writes the .aab
android/gradlew -p android :app:assembleDeveloper   # app-developer.apk, Genesis Dev

Build types

Build type Application id Bundled applets Development installs
debug app.nirvana.genesis Built from source, or the pinned release when the source is missing Accepted
release app.nirvana.genesis Pinned published releases only Refused
developer app.nirvana.genesis.dev, version name ending in -dev, label "Genesis Dev" The same pinned releases as release Accepted

release and developer are signed with the key that four values name. Each comes from an environment variable, otherwise from the Gradle property after it, for example in ~/.gradle/gradle.properties:

Environment variable Gradle property
GENESIS_KEYSTORE_FILE genesis.keystore.file
GENESIS_KEYSTORE_PASSWORD genesis.keystore.password
GENESIS_KEY_ALIAS genesis.key.alias
GENESIS_KEY_PASSWORD genesis.key.password

Without all four, release is unsigned and developer is signed with the debug key, so it still installs.

Releases

A merge to main runs app-release.yml, which releases versionName from android/app/build.gradle.kts unless this repository already has the tag v<versionName>. It checks this repository out to runtime/ and Let, at the tag that this repository's package.json version names, to let/ beside it, runs the checks, builds assembleRelease, bundleRelease and assembleDeveloper, signs them with the key in the repository's secrets, makes the build provenance attestations, and publishes the files listed under download as a GitHub release of the public repository nirvanacp/genesis with the secret GENESIS_RELEASES_TOKEN. It then tags the commit v<versionName> here. A merge that leaves versionName unchanged releases nothing. Running the workflow by hand on main releases the same way; from another branch it is a dry run: it signs with a throwaway key and keeps the files as a workflow artifact.

Applets in the app

A debug or developer build accepts let-applet dev install over adb. A release build refuses it. Release builds install the applets bundled into the APK and the applets people add from Add applet in the Genesis menu, from a public GitHub repository or a downloaded bundle file. Genesis shows each build's origins and capabilities for review before installing it, and offers updates from the same source. In an applet repository, CI rebuilds every tagged version and publishes the release only when the rebuild matches the committed build; the publishing guide covers versions, tags and the reusable workflows, which live in the Let repository.

genesis.packages.json lists the applets bundled into the APK, by applet id: the id in the applet's applet.json, wherever its repository sits in the applets folder. An entry such as { "id": "hn-bookmarks", "drawer": true } also gives that applet its own icon in the Android app drawer, drawn from the manifest's shell.icon and accent color. An entry's release object pins the applet's published GitHub release:

{ "id": "hn-bookmarks", "drawer": true,
  "release": { "repository": "nirvana-applets/hacker-news", "tag": "v0.0.7", "sha256": "<SHA-256 of applet-hn-bookmarks.bundle.json>" } }

A release or developer build bundles only pinned releases, and fails when a selected applet has no release pin. It downloads applet-<id>.bundle.json and applet-<id>.release.json from the release into target/genesis/releases/, and fails unless the bundle's SHA-256 matches the pin and the release record, and the record is valid and names the applet and the pinned tag's version. A cached download that still passes these checks is reused, so a rebuild works offline; a damaged one is downloaded again. Each download times out after a minute. A debug build builds an applet from source when the applets folder has an applet with that id, and uses the pinned release otherwise. Two applets with one id in the applets folder fail the build.

Workspace

genesis.workspace.json says where the Let checkout and the applets folder are. Each directory is relative to this repository or absolute; the defaults are the siblings ../let and ../applets. npm run workspace -- <command> reads it:

Command What it does
path [let|applets] Prints the Let checkout or the applets folder (default)
applets Lists every applet in the applets folder: its id and directory. The finder looks up to six folders deep, stops at a folder with applet.json, and skips hidden folders, node_modules, build output, kit copies and servelets
repositories Prints this repository, Let and every git repository in the applets folder
check Fails with what to fix when Let or the applets folder is missing, or two applets share an id
typecheck Builds and typechecks the Let packages in the Let checkout (also npm run typecheck)

Let is its own npm workspace with its own lockfile; this repository has no npm dependencies of its own and imports Let's tools from the Let checkout. Each applet repository installs the framework from the Let checkout with node let/scripts/link-framework.mjs <applet repository>, which packs let/packages/* and installs them into the applet's node_modules without saving. A debug build of Genesis runs it by itself for each bundled applet when the framework files changed since the last run. let-applet publish refuses tools and an SDK that differ from the applet's committed lockfile, so a local framework never reaches a release.

Repository map

Path What it is
android/app/ The Java shell: the manager window, one window per applet, context WebViews and GeckoView pages, the website bar, the Genesis menu, the service HTTPS client
android/native/ genesis-host-android, the JNI binding built into libgenesis_host.so: it passes the shell's messages to the host and delivers the host's events and log lines back
android/tools/ The APK asset and native build (build.mjs), the service helpers and the benchmark
crates/host/ genesis-host, the portable Rust host with no Android code: applets, contexts, documents, messages, storage, services, compatibility, installs. A platform binding implements its EventSink and Logger traits
crates/contracts/ genesis-contracts: shell events and commands, document messages, manifest and bundle types, limits, error codes
crates/servelet-runtime/ genesis-servelet-runtime: runs a servelet's WebAssembly module over its SQLite database, with fuel, time and memory limits. servelet-run runs one on the computer
tools/ The workspace finder, the package checks and the git hooks
workspace/AGENTS.md The instructions for the workspace folder; copy it there
genesis.workspace.json Where Let and the applets folder are
genesis.packages.json The applets bundled into the APK

Other device runtimes are meant to sit beside android/, sharing crates/.

Status

What works today, on Android emulators and a physical Samsung phone:

  • the runtime: manifest schema 6, bundle format 3, document protocol 2, page control API 1, with @nirvanacp/sdk and the tools at 0.3.0;
  • up to three website contexts per applet, on WebView or GeckoView;
  • applet storage, HTTPS services with pinned certificates, and servelets on the phone;
  • installing applets from GitHub releases or bundle files, with review and updates;
  • a release workflow that builds the signed app, the App Bundle and Genesis Dev when a new version reaches main;
  • the Let packages ready to publish to npm when a new version reaches main of the Let repository;
  • browser features inside applets, including downloads, file uploads, popups, HTTP authentication and permission prompts.

Not done yet:

  • publisher signing for applets;
  • applet UIs in React Native or native Java or Kotlin, servelets in JavaScript, and servelets in the cloud;
  • iOS.

Genesis refuses an applet built for another version of the runtime and marks it as needing an update.

Contributing

Work in this workspace falls into three layers, each with its own instructions:

Layer Covers Instructions
Platform This repository and Let's packages, tools and guidance AGENTS.md
Applets An applet's page module, screens, rules and data let/factory/applets/AGENTS.md
Servelets An applet's Go backend let/factory/servelets/AGENTS.md

The instructions are written for coding agents and read just as well for people. AGENTS.md holds the rules for every repository of the workspace; copy workspace/AGENTS.md into the workspace folder so an agent started there finds it. They cover the workspace repositories, worktrees, branch names (feat/…, fix/…, docs/…), the commit format feat/(<area>): message, and the checks to run before committing. Pull requests go to develop. Run sh tools/git-hooks/install.sh once after cloning, and again after cloning another applet repository, to install the branch name hooks in every repository of the workspace.

Licence

MIT, see LICENSE.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages