Thanks for helping build Heliobond — a green-bond investment app on Stellar that opens green investing to everyone, from one dollar. The same values we promise users (transparency, plain language, no dark patterns, accessibility) apply to how we build: in the open, kindly, and to a high bar.
- Live demo: https://heliobond.vercel.app
- Architecture:
ARCHITECTURE.mdmaps every surface to its Soroban contract calls, data sources and client functions. - Repository layout: the
## Structuresection ofREADME.md. - Code of conduct:
CODE_OF_CONDUCT.md
There's a lane for most skill sets — pick by what you enjoy:
| Lane | Examples |
|---|---|
| Frontend (React / TypeScript) | screens, components, the WebGL Helio, tests |
| Smart contracts (Rust / Soroban) | the registry + vault, wiring live reads/writes |
| Localization (no deep code needed) | translate the creator/admin/project surfaces, add a locale |
| Accessibility | WCAG audit passes, keyboard / screen-reader fixes |
| Design | extend the token system, motion, specimen cards |
| Docs | improve guides, examples, this file |
- Browse good first issues and help wanted, or this project on GrantFox.
- Claim it before you start — comment on the issue (or apply via GrantFox) so it's assigned to you and we avoid duplicate work. Every issue states its scope and acceptance criteria.
- No issue for your idea? Open a Feature request first so we can agree on scope before you build.
We don't merge unsolicited PRs that aren't tied to an accepted issue — it keeps the queue clean and your time well spent.
Prerequisites: bun 1.4.5 (the package manager / runner) and Node 22+.
git clone https://github.com/Heliobond/frontend.git
cd frontend
bun install
bun run dev # http://localhost:3000Useful scripts — run these before opening a PR:
bun run build # production build (must pass)
bun run typecheck # tsc --noEmit
bun run lint # ESLint
bun run format:check # Prettier — check only
bun run format # Prettier — rewrite files in place
bun run test # Bun unit + component test suite
bun run test:coverage # Bun with the coverage thresholds CI enforces
bun run test:e2e # Playwright end-to-end tests (dev server)
bun run test:e2e:production # Playwright against a production build with CSP enforced
bun run test:e2e:chain # Playwright against a local Stellar network (see below)
bun run typecheck:coverage # fails on any `any` in src/ (local only, not in CI)
bun run bundle:check # bundle budgets against .next/ (run after build)
bun run start # serve the production buildOnly build, test:coverage and start are used by CI; the rest are the
checks you run locally before you open a PR.
- Install with bun only. A
preinstallguard (scripts/require-bun.mjs) makesnpm,yarnandpnpminstalls fail.bun.lockis the only lockfile; CI fails ifpackage-lock.json,yarn.lockorpnpm-lock.yamlis committed. - Release-age cooldown.
bunfig.tomlsetsminimumReleaseAgeto 3 days, so bun will not install a version published less than 3 days ago. For a hotfix that must ship sooner, add the package tominimumReleaseAgeExcludesinbunfig.toml, with a maintainer's sign-off. - Lifecycle scripts are off by default. bun runs a dependency's install
scripts only if it is in
trustedDependencies. Keep that list empty unless a maintainer has reviewed the script. - Supply-chain checks in CI.
scripts/lockfile-lint.mjsasserts everybun.lockentry comes from the npm registry with an integrity hash. The audit gate (scripts/audit-gate.mjs) fails on high and critical advisories. Exceptions live inscripts/audit-allowlist.json, each with a reason and an expiry date.
The project uses Bun’s test runner with jsdom and
@testing-library/react
for component rendering. Runner setup and discovery are configured in bunfig.toml.
bun run test # run the full suite
bun run test src/wallet/vault.test.ts # run a single fileStructure. Unit and component tests are co-located with the code they
cover, as <Name>.test.ts / <Name>.test.tsx next to <Name>.ts(x) — e.g.
src/components/Button.test.tsx, src/wallet/vault.test.ts,
src/hooks/useSessionTimeout.test.ts. Tests that cover cross-cutting behaviour
rather than a single module (i18n catalog parity, shared bond math, contrast
ratios) live in src/__tests__/. Bun discovers tests under src/ and scripts/.
Import test APIs from @/test/bun.
Helpers. A shared render helper lives in src/test/render.tsx. It wraps
components in the LocaleProvider (i18n) and ThemeProvider the app uses at
runtime, so component tests get a realistic context instead of a bare tree.
Import render (and re-exported @testing-library/react utilities like
screen, fireEvent) from there instead of from @testing-library/react
directly:
import { render, screen, fireEvent } from '@/test/render'
test('renders the primary label', () => {
render(<Button variant="primary">Continue</Button>)
expect(screen.getByRole('button', { name: 'Continue' })).toBeVisible()
})If a test needs next-intl strings, they come from messages/en.json via the
helper's LocaleProvider. Add new unit tests next to the code under test.
bun run test:coverage # run bun test with Istanbul instrumentation and enforce the thresholdsCI runs bun run test:coverage, so an unmet threshold fails the check even when
the tests pass.
scripts/test-coverage-config.mjs defines the source scope, exclusions, and
thresholds. The report includes eligible files that the tests never import. A
doc test checks that each configured threshold is listed below.
| Threshold key | Minimum |
|---|---|
src/lib/api.ts |
80% lines / statements / functions |
src/wallet/vault.ts |
80% lines / statements / functions |
src/lib/webauthn.ts |
80% lines / statements / functions |
src/lib/yieldAlerts.ts |
80% lines / statements / functions |
src/lib/recurringInvestments.ts |
80% lines / statements / functions |
src/lib/scrollToError.ts |
80% lines / statements / functions |
src/lib/errorMessages.ts |
80% lines / statements / functions |
src/wallet/registry.ts |
80% lines |
src/lib/** |
55% lines |
src/wallet/** |
55% lines |
src/session/** |
55% lines |
src/hooks/** |
55% lines |
src/config/** |
55% lines |
src/alerts/** |
50% lines |
The global floor for all of src/ is 50% lines / statements / functions and 40%
branches. The directory floors exist to stop regressions, so raise them as
admin.ts, registry.ts or useVault.ts gain tests.
New code under src/ counts against these thresholds, so run
bun run test:coverage (not just bun run test) before pushing. The report
lands in coverage/ (text summary in the terminal, HTML in
coverage/index.html). Add tests alongside the change rather than lowering a
threshold.
Playwright drives a real Chromium browser against the
running Next.js dev server (config: playwright.config.ts — single Chromium
project, dev server started automatically unless one is already running).
bun run test:e2e # headless Chromium (starts dev server automatically)Structure. E2E specs live in e2e/ as <flow>.spec.ts (e.g.
e2e/deposit.spec.ts), one file per user-facing flow, grouped with
test.describe. There's no page-object layer yet — specs query the DOM
directly via Testing-Library-style locators (page.getByRole(...),
page.getByText(...)).
Helpers. Because the wallet integration needs a real browser extension,
specs seed a demo session via page.addInitScript before navigating, so the
flow under test never depends on an actual Stellar wallet:
async function seedDemoWallet(page: Page) {
await page.addInitScript(
({ address }) => {
localStorage.setItem('hb-address', address)
localStorage.setItem('hb-wallet', 'demo')
},
{ address: DEMO_ADDRESS },
)
}Follow e2e/deposit.spec.ts as the template for a new flow: seed whatever
session state the flow needs, page.goto() the route, then assert each step
of the flow in order with expect(locator).toBeVisible() /
toBeDisabled().
To test CSP and security headers against an enforce-mode production build without colliding with the backend API on port 3001:
bun run test:e2e:productionThis starts a fresh production server on dedicated port 3200 (configurable via E2E_PRODUCTION_PORT), disables server reuse (reuseExistingServer: false), and verifies security headers without interference from .env.local or running backends on port 3001.
The run sets E2E_PRODUCTION=true and targets e2e/security-headers.spec.ts. That flag makes playwright.config.ts build the app and serve it on dedicated port 3200 with CSP_MODE=enforce, so assertions run against the enforcing Content-Security-Policy header instead of the Content-Security-Policy-Report-Only variant: no 'unsafe-eval', no ws: and no http://localhost anywhere in the policy, upgrade-insecure-requests present, and no CSP violations recorded on tested routes.
Run it whenever you touch src/proxy.ts, src/lib/securityHeaders.ts or anything inlined into <head>. It needs a full build, so it is slower than bun run test:e2e, and it is not part of standard CI.
Heliobond includes automated accessibility tests powered by @axe-core/playwright in e2e/a11y.spec.ts. The audit checks all public routes and authenticated flows across both light and dark themes against WCAG 2.0 and 2.1 AA rules.
bun run test:e2e # runs the full Playwright suite including a11y specsThe test fails on any serious or critical violation. Detailed results and violation objects are attached to the Playwright test report. Known pre-existing issues are tracked in the commented KNOWN_VIOLATIONS allowlist with links to their tracking GitHub issues.
e2e/chain/investor-journey.spec.ts builds, signs and submits real Soroban
transactions, so it runs against deployed contracts on a local network and
needs a different config: playwright.chain.config.ts (testDir: ./e2e/chain,
base URL http://localhost:3100, override with E2E_CHAIN_PORT).
Prerequisites, none of which this repo installs for you:
-
Docker, running quickstart with RPC and Horizon on port 8000:
docker run -d --rm -p 8000:8000 --name stellar stellar/quickstart:latest \ --local --enable core,rpc,horizon --limits unlimited
-
The
stellarCLI onPATH(CI pins 26.1.0). -
Rust with the
wasm32v1-nonetarget (rustup target add wasm32v1-none), because the setup script builds the contracts unless you point it at prebuilt WASM viaCONTRACTS_WASM_DIR. -
Access to
Heliobond/contracts, which the script clones into.e2e/(gitignored) atCONTRACTS_REF. -
Playwright Chromium:
bunx playwright install --with-deps chromium.
Then, from the repo root:
scripts/e2e/setup-local-network.sh # fund accounts, deploy contracts, write env
bun run test:e2e:chain # build + serve on :3100, then run the journeyThe setup script writes e2e/chain/.env.chain.local (gitignored, throwaway keys
only) and playwright.chain.config.ts loads it automatically; override the path
with E2E_CHAIN_ENV. RPC_URL, HORIZON_URL, FRIENDBOT_URL,
CONTRACTS_DIR, CONTRACTS_REF, CONTRACTS_WASM_DIR and OUT_ENV are the
script's env knobs. It provisions e2e-admin, e2e-issuer and e2e-investor
via friendbot, issues and deploys USDC, then deploys ProjectRegistry and
InvestmentVault.
The journey itself is one long test (connect -> explore -> project -> deposit ->
portfolio -> withdraw -> claim yield) with a 5-minute timeout and 30s expect
timeouts, single worker, traces and video retained on failure under
test-results/chain and playwright-report/chain. Tear the network down with
docker rm -f stellar when you're done.
CI runs this same command nightly and on demand via
.github/workflows/e2e-chain.yml (45-minute budget), not on pull requests.
When updating Soroban contract interfaces or after a contracts release, refresh the committed fixtures in src/test/fixtures/contracts/ using:
./scripts/contracts/update-specs.sh # uses nearby WASMs or builds contracts@main
CONTRACTS_WASM_DIR=path/to/wasm ./scripts/contracts/update-specs.sh # use another prebuilt WASM directory- Branch off
main:git checkout -b <type>/<short-description>(e.g.feat/withdraw-max-chip,fix/helio-glow,i18n/creator-screens). - Make focused changes — one issue per PR.
- Run the checks locally:
bun run build(must pass),bun run typecheck,bun run lint,bun run format:check, andbun run test. Addbun run test:coveragewhenever you touchsrc/lib/orsrc/wallet/— CI enforces those thresholds, andbun run testdoesn't. - If your change is user-facing or otherwise notable (a feature, a fix, a
breaking change), add an entry under
[Unreleased]inCHANGELOG.md— see that file's "How entries are added" section for the format. Purely internal changes (refactors, tooling, formatting) don't need one. - Open a PR using the template; link the issue with
Closes #123. - CI runs two jobs on every pull request and on pushes to
main(.github/workflows/ci.yml):build(bun run build) andunit tests + coverage(bun run test:coverage). There is no CI job for lint,format:checkor the Playwright suites, so those are yours to run locally.mainmust be protected so that green CI and human maintainer review are required before merge (branch protection is tracked in #912).
- Human Approval Required: No pull request can be merged automatically. At least one human approval from a repository maintainer (or CODEOWNER) is required before code lands on
main. - Advisory Automated Review: The DeepSeek AI review workflow (
auto-review.yml) is strictly advisory. It provides helpful PR summary comments but has no permission to approve PRs or trigger merges. - Least-Privilege Workflows: Workflows running on
pull_request_targetoperate with least-privilegeGITHUB_TOKENcredentials (read-only repository contents access). Administrative Personal Access Tokens (OWNER_PAT) are strictly prohibited in public workflow runs. - Enforced Status Checks: Branch protection on
mainmust require the two CI checks —buildandunit tests + coverage— to pass prior to merging. Nothing else is a required check: the DeepSeekauto-review.ymlrun is advisory, ande2e-chain.ymlis nightly/on-demand rather than per-PR.
CODEOWNERS assigns maintainer review for sensitive areas — the wallet integration, design tokens, i18n catalogs, CI, and the supply-chain files (package.json, lockfiles, .husky/, scripts/, lint/build/test configs). Ownership is enforced only once branch protection requires code-owner review (#912).
Reviewing a fork branch runs its code on your machine, so treat it as untrusted (see the supply-chain policy in SECURITY.md):
- Read the diff in raw form before running anything:
git diff main...<branch> -- package.json bun.lock .husky .github scripts '*.config.*'. The GitHub diff view hides long whitespace runs, so thehidden-content checkandsupply-chain review gatechecks are the reliable signal. - Check the fork owner and the author match, and that new root-level files are expected.
- Do not run an untrusted branch on a machine that holds wallet secret keys or long-lived deploy tokens. Use a container or a Codespace, and make sure
.env*.localcontains only testnet values. - Install with
bun install --frozen-lockfileonly after step 1. Lifecycle scripts run during install, so check any new dependency'sscriptsfield first. - Apply the
supply-chain-reviewedlabel only after the changes in the job summary are understood. After a new push, remove and re-add it once the new commits are reviewed.
Heliobond uses next-intl with cookie-based locale
selection. Five message catalogs ship, one per locale: messages/ar.json,
messages/en.json, messages/es.json, messages/fr.json and
messages/pt.json (the list lives in src/i18n/config.ts and is wired up in
src/i18n/LocaleProvider.tsx; ar is right-to-left). The request config in
src/i18n/request.ts loads the matching catalog for the current locale.
When you add or change user-facing copy:
- Pick the namespace that matches the surface using the copy, such as
Nav,Footer,Landing,Deposit, orProjectDetail. - Add the same key path to all five catalogs —
ar.json,en.json,es.json,fr.json,pt.json. The catalogs must stay in parity:src/__tests__/catalog-parity.test.tscompares every catalog againstenkey-for-key in both directions and fails the build on a missing or extra key, and it runs as part ofbun run testand CI. - Translate the value in every catalog. Do not leave English placeholder text in the non-English catalogs unless the issue explicitly calls for a temporary fallback.
- Read the key from code with
useTranslations('<Namespace>'), then callt('<key>'). For example:
import { useTranslations } from 'next-intl'
export function Example() {
const t = useTranslations('Creator')
return <h1>{t('title')}</h1>
}To add a new namespace for a new screen or surface:
- Create the namespace object in all five catalogs with identical keys:
{
"Creator": {
"title": "Build your project"
}
}- Add the translated values under the same namespace and key names in
ar.json,es.json,fr.jsonandpt.json. - Use that namespace from the component with
useTranslations('Creator'). - Run
bun run test(which includes the parity test) plusbun run buildorbun run typecheckbefore opening the PR. Note what each one catches: the parity test catches keys missing from any catalog, whiletypecheckonly catches missing or misspelled keys in English —src/i18n/next-intl.d.tstypesMessagesastypeof en, sotsccannot see a key that exists only infr.json(or the other three).
To add a locale, use a lowercase BCP 47 language
code
as the catalog filename and update every locale registry in
src/i18n/config.ts:
- Add the code to
LOCALES. - Add its short switcher label to
LOCALE_LABELSand its native display name toLOCALE_NAMES. - Add its Open Graph
language_TERRITORYvalue toOG_LOCALES. - If the language is right-to-left, add it to
RTL_LOCALES. The root layout reads this set and appliesdir="rtl"; otherwise, leave the locale out so it uses left-to-right layout. - Create
messages/<code>.jsonby copying the key structure ofmessages/en.json, then translate every value. The server request config loads the catalog dynamically, andLocaleProvider.tsxalso imports the selected catalog dynamically, so neither file needs a per-locale import. - Update
src/__tests__/catalog-parity.test.ts: import the new catalog and add it toNON_ENso key, ICU argument, and translation checks cover it.
Verify the new locale with:
bun run test -- src/__tests__/catalog-parity.test.ts
bun run typecheck
bun run buildFor a documentation-only verification, a maintainer should add a throwaway locale using only these steps, run the commands above, and remove the temporary catalog and registry entries afterward.
- Builds and type-checks clean.
bun run buildis the gate; noanyto paper over types, no@ts-ignorewithout a comment. - Follow the design system. Use the CSS custom properties (
var(--ink),var(--solar), …) — never hardcode colours. SeeREADME.mdandsrc/styles/tokens/. - Brand rules checklist. Every PR touching UI copy or design must meet all of the following:
- Sentence case — no all-caps headlines.
- Mono tabular numerals for figures.
- Every delta carries a
+/−sign and arrow; colour is never the sole carrier. - Solar is never the sole carrier of meaning (and never text on a light background).
- No emoji in the product.
- No exclamation marks on financial copy.
- User-facing strings are translated. If you add or change copy in the shell or translated screens, add the key to all five catalogs (
ar,en,es,fr,pt) — the parity test insrc/__tests__/catalog-parity.test.tsfails the build otherwise. - Accessibility is not optional. Keyboard operable, visible focus, semantic landmarks,
prefers-reduced-motionrespected, touch targets ≥ 44px. - No secrets in the repo or in client code.
- The issue's acceptance criteria are met.
- CI is green; the PR is reviewed and approved.
- UI changes include before/after screenshots (or a short screencast).
- Docs/translations updated where relevant.
- Bugs: open a Bug report issue with steps to reproduce.
- Security: please do not open a public issue. Use GitHub's "Report a vulnerability" (Security tab) for a private advisory.
The project ships a Husky pre-commit hook
in .husky/pre-commit, and it is already active on a fresh clone — there is
nothing to opt in to. bun install runs the prepare script ("prepare": "husky") in package.json, which points core.hooksPath at .husky/_. Check
it with:
git config core.hooksPath # -> .husky/_What it actually runs — .husky/pre-commit is two commands:
bunx lint-staged, which per.lintstagedrc.jsonrunseslint --fixthenprettier --writeon staged*.{ts,tsx,js,jsx}files, andprettier --writeon staged*.{json,md,yml,yaml}files. Only staged files are touched, and because these commands write, their fixes land in your commit — keep unrelated files unstaged so you don't sweep formatting changes into a focused PR.bun run typecheck(tsc --noEmit) over the whole project.
No tests run on commit. Run bun run test, and bun run test:coverage when
you touched src/lib/ or src/wallet/, yourself before pushing — CI runs the
unit suite with coverage thresholds but not the Playwright suites.
Opting out, if you need to:
HUSKY=0 bun install # skip installing the hook (per install)
git commit --no-verify # skip the hook for one commit
git config core.hooksPath /dev/null # disable it for this clonebun run prepare re-installs it, and git config --unset core.hooksPath undoes
the clone-wide opt-out. Contributors who skip the hook are still expected to run
the checks in the Development workflow section.
By contributing, you agree to abide by the Code of Conduct.