尚未收集仓库信息。
尚未检测到更新。GitHub 发布版本后会显示在这里。
制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗Royalty splitting for Nigeria's creative economy, powered by Stellar and Soroban.
SplitNaira is in active development. This repo currently contains: ..
contracts/ Soroban smart contract and testsfrontend/ Next.js + Tailwind scaffoldbackend/ Express API scaffolddemo/ Static HTML flow prototype# Copy the environment template, then set CONTRACT_ID and SIMULATOR_ACCOUNT.
# The backend will not start without them, and the frontend waits for it.
cp .env.compose.example .env.local
# Start the entire stack (Postgres + Backend + Frontend)
docker compose --env-file .env.local up --build
# Access the services:
# - Website: http://localhost:3000 (redirects to /en)
# - Application: http://localhost:3000/en/app
# - Backend API: http://localhost:3001
# - API Docs: http://localhost:3001/api/docs
The repository does not record a live contract deployment (
contracts/deployments.jsonis a placeholder). Deploy the contract to testnet first — see Contract Setup — and use its ID.
# Install all dependencies
npm run setup
# Development (all services)
npm run dev
# Build all projects
npm run build
# Run tests
npm run test
Prerequisites:
Use npm scripts from the root to run commands across all projects:
| Command | Description |
|---|---|
npm run setup | Install all dependencies for frontend, backend, and contracts |
npm run dev | Start frontend and backend development servers |
npm run dev:frontend | Start only frontend dev server |
npm run dev:backend | Start only backend dev server |
npm run build | Build all projects (frontend, backend, contracts) |
npm run build:frontend | Build frontend |
npm run build:backend | Build backend |
npm run build:contracts | Build smart contracts |
npm run test | Run all tests |
npm run test:frontend | Run frontend tests |
npm run test:backend | Run backend tests |
npm run test:contracts | Run contract tests |
npm run lint | Lint all projects |
npm run clean | Clean build artifacts |
npm run migration:dry-run | Recreate a dedicated local database and verify all backend migrations |
The docker-compose.yml provides a complete local stack for development and smoke testing:
Services:
postgres:16-alpine): Database with automatic initializationFeatures:
.env.compose.exampleQuick Commands:
# Start the stack
docker compose up
# Start in background
docker compose up -d
# View logs
docker compose logs -f backend # Backend logs
docker compose logs -f frontend # Frontend logs
docker compose logs -f postgres # Database logs
# Stop services
docker compose down
# Reset database (remove volumes)
docker compose down -v
# Rebuild images
docker compose up --build
Environment Configuration:
Copy .env.compose.example to customize the stack:
cp .env.compose.example .env.local
# Edit .env.local as needed
docker compose --env-file .env.local up
Accessing Services:
splitnaira, password: splitnaira)For production wallet and payment operations, configure PAYMENTS_ADMIN_API_KEY on the backend before exposing /splits/admin/*. If payout-impacting admin actions need to be frozen during an incident or rollback, set PAYMENTS_ADMIN_WRITE_ENABLED=false and redeploy or restart the backend with the updated environment.
Run these commands from the repository root. npm workspace commands use the
workspace path (-w frontend or -w backend) so that they work without
changing directories.
| Workspace | Command | Purpose |
|---|---|---|
| Frontend | npm run dev -w frontend | Start the Next.js development server. |
| Frontend | npm run build -w frontend | Create the production frontend build. |
| Frontend | npm run start -w frontend | Serve the built frontend. |
| Frontend | npm run lint -w frontend | Lint frontend source with zero warnings allowed. |
| Frontend | npm run test -w frontend | Run frontend Vitest tests. |
| Frontend | npm run check:i18n -w frontend | Verify every locale has the same message keys as English. |
| Backend | npm run dev -w backend | Start the API in watch mode. |
| Backend | npm run build -w backend | Type-check and build the API. |
| Backend | npm run start -w backend | Start the built API. |
| Backend | npm run lint -w backend | Lint backend source. |
| Backend | npm run format:check -w backend | Check backend TypeScript formatting without writing files. |
| Backend | npm run test -w backend | Run the backend Vitest suite. |
| Backend | npm run test:compat -w backend | Run split-route compatibility tests only. |
| Backend | npm run test:integration -w backend | Run the testnet integration suite. |
| Backend | npm run test:shutdown -w backend | Run graceful-shutdown integration tests. |
| Backend | npm run deps:check -w backend | Validate the backend dependency tree without optional packages. |
| Backend | npm run generate:openapi -w backend | Regenerate the backend OpenAPI output. |
| Backend | npm run validate:deploy-config -w backend | Validate backend deployment configuration. |
migration:run and migration:revert act on the database configured in
backend/.env; use them only with the intended environment. The dry-run
command has a separate, destructive-but-isolated database target.
cd frontend
npm install
npm run dev
cd backend
npm install
npm run dev
cd contracts
cargo test --locked
rustup target add wasm32v1-none
cargo build --release --target wasm32v1-none --locked
SplitNaira/
├── backend/ # Express API
├── contracts/ # Soroban smart contracts
├── frontend/ # Next.js application
└── demo/ # Static prototype
| Endpoint | Purpose |
|---|---|
/health/live | Liveness probe |
/health/ready | Readiness probe |
/health/startup | Startup probe |
Used for Kubernetes, Docker Swarm, and cloud deployment monitoring.
GET /metrics
All requests include:
X-Correlation-Id
Structured JSON logs are emitted for production monitoring.
Endpoint:
GET /ops/mainnet-readiness
Purpose:
This endpoint performs a lightweight operational check that includes:
Use it as a pre-deployment gate during release and rollback planning.
npm install
cp backend/.env.example backend/.env # fill in CONTRACT_ID, SIMULATOR_ACCOUNT, DATABASE_URL
cp frontend/.env.example frontend/.env.local
npm run dev
The backend validates its environment at startup and prints every missing or
invalid variable. CONTRACT_ID is checked against its StrKey checksum, so a
mistyped ID fails fast instead of on the first RPC call.
| Route | What it is |
|---|---|
/{locale} | Public website (en, fr) |
/{locale}/app | Wallet-connected application: dashboard, create, manage & distribute, projects |
/{locale}/dashboard/settings | Account settings |
/{locale}/receipts/{txHash} | Printable transaction receipt |
Token amounts are handled as integers of stroops (1 token = 10,000,000
stroops). The frontend parses user input with bigint
(frontend/src/lib/amounts.ts) and the backend stores amounts as validated
decimal strings (backend/src/lib/decimal-amounts.ts); floating-point maths is
never used to compute what is sent on-chain. The payout preview mirrors the
contract rule: each collaborator receives floor(balance × bps / 10000) and the
last collaborator receives the remainder.
Every wallet-signed action resolves only after the network confirms it. A transaction whose outcome is unknown (poll timeout or malformed RPC response) is shown as unconfirmed, and the same action stays blocked until "Check status" finds a final result, so a retry cannot pay twice.
npm run lint
npm run test
npm run analyze:bundle -w frontend
contracts/deployments.json is a placeholder;
deploy the contract and set CONTRACT_ID yourself.project_edit_history rows for
lock, metadata and collaborator changes are written when the unsigned
transaction is prepared, not when it confirms on-chain.POST /collaboration/projects/:id/transfer-ownership
re-syncs the owner from chain and does not submit the contract's
transfer_project_ownership; the on-chain owner remains authoritative.&. npm's .cmd shims break when the checkout
path contains &. Install with npm ci --ignore-scripts and invoke tools
with node node_modules/<tool>/..., or use a path without &.SplitNaira uses v0.x.y git tags for release traceability. A tag identifies the exact source state for backend, frontend, and smart contract code.
v0.x.y tag is pushed, using the release notes from CHANGELOG.md.contracts/target/wasm32v1-none/release/splitnaira_contract.wasmcontracts/target/wasm32v1-none/release/release-info.jsonCONTRACT_ID is the deployed contract address for the target network; it is recorded separately from the repo release tag.CHANGELOG.md up to date before tagging a release so GitHub Releases reflect the correct notes.Use the local Postgres migration dry-run runbook
to configure an isolated database safely before running npm run migration:dry-run.
SplitNaira is built for royalty splitting in Nigeria's creative economy and is structured to be reviewable by grant programs.
See GrantFox brief for the application-ready summary.
| Workflow | Trigger | Purpose |
|---|---|---|
ci.yml | push/PR to main | Full suite: data integrity, frontend, backend, contracts, security audit |
backend-deploy.yml | CI success on main / manual | Deploy backend to staging or production via Render |
mainnet-deploy.yml | Manual only | Production mainnet deploy with pre-flight validation gate |
user-onboarding-ci.yml | push/PR touching onboarding files | Validate register/login/profile routes end-to-end |
frontend-ci.yml | push/PR to main/develop | Frontend lint, test, build |
frontend-quality.yml | PR | Frontend quality gate (lint, test, build) |
contract-testnet-deploy.yml | push to main (contracts path) | Deploy Soroban contract to testnet |
smoke-testnet.yml | Manual | Post-deploy smoke test on testnet |
dependency-audit.yml | Weekly / manual | npm audit for high-severity vulnerabilities |
MIT
| Backend | npm run migration:run -w backend | Apply pending migrations to the configured DATABASE_URL. |
| Backend | npm run migration:revert -w backend | Revert the most recently applied migration on the configured DATABASE_URL. |
| Backend | npm run migration:dry-run -w backend | Recreate and migrate a dedicated dry-run database; see the migration runbook. |
| Contracts | npm run generate:contract-interface | Generate the contract interface JSON. |
| Contracts | npm run generate:contract-types | Generate the contract interface and backend TypeScript types. |
| Contracts | cd contracts && cargo build | Build the Soroban contract. |
| Contracts | cd contracts && cargo test | Run contract tests. |