Skip to content

Latest commit

 

History

History
70 lines (51 loc) · 3.06 KB

File metadata and controls

70 lines (51 loc) · 3.06 KB

Contributing to Hashport

Thanks for helping build the Stellar wallet that lives in WhatsApp.

Setup

git clone https://github.com/chillwur/GFMiHashport.git
cd GFMiHashport
pnpm install
cp apps/frontend/.env.example apps/frontend/.env.local
cp apps/backend/.env.example  apps/backend/.env
pnpm dev:infra   # starts local Postgres + Redis via Docker Compose
pnpm dev

The .env.example credentials already match the docker-compose.yml services, so the backend can connect to DATABASE_URL/REDIS_URL with no further configuration. Data persists across restarts in named Docker volumes; run pnpm dev:infra:down to stop the containers.

For contract work you additionally need Rust (stable) with the wasm32v1-none target and, ideally, the stellar CLI:

rustup target add wasm32v1-none
cargo install --locked stellar-cli

Where things live

  • apps/frontend — Next.js landing page/dashboard
  • apps/backend — Fastify WhatsApp webhook + Stellar services; the chat grammar is src/lib/commands.ts, chain access is src/services/stellar.ts
  • contracts/hashport-account — Soroban smart account (Rust)

Before you open a PR

Run the same checks CI runs:

pnpm lint
pnpm typecheck
pnpm test
pnpm build
# if you touched the contract:
pnpm contracts:test
pnpm contracts:build

Pre-commit hook

pnpm install sets up a Husky pre-commit hook that runs lint-staged on your staged files — ESLint + Prettier on staged .ts/.tsx files under apps/*, and cargo fmt --check on staged .rs files under contracts/*. It only touches what you staged, so it stays fast; it's not a substitute for the full checks in "Before you open a PR" above.

In exceptional cases you can skip it with git commit --no-verify, but fix any resulting lint issues before opening the PR — CI still runs the full checks.

Conventions

  • Branches: feat/<topic>, fix/<topic>, docs/<topic>.
  • Commits: Conventional Commits (feat:, fix:, chore:, docs:, test:).
  • New chat commands need: parser case in lib/commands.ts, handler in services/router.ts, tests in test/commands.test.ts, and a line in HELP_TEXT.
  • Never commit secrets. .env files are gitignored; only .env.example files belong in the repo. If a change adds an env var, document it in the workspace's .env.example and the root .env.example map.
  • Default to testnet in all examples, tests, and defaults.
  • Logging: Use Fastify's structured logger (app.log). Avoid logging raw secrets (tokens, keys, passwords). Sensitive properties and headers (like Authorization, Stellar keys, and WhatsApp tokens) are automatically redacted in the logger configuration. Default log levels are debug in development and info in production, configurable via the LOG_LEVEL environment variable.

Reporting issues

Use the issue templates. For anything security-sensitive (key handling, webhook auth, contract auth), do not open a public issue — email the maintainers instead.