Welcome! This guide helps you get from zero to a running local development environment. Thanks for your interest in contributing! This guide covers everything you need to get your local environment running and understand the development workflow.
| Tool | Version | Notes |
|---|---|---|
| Node.js | 18+ | nodejs.org |
| npm | bundled with Node | or pnpm / bun |
| Rust | stable | `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
| Soroban CLI | latest | cargo install stellar-cli --locked |
| Freighter wallet | latest | freighter.app — set to Testnet |
| Tool | Version | Purpose |
|---|---|---|
| Node.js | 18+ | Frontend development |
| npm or pnpm | latest | Package management |
| Rust | stable | Smart contract development |
| stellar-cli | latest | Contract build & deploy |
| Freighter | latest | Wallet for testnet interactions |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32v1-unknown-nonecargo install stellar-cli --lockedDownload the Freighter browser extension and switch it to Testnet in settings.
git clone https://github.com/FlowwStar/FlowStar.git
cd FlowStar
npm install # also installs Husky pre-commit hooks via prepare scriptcp .env.local.example .env.localThe example file has the testnet contract address pre-filled — no changes needed for local development. npm install
### 2. Set up environment variables
```bash
cp .env.local.example .env.local # if an example exists, otherwise create it
Create .env.local with:
NEXT_PUBLIC_STREAM_CONTRACT_ID=CBNDCZTRFNTDAPQLPK2ESOKO4XFMSC4PX37QE75BBYFOYIEWIPMHAKFVThe contract is already deployed to testnet — use this value as-is for local development.
npm run devOpen http://localhost:3000.
Set USE_MOCK = true in lib/contract.ts to run the app with local mock data instead of talking to the blockchain. This is the fastest way to work on UI changes without a Freighter wallet or testnet funds.
// lib/contract.ts
const USE_MOCK = true // ← flip thisMock streams are defined in lib/mock-data.ts. The app behaves identically — streams unlock in real time using client-side math.
feat/NNN-short-description # new feature
fix/NNN-short-description # bug fix
docs/NNN-short-description # documentation
perf/NNN-short-description # performance
Always include the issue number (NNN) in the branch name.
Follow Conventional Commits:
feat: add cliff amount input to create form (#42)
fix: correct unlock math for sub-second streams (#51)
docs: expand contributing guide (#163)
perf: remove unoptimized image flag (#158)
- Branch from
main. - One PR per logical change — keep diffs focused.
- Reference the issue:
Closes #NNNin the PR description. - All CI checks must pass before merge.
- At least one review approval required.
npm test # run once
npm run test:watch # watch modeTests live in lib/__tests__/. The suite covers unlock math, formatters, and utility functions.
npm run test:e2e # headless
npm run test:e2e:ui # interactive UI modeE2E tests require a running dev server (npm run dev in a separate terminal).
cd contracts
cargo test44 tests covering the full stream lifecycle, authorization, cliff edge cases, overdraw protection, and integer math.
To develop UI without a wallet or testnet connection, enable mock mode in lib/contract.ts:
const USE_MOCK = true;Mock mode uses the in-memory store in lib/mock-data.ts and bypasses all Freighter and RPC calls. Set USE_MOCK = false to switch back to the real contract.
feat/NNN-short-description # new features
fix/NNN-short-description # bug fixes
docs/NNN-short-description # documentation
chore/NNN-short-description # maintenance, deps
Where NNN is the GitHub issue number (e.g. feat/163-contributing-guide).
Follow Conventional Commits:
feat: add cliff amount validation (#42)
fix: correct unlock math for sub-second streams (#87)
docs: expand CONTRIBUTING.md (#163)
chore: bump soroban-sdk to v26 (#101)
- Fork the repo (external contributors) or create a branch (maintainers).
- Open a pull request against
main. - Fill in the PR template — summary, what was tested, any caveats.
- A maintainer will review. Address feedback by pushing new commits (don't force-push during review).
- PRs are squash-merged once approved and CI passes.
npm run testnpm run test:e2ePlaywright tests require the dev server to be running or will start it automatically depending on the config.
cd contracts
cargo test44 tests cover the full stream lifecycle, authorization, overdraw protection, cliff edge cases, integer math, and self-streams.
All contract source lives in contracts/streaming/src/.
cd contracts/streaming
stellar contract buildOutput: contracts/target/wasm32v1-none/release/flowstar_streaming.wasm
cd contracts
cargo test# Generate and fund a deployer key (first time only)
To run a single test:
```bash
cargo test test_withdraw_after_cliff# Generate and fund a deployer key (one-time)
stellar keys generate deployer --network testnet
stellar keys fund deployer --network testnet
# Deploy
stellar contract deploy \
--wasm contracts/target/wasm32v1-none/release/flowstar_streaming.wasm \
--source deployer \
--network testnetCopy the contract ID returned and update NEXT_PUBLIC_STREAM_CONTRACT_ID in .env.local.
- ESLint + Prettier (config in
eslint.config.mjsand.lintstagedrc) - Hooks in
hooks/, utilities inlib/, page components inapp/, shared components incomponents/ - Use
bigintfor all token amounts to match Sorobani128/u64types exactly
cargo fmt(rustfmt defaults)cargo clippyfor linting
Husky runs lint-staged on every commit:
| File type | Checks |
|---|---|
*.ts, *.tsx |
ESLint (auto-fix) + Prettier |
*.json, *.md, *.css |
Prettier |
*.rs |
cargo fmt --check |
To skip in an emergency: git commit --no-verify. Use sparingly.
If hooks aren't running after a fresh clone: npm run prepare.
Freighter not connecting
- Confirm Freighter is set to Testnet (not Mainnet or Futurenet)
- Try disconnecting and reconnecting the wallet from the app
- Disable other wallet extensions that might conflict
RPC connection failures
- The testnet RPC (
https://soroban-testnet.stellar.org) can be intermittently slow - Check Stellar status for outages
- Retry after a minute; requests are not queued
Contract deployment errors
- Ensure your deployer key is funded:
stellar keys fund deployer --network testnet - Check that
stellar-cliis up to date:cargo install stellar-cli --locked --force - Verify WASM output exists at
contracts/target/wasm32v1-none/release/flowstar_streaming.wasm
npm install fails on Husky
- Run
npm run preparemanually to re-install hooks - If on CI, set
HUSKY=0environment variable to skip hook installation
Copy the returned contract ID into your .env.local as NEXT_PUBLIC_STREAM_CONTRACT_ID.
- Linting: ESLint (
npm run lint) - Formatting: Prettier (
npm run format) - All new components go under
components/in the appropriate subdirectory (ui/,streams/,layout/,landing/). - Use
bigintfor all token amounts — nevernumber— to match Soroban'si128/u64types exactly.
Format before committing:
cd contracts/streaming
cargo fmt
cargo clippyFreighter not detected
- Make sure the extension is installed and enabled for
localhost. - Reload the page after unlocking Freighter.
- Check that Freighter is set to Testnet, not Mainnet or Futurenet.
RPC failures / transaction timeouts
- The Soroban testnet RPC can be intermittently slow. Retry the operation.
- Check Stellar Status for any ongoing incidents.
- If you see
insufficient resource fee, increase the fee buffer inlib/stellar.ts.
Contract deployment errors
- Ensure your deployer key has testnet XLM:
stellar keys fund deployer --network testnet. - If the WASM upload fails, try rebuilding:
stellar contract buildthen redeploy. Error: account not foundusually means the key isn't funded yet.
USE_MOCK = false but seeing mock data
- Hard-refresh the browser (
Ctrl+Shift+R) to clear any cached module state. - Confirm the env var
NEXT_PUBLIC_STREAM_CONTRACT_IDis set in.env.localand the dev server was restarted after the change.
By contributing, you agree that your contributions will be licensed under the MIT License.