Imported from utk2602/B3-Decentapp (
AGENTS.md). Install upstream withnpx skills add utk2602/B3-Decentapp. Copyright stays with the author.
Repository Guidelines
Project Structure & Module Organization
app/: Expo React Native client (Expo Router) with assets, components, and constants; entry viaapp/app/index.tsx.web/: Next.js marketing/site code undersrc/, with components insrc/componentsand styles insrc/app/globals.css.api/: Express + TypeScript fee-payer API; source insrc/, built output indist/.programs/key-registry/: Anchor/Solana program code (Rust) with instructions insrc/lib.rs; configured byAnchor.toml.- Root
Cargo.tomldefines the workspace for on-chain programs;target/is build output (avoid committing).
Build, Test, and Development Commands
- App: from
app/, install withnpm install; runnpm start(Expo bundler),npm run ios/androidfor simulators,npm run webfor browser preview. - Web: from
web/,npm installthennpm run dev(Next dev server),npm run buildfor production,npm run startto serve the build,npm run lintto check TS/JS. - API: from
api/,npm install,npm run devfor watch mode,npm run buildto emitdist/,npm startto run compiled server,npm test(Vitest). - Programs: from repo root,
anchor buildto compile on-chain code,anchor testto run Anchor/ts-mocha tests (usesAnchor.tomlprovider settings).
Coding Style & Naming Conventions
- TypeScript/TSX everywhere; prefer 2-space indentation, semicolons optional but stay consistent with touched files.
- React components: PascalCase filenames and exports; hooks/utilities in camelCase; keep modules co-located with feature folders.
- Linting via Next’s ESLint config in
web/; run lint before PRs. For Rust programs, runcargo fmt && cargo clippybefore pushing. - Environment values come from
.env/.env.local(never commit secrets).
Testing Guidelines
- API: Vitest for unit/integration; add tests alongside code under
api/src/**/__tests__or*.test.ts; ensure deterministic data and mocked RPC calls. - Programs: prefer
anchor testwith deterministic keypairs; document test accounts and airdrops used. - Frontends: add lightweight component tests when feasible (e.g., React Testing Library) and manual smoke (navigation, critical flows) before merges.
Commit & Pull Request Guidelines
- Commits: concise, imperative subjects (e.g.,
Add wallet validation,Fix fee payer rate limit). Squash noisy WIP commits before merging. - PRs: include what/why, linked issues, and testing notes/outputs (
npm test,anchor test, manual checks). Add screenshots for UI-facing changes. - Keep diffs minimal and isolated per domain (
app,web,api,programs). Update relevant configs/docs when adding env vars or migrations.
Security & Configuration Tips
- Keys and RPC endpoints belong in env files; prefer placeholders in commits. Rotate any leaked keys immediately.
- When running against Solana devnet/localnet, confirm
Anchor.tomlprovider cluster and wallet paths; avoid using production wallets for tests.