run these from the root folder: bun run build:core (Jab Rust me change ho) bun run dev:frontend (UI start karne ke liye)# PocketChain Frontend
PocketChain is a Solana wallet-style application built as a monorepo with a Next.js frontend and a Rust backend compiled to WebAssembly. The frontend handles the UI and browser state, while the Rust package generates the mnemonic phrase and derives Solana public keys.
apps/frontend- Next.js application that renders the wallet UI.packages/core- Rust crate that compiles to WebAssembly and exposes wallet helpers.- Root scripts - convenience commands for building the Rust package and running the frontend.
Frontend:
- Next.js
16.2.6 - React
19.2.4 - React DOM
19.2.4 - TypeScript
5.x - Tailwind CSS
4.x - ESLint
9.x - UI helpers:
shadcn,radix-ui,lucide-react,class-variance-authority,clsx,tailwind-merge,tw-animate-css
Backend:
- Rust
2024edition wasm-bindgen0.2.92bip392.2.2slip100.4.3bs580.5.1ed25519-dalek2.1.1getrandom0.2.14with thejsfeature for browser-compatible randomness
The frontend layer is built using vibe-coding and manual edits. The backend logic was coded manually in Rust and exposed to the browser through WebAssembly.
At runtime the page loads the WASM module, then calls exported Rust functions from the Next.js client component. The generated data is kept in localStorage so the wallet state survives refreshes.
The connection happens through the generated package in packages/core/pkg/core.js. The frontend imports the WASM initializer and the exported Rust helpers directly:
import init, {generate_mnemonic_phrase, derive_solana_public_key} from "../../../../packages/core/pkg/core.js";The Rust side exposes those functions with wasm_bindgen:
#[wasm_bindgen]
pub fn generate_mnemonic_phrase() -> String {
let mnenomic = Mnemonic::generate(12).expect("Failed to generate mnemonic!");
mnenomic.to_string()
}
#[wasm_bindgen]
pub fn derive_solana_public_key(phrase: &str, account_index: u32) -> String {...}The frontend initializes the WASM module before using those helpers:
await init();
setIsReady(true);git clone <your-repo-url>
cd pocketChainAfter cloning, install dependencies using the package manager you use in this workspace, then build the WASM package and start the frontend.
From the repository root:
bun run build:core
bun run dev:frontendbun run build:core rebuilds the Rust WASM package after backend changes.
bun run dev:frontend starts the Next.js app in development mode.
You can also work directly inside the frontend app:
cd apps/frontend
bun run dev- Start from a clean main branch.
- Create a branch per issue, fix, or feature.
- Keep the branch name descriptive and short.
- Make your changes in the smallest useful slice.
- Rebuild the backend WASM package when Rust code changes.
- Run the frontend locally and verify the UI still works.
- Open a pull request from the feature branch.
Example branch names:
git checkout -b feature/add-wallet-actions
git checkout -b fix/derive-key-validation
git checkout -b chore/readme-updateSuggested branch flow:
git checkout main
git pull origin main
git checkout -b feature/your-change- The frontend is intentionally lightweight and focused on the wallet experience.
- The Rust backend is the source of truth for mnemonic generation and Solana key derivation.
- If you change anything inside
packages/core, rebuild the WASM package before testing the UI.