个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证制作者的介绍仅有上面的一句话。 更多详情请阅读仓库 README。 仓库 README ↗
正在加载完整 README。
查看完整 README ↗Sandbox prototype of Mesura, a controlled virtual card for online payments (initial market: Togo). The user decides HOW MUCH a card can spend, WHERE it can be used, HOW MANY times, and HOW LONG it stays active.
Sandbox only. No real money moves, no real Visa/Mastercard is issued, no Mobile Money request is sent and no KYC provider is called. All external partners are fake providers behind interfaces, so they can later be replaced by regulated partners.
apps/
api/ NestJS + Prisma + PostgreSQL (modular monolith)
mobile/ Expo (React Native) + Expo Router + TanStack Query
packages/
shared/ Enums, money helpers, Zod request schemas, API response types
config/ Shared strict tsconfig
legacy/
flutter-prototype/ Earlier UI-only Flutter mock (kept for reference)
Architecture, data model, endpoint list and build phases: docs/ARCHITECTURE.md.
corepack enable)pnpm install # also generates the Prisma client
pnpm build:shared # compiles packages/shared (API and app import it)
Start Postgres (skip if you already have one):
docker run -d --name mesura-db -p 5432:5432 -e POSTGRES_USER=mesura -e POSTGRES_PASSWORD=mesura -e POSTGRES_DB=mesura postgres:16
Configure and migrate:
cp apps/api/.env.example apps/api/.env
# set JWT_SECRET (≥ 32 chars):
node -e "console.log(require('crypto').randomBytes(48).toString('base64url'))"
pnpm db:migrate # applies prisma/migrations
pnpm db:seed # merchants, demo user, demo cards and activity
Neon: put the pooled connection string in DATABASE_URL and the direct one in DIRECT_URL
(both with ?sslmode=require), then run pnpm --filter @mesura/api prisma:deploy and pnpm db:seed.
Demo account created by the seed: [email protected] / demo1234 (KYC verified, 4 cards, mixed activity).
pnpm api:dev # http://localhost:3000
cp apps/mobile/.env.example apps/mobile/.env
# EXPO_PUBLIC_API_URL must be reachable from the device:
# iOS simulator / web: http://localhost:3000
# Android emulator: http://10.0.2.2:3000
# Phone with Expo Go: http://<your computer's LAN IP>:3000
pnpm mobile:dev # then press a (Android), i (iOS), w (web) or scan the QR code
The APK is a standalone release build (JS bundled, signed with the debug key — for testing only).
On the phone: install the APK and open it. The build on main (the tester APK, see /testeurs)
uses the hosted sandbox API and shows no server picker. To point a build at another API — for example
your computer on the same Wi-Fi, http://192.168.1.20:3000 (start it with pnpm api:dev) — run the
workflow by hand with server_picker ticked, or build with EXPO_PUBLIC_SERVER_PICKER=true: the
Log in / Sign up screen then shows Serveur API (sandbox) → Modifier (always shown in development).
Build it yourself (needs JDK 17+ and the Android SDK with NDK 27.1):
cd apps/mobile
npx expo prebuild --platform android --no-install
cd android && EXPO_PUBLIC_API_URL=http://10.0.2.2:3000 ./gradlew assembleRelease \
-PreactNativeArchitectures=arm64-v8a -Pexpo.useLegacyPackaging=true
# → apps/mobile/android/app/build/outputs/apk/release/app-release.apk
Or on GitHub: the Build Mesura Android APK workflow builds it on every push touching the
mobile app and uploads it as the mesura-sandbox-apk artifact; on main it also republishes it on the testeurs
release (set the repository variable PO_API_URL to change the built-in server).
Plain http:// is allowed in this sandbox build (plugins/with-sandbox-cleartext.js) so a LAN
API works; a production build must use an https:// API and drop that plugin.
The Play Store variant (africa.mesura.app, https-only, no server picker) is built as a signed AAB by the
Release Android (Play Store AAB) workflow. Listing texts, visuals, Play Console answers and the signing
procedure are in docs/play-store/README.md.
Or drive it from the command line (merchant charging a card):
curl -X POST localhost:3000/sandbox/transactions \
-H "Authorization: Bearer $TOKEN" -H 'content-type: application/json' \
-d '{"cardId":"<id>","merchant":"CANVA","amount":5650,"currency":"XOF"}'
# → {"status":"APPROVED", ...} or {"status":"BLOCKED","reason":"MERCHANT_NOT_ALLOWED", ...}
pnpm test # CardPolicyEngine unit tests (Jest)
pnpm typecheck # shared + api + mobile, strict TypeScript
pnpm --filter @mesura/api smoke # end-to-end API scenario against a running API + seeded DB
apps/api/.env)| Variable | Default | Meaning |
|---|---|---|
SANDBOX_MODE | true in .env.example | Enables /sandbox/*. When false those routes return 404. |
SANDBOX_FUNDING_AUTO_CONFIRM_SECONDS | 10 | Fake Mobile Money auto-approval delay (0 = manual only). |
SERVICE_FEE_BPS | 500 | Illustrative fee, in basis points (5 %). |
FREE_CARDS_PER_PERSON | 0 | Cards per person funded without the fee. A person = verified identity + Mobile Money number, tracked by fingerprints that survive account deletion. |
FINGERPRINT_SECRET | (derived from JWT_SECRET) | Key of those fingerprints (≥ 32 chars). Set it before real users sign up and never change it. |
FEDAPAY_SECRET_KEY | (empty) | FedaPay key for real Mobile Money. Empty = simulated. sk_sandbox_… = FedaPay test mode (test number approved, a number ending in 99 declined). sk_live_… = real money, refused unless FEDAPAY_ALLOW_LIVE=true. |
FEDAPAY_PAYOUTS_ENABLED | false | Send refunds of unspent card balances (Mixx by Yas, formerly TMoney, only) with FedaPay payouts, once FedaPay's support has enabled payouts on the account. false = refunds simulated. Required with a live key. |
FUNDING_EXPIRY_MINUTES | 15 | A pending Mobile Money request expires after this. |