Skip to content

Valenced Architecture & Overview

Valenced is a next-generation modular client modification framework for modern Android Discord. Operating as an Xposed module within the Discord application process, it hosts a custom Hermes JavaScript engine running Hermes Bytecode v96.


Execution Layers

Valenced plugins execute across two distinct environments:

  • Native Android (DEX): Pre-compiled Kotlin/Java bytecode loaded by DexClassLoader into Discord\'s ClassLoader during early process initialization. Operates low-level view hierarchy hooks, Android canvas/OpenGL rendering, hardware sensors, and Xposed method hooks.
  • Hermes JavaScript: TypeScript sources bundled by @valenced/plugin-cli into Hermes Bytecode v96. Manages React Native UI components, settings screens, Flux store subscriptions, and chat row modifications.

The Bi-directional Valenced Bridge

Kotlin native code and Hermes JavaScript communicate synchronously and asynchronously across the bridge: * Kotlin: registerNativeMethod("plugin.id.method") { args -> ... } * JavaScript: callNativeMethod("plugin.id.method", [args]) or callNativeMethodSync(...)


Lifecycle Architecture

Plugins transition through four formal lifecycle phases: - preInit: Native JARs load into the ClassLoader. External plugins evaluate in Hermes JS before Metro modules load. Never access UI or Flux proxies at module scope. - init: Core framework bindings and settings stores are initialized. - start(api): Plugin entrypoint fires. Modules and stores resolve lazily. All hooks and listeners are registered via api.cleanup(...). - stop() / api.cleanup(): Every patch, interval, and listener is dismantled deterministically.


Valenced Documentation Directory