Thank you for considering a contribution to Meridian. Meridian is an open-source stablecoin yield aggregator on Stellar and Soroban, and contributions across TypeScript, Rust, and frontend UI are welcome.
This document is the single source of truth for contributing. Please read it in full before opening an issue or pull request.
- Code of Conduct
- Ways to Contribute
- First-Time Contributors
- Prerequisites
- Getting Started
- Project Structure
- Opening Issues
- Security Vulnerabilities
- Branch Naming
- Commit Convention
- Code Standards
- Pull Request Process
- Running Checks Locally
- Getting Help
Participation in this project is governed by the Meridian Code of Conduct. By contributing, you agree to uphold it. Violations may be reported via GitHub Discussions (select the Q&A category and mark it private if needed).
In scope:
- Bug reports and bug fixes
- Features that have been discussed and approved in a GitHub Discussion
- Documentation -- README, JSDoc, guides, inline comments
- Additional test coverage for any package
- Performance improvements with benchmarks
- Dependency updates and CI improvements
Not accepted:
- Unsolicited refactors of code you did not introduce -- if cleanup is needed, open a
[Chore]issue first - Features that have not been approved in a GitHub Discussion -- PRs for unapproved features will be closed without review
- PRs that bundle multiple unrelated changes -- one PR per issue, always
- Changes to formatting or naming conventions that contradict the existing code style
If you are unsure whether a contribution fits, open a GitHub Discussion before writing any code.
If this is your first open-source contribution, start here:
- Filter issues by
good first issue-- these are fully isolated tasks that do not require deep knowledge of Stellar or Soroban. - Comment on the issue to signal you are picking it up before starting.
- Follow the Getting Started guide below to set up the project.
- When your PR is ready, follow the Pull Request Process section exactly.
Before cloning, confirm you have the required tools installed:
| Tool | Required version | Check |
|---|---|---|
| Node.js | 22.x |
node --version |
| pnpm | 9.x |
pnpm --version |
| Rust toolchain | stable (latest) | rustc --version |
| Stellar CLI | latest | stellar --version |
Rust and the Stellar CLI (cargo install stellar-cli; the binary is stellar, the older soroban-cli is deprecated) are only required if you are working on the smart contracts in packages/contracts. TypeScript-only contributors can skip them.
To install pnpm at the correct version:
npm install -g pnpm@9Meridian pins its supported Node.js and pnpm versions to ensure consistent local development and CI environments:
- Node.js: The supported Node.js major version is pinned in
.node-versionand.nvmrc(22). CI workflows (.github/workflows/ci.ymland.github/workflows/verify-contract-addresses.yml) read.node-versionviaactions/setup-node'snode-version-fileinput. - pnpm: The package manager is declared in
package.jsonunder"packageManager"(pnpm@9.0.0) and enforced in"engines". - Preinstall Enforcement: A preinstall check (
scripts/check-version.js) runs beforepnpm installto verify that the active Node.js and package manager versions match the repository pins. If an unsupported version is detected, it fails with a clear error message.
When upgrading the repository toolchain (e.g. migrating to a newer Node.js LTS or pnpm major version):
- Update
.node-versionand.nvmrc: Update the major version number (e.g.,22) in both.node-versionand.nvmrc. - Update
package.json:- Update
"packageManager"with the new target version (e.g.,"pnpm@10.0.0"). - Update the
"engines"field ("node"and"pnpm") to reflect the supported ranges.
- Update
- Update Documentation: Update the versions listed in the Prerequisites table in this file.
- Verify: Run
pnpm install,pnpm lint, andpnpm typecheckto confirm the new versions pass all checks.
-
Fork the repo on GitHub, then clone your fork:
git clone https://github.com/<your-username>/meridian.git cd meridian
-
Add the upstream remote so you can keep your fork in sync:
git remote add upstream https://github.com/drydocs/meridian.git
-
Before starting any work, sync your fork with upstream:
git fetch upstream git checkout main git rebase upstream/main
-
Install dependencies:
pnpm install
-
Copy and configure your environment:
cp .env.example .env
Edit
.envand set the values you need:Variable Required for Description PORTAPI Port for the Fastify API server. Default 3001.ALLOWED_ORIGINAPI CORS allowed origin. Default https://usemeridian.vercel.app.STELLAR_NETWORKAPI, SDK Target network: testnetormainnet. Defaultmainnet;.env.examplesetstestnetfor local dev.DEFINDEX_VAULT_IDAPI DeFindex vault contract address (C-address). Leave empty to disable DeFindex; only Blend positions are returned. VITE_API_URLWeb URL the web app uses to reach the API. Default http://localhost:3001.VITE_BLEND_FAUCET_URLWeb Overrides Blend's testnet faucet endpoint. Leave empty to use the default. -
Start the development servers:
pnpm dev # Web: http://localhost:3000 # API: http://localhost:3001 # Health: http://localhost:3001/health
-
Confirm the full check suite passes before making any changes:
pnpm lint && pnpm typecheck && pnpm test
Note: generated Soroban contract test snapshots under
packages/contracts/**/test_snapshotsare ignored by Git and should not be committed manually.
Meridian is a pnpm monorepo managed with Turborepo:
meridian/
apps/
web/ -- Vite + React frontend (Freighter wallet, yield dashboard)
api-local/ -- Fastify API, local dev only (yield aggregation, Soroban tx building)
docs/ -- Documentation site (VitePress)
landing/ -- Landing page
strategies/ -- Strategies simulation and visualization dashboard
api/ -- Vercel serverless functions (api/v1/...), the production API
packages/
api-core/ -- Framework-agnostic route handlers shared by both servers
contracts/ -- Soroban smart contracts (Rust)
sdk/ -- Public TypeScript SDK (@meridian/sdk)
shared/ -- Shared utilities used by both api and web
stellar-sdk-helpers/ -- Typed wrappers around @stellar/stellar-sdk
strategies/ -- Strategy engine and simulation library (@meridian/strategies)
Changes to packages/ affect multiple apps. If you modify a shared package, run the full check suite from the repo root.
Use one of the two GitHub issue templates. Blank issues are disabled.
Every issue title must use the bracket prefix format:
[Type] Short imperative description
| Prefix | When to use |
|---|---|
[Bug] or [Fix] |
Something is broken or behaving incorrectly |
[Feature] |
New capability or significant enhancement |
[Frontend] |
Frontend-scoped work (React, UI, Tailwind) |
[Test] |
Adds or improves test coverage |
[Docs] |
Documentation, README, JSDoc, guides |
[Chore] |
Refactor, cleanup, dependency update, CI |
- Bug Report -- for anything broken, incorrect, or behaving unexpectedly
- Feature Request -- for features, frontend tasks, tests, docs, and chores
Apply labels from all three categories before submitting. PRs linked to unlabelled issues will be asked to add labels before review begins.
| Category | Pick | Options |
|---|---|---|
| Purpose | one | bug, enhancement, docs, testing, chore, security |
| Area | all that apply | frontend, api, sdk, contracts, ci, ui, i18n, stellar, soroban |
| Complexity | one | trivial, medium, hard |
Use good first issue in place of a complexity label for tasks that are fully isolated and require no Stellar or Soroban knowledge.
Do not open a public GitHub issue for security vulnerabilities.
Report security issues via GitHub's private vulnerability reporting. Include:
- A description of the vulnerability
- Steps to reproduce
- Potential impact
- Any suggested fix (optional)
You will receive a response within 72 hours. Please allow time for the issue to be triaged and patched before public disclosure.
All branches must follow this pattern:
<type>/<short-description>
Types: feat, fix, docs, chore, refactor, test, ci
Examples:
feat/freighter-wallet-integration
fix/apy-cache-stale-data
docs/blend-integration-guide
test/yield-routing-edge-cases
Branches that do not match this pattern will fail the branch naming ruleset and cannot be merged.
Meridian uses Conventional Commits. Every commit must follow this format:
<type>[(<scope>)]: <subject>
Types: feat, fix, test, docs, refactor, perf, chore, ci
Scopes (optional): Use the relevant package or app: api, web, contracts, sdk, shared, ci, docs
Rules:
- Subject line under 72 characters
- Use imperative mood: "add" not "added" or "adds"
- No period at the end of the subject
Examples:
feat(api): add Blend pool APY aggregation endpoint
fix(sdk): handle Soroban RPC timeout on testnet
test(api): add edge case coverage for empty pool response
docs: update CONTRIBUTING with Soroban contract standards
chore: pin Node.js to v20 in GitHub Actions workflow
Issue references (
Closes #N) go in the PR body, not in commit messages. Squash merge is enforced -- the PR title becomes the squash commit, so issue refs in individual commits are discarded.
Commits that do not match the ^(feat|fix|docs|chore|refactor|test|style|ci|perf)(\(.+\))?: .{1,72}$ pattern will be blocked by the commit message ruleset.
When a change alters an accepted architectural decision, update the relevant
ADR or add a new one in apps/docs/architecture/adr/.
Use the ADR template, update the
index, and link the record from the
affected architecture documentation. Routine changes that do not alter an
architectural decision do not need an ADR.
- Formatting: Run
pnpm formatbefore committing. Prettier with default settings. - Linting: Must pass
pnpm lintwith zero errors. - Types: No
any. Useunknownand narrow explicitly. Zod schemas are the source of truth for all external data shapes. - Naming:
PascalCasefor types, interfaces, classes, and React componentscamelCasefor variables, functions, and object keysUPPER_SNAKE_CASEfor module-level constantskebab-casefor filenames
- Error handling: Never swallow errors silently. Log with context and re-throw or return a typed error result.
- No side effects at module load time. Protocol clients must be instantiated inside functions, not at the top level of a module. Module-level
localStorage,navigator, or SDK.init()calls are violations. - Comments: Only comment on WHY, not what the code does. If the code needs a what-comment, the code should be rewritten.
- Formatting: Run
cargo fmt --allbefore committing. - Linting: Must pass
cargo clippy --all-targets -- -D warningswith zero warnings. - Naming:
snake_casefor functions and variablesPascalCasefor types and traitsUPPER_SNAKE_CASEfor constants
- Error handling: Use
Result<T, E>everywhere. No.unwrap()in contract code except on values that are provably infallible; explain why in an inline comment. - Adding a
ContractErrorvariant: When adding a new variant toContractErrorin any contract crate (vault,blend-adapter,defindex-adapter, ormusdc-token), assign the next unusedu32discriminant (never reuse or renumber existing codes), add a///doc comment explaining when it is raised, and document the variant with its cause and recommended client/operator response inapps/docs/architecture/contract-errors.md. Runpnpm --filter @meridian/docs test(included inpnpm test) to verify every variant is cataloged. - Documentation: All public functions must have doc comments (
///). Include a one-line summary and a note on any panics or preconditions. - Security: Validate all inputs. Assume callers are adversarial. Never read from storage without checking the key exists first.
Each contract's release WASM has a size budget in packages/contracts/wasm-size-budgets.json, keyed by the WASM file name (meridian_vault, meridian_blend_adapter, ...). The Soroban Contract Tests CI job builds the contracts, then runs pnpm check:wasm-size, which prints each contract's size, budget, share of the budget used and the delta from the PR's base commit (also shown in the job summary). It fails when a contract is over its budget, when a newly built contract has no budget, or when a budgeted contract was not built. The job only runs when contract sources, build settings or the check itself change.
To check locally (needs the wasm32v1-none target; uses stellar contract build when the Stellar CLI is installed, cargo build --target wasm32v1-none --release otherwise):
pnpm check:wasm-size -- --build # sizes vs budgets
pnpm check:wasm-size -- --build --base-ref main # plus the delta from mainUpdating a budget. When a contract grows on purpose, raise its number in wasm-size-budgets.json in the same PR and say in the PR description what grew and why; reviewers treat the budget change as an explicit sign-off on the larger binary. For a new contract, add an entry. Budgets are set to roughly the current size plus 10%, rounded up to a whole KiB, so routine changes don't need an update but significant growth gets a deliberate review.
Every PR must use this structure (the GitHub PR template pre-fills it):
## Summary
- What changed and why (bullet points, not a list of files touched)
## Test plan
- [ ] `pnpm lint && pnpm typecheck && pnpm test` pass locally
- [ ] What you manually verified
Closes #NCloses #N must reference the issue this PR resolves. PRs with no linked issue will not be reviewed.
Maintainers own the changelog. Contributors do not need to update it.
- One PR per issue. Do not bundle multiple issues into a single PR.
- Keep PRs small. A PR that changes more than 400 lines of non-test code will be asked to split.
- Fill out the PR template fully. Incomplete templates will be closed without review.
- All CI checks must pass before a review will begin. Do not open a PR with known failures.
- Resolve all review comments before requesting a re-review. Mark a thread as resolved only after you have addressed it.
- Do not force-push after a review has started. Add new commits to address feedback so the reviewer can see what changed.
- Squash on merge is enforced. Your commit history inside the branch does not need to be clean, but your PR title must follow the commit convention -- it becomes the squash commit message.
Pull requests are reviewed within 72 hours of submission. You will receive one of:
- Approved -- the PR will be merged promptly
- Changes requested -- address the comments and request a re-review
- Closed -- the PR is out of scope, a duplicate, or does not meet the standards in this guide; the closing comment will explain why
All GitHub Actions workflows under .github/workflows/ define explicit concurrency groups and per-job timeouts:
- Concurrency groups are keyed by workflow and ref (
${{ github.workflow }}-${{ github.ref }}). - Pull request workflows (
ci.yml,pr-title.yml,verify-contract-addresses.yml) setcancel-in-progressfor pull request runs so pushing a new commit cancels superseded runs on the same ref. - Default branch and keeper runs are never cancelled by concurrency (
cancel-in-progressis disabled for pushes tomainand forkeepers.yml), ensuring scheduled keeper runs and main-branch checks run to completion. - Job timeouts (
timeout-minutes) are set explicitly on every job, sized above observed runtimes so hung installs, builds, or tests fail promptly instead of waiting for the default 6-hour limit. When adding a new job or workflow, always include both aconcurrencyblock and an explicittimeout-minutesvalue.
Run all checks before pushing. CI will catch failures, but fixing them locally is faster.
# Full check suite (run this before every push)
pnpm lint && pnpm typecheck && pnpm test
# Individual checks
pnpm lint # ESLint across all packages
pnpm typecheck # tsc --noEmit across all packages
pnpm test # Vitest across all packages
pnpm coverage # Vitest with coverage thresholds across all packages
pnpm format # Prettier (auto-fix)
pnpm lint:md # markdownlint (config: .markdownlint.json)
pnpm check:links # Internal links and heading anchors in all Markdown (needs lychee)
# Run tests for a single package
pnpm --filter @meridian/stellar-sdk-helpers test
# Run a single test file
pnpm --filter @meridian/stellar-sdk-helpers exec vitest run src/tx.test.ts
# Soroban contract checks (only needed when modifying packages/contracts)
cargo fmt --all
cargo clippy --all-targets -- -D warnings
cargo test --allWhen introducing a new error code or status mapping in packages/api-core:
- Define the error code string and handler response shape in
packages/api-core. - Add the code, status, trigger condition, retry guidance, and recommended client action to the catalog in
apps/docs/architecture/api-errors.md. - If introducing a new user-fixable Soroban contract error mapping, add it to
USER_FIXABLE_CONTRACT_ERRORSinpackages/api-core/src/tx.tsand document it in the Contract Simulation Errors table. - Run
pnpm --filter @meridian/docs testto verify the catalog is complete.
The Docs Lint & Links CI job runs when a pull request (or a push to main) touches Markdown, apps/docs, or the checker configs. It runs pnpm lint:md and pnpm check:links, which are strict: a broken relative link, root-relative VitePress link, or heading anchor fails the job. External links are checked with pnpm check:links:external, which only warns on pull requests. Install the link checker locally with brew install lychee (or cargo install lychee).
Hosts that block or rate-limit CI runners, and GitHub-relative links such as ../../issues, are allowlisted in lychee.toml; add a comment explaining any new entry. Heading anchors must resolve on both GitHub and VitePress, so avoid apostrophes and other punctuation in headings that are linked to.
The e2e suite (apps/web/e2e/) drives the real apps/web and apps/api-local dev servers with a real headless browser via Playwright. It hits the real API and real Stellar testnet RPC end to end; only Freighter's wallet-signing step is mocked (see apps/web/e2e/fixtures.ts), since a real browser extension can't run in CI. Only needed when modifying apps/web, apps/api-local, or anything the deposit/withdraw/vault-list flows depend on.
# One-time: install the browser binary
pnpm --filter @meridian/web exec playwright install chromium
# Run the full suite (boots both dev servers automatically)
pnpm --filter @meridian/web test:e2e
# Interactive UI mode, useful for debugging a failing spec
pnpm --filter @meridian/web test:e2e:uiThis suite is a blocking CI check. Tests that depend on live testnet RPC or other external services
(such as the vault-list APY/TVL/route assertions) stub the API with page.route() to keep the
suite deterministic. Real testnet RPC is still exercised in the deposit/withdraw tx-build specs, which
accept valid RPC failure states as expected outcomes. Before merging a PR, this job must pass (see #535).
- Questions about an issue? Comment on the issue directly.
- Dev setup broken? Open a GitHub Discussion under the Q&A category.
- Found a bug not covered by an existing issue? Open a new issue using the Bug Report template before starting any work.
- Have a feature idea? Open a Discussion first. Do not open a PR for a feature that has not been discussed and approved.
- Security issue? Use GitHub private vulnerability reporting -- do not open a public issue.
By contributing to Meridian, you agree that your contributions will be licensed under the project's MIT License.