How joshua-onyekachukwu/lockedin works
Purpose and Runtime
Lockedin is a stake-backed behavioral commitment platform: users create protocols, fund a vault, submit evidence, receive witness decisions, and accrue penalties when requirements are missed. It is a TypeScript TanStack Start/React client backed by Convex server functions and database; Vercel hosts the frontend and Convex hosts backend/API jobs.
Entry points: src/client.tsx, src/router.tsx, src/routes/__root.tsx, and Convex HTTP surface convex/http.ts.
Client Routing and Access Gates
TanStack Router maps product surfaces to route modules. Main authenticated user flows are dashboard, vault detail, wallet, community, and leaderboard; public sharing has its own route. Auth callback and verification routes establish/gate access before normal product workflows.
Paths: src/routes/dashboard.tsx, src/routes/vault.$id.tsx, src/routes/wallet.tsx, src/routes/verify-required.tsx, src/routes/share.$vaultId.tsx.
Authoritative Domain Model
Convex owns persistent state and business invariants. The schema defines users, vaults/protocols, goals, check-ins/evidence, witness relationships, payments, wallet/ledger activity, penalties, notifications, and audit-oriented records. Client UI should consume Convex query/mutation APIs rather than duplicate lifecycle rules.
Paths: convex/schema.ts, convex/goals.ts, convex/vaultLifecycle.ts.
Protocol and Evidence Lifecycle
Protocol creation produces an unfunded vault and linked goal. Funding or wallet activation moves eligible vaults active. Users submit pending check-ins with notes and proof images; assigned witnesses approve/reject with written reports. Lifecycle logic manages status transitions, penalties, credits/shields, and downstream notifications/rewards.
Paths: convex/goals.ts, convex/verifications.ts, convex/penalties.ts, convex/rewards.ts.
Money Movement and Wallet Boundary
Paystack is the external payment processor for protocol funding, with initialization, verification, reconciliation, and webhook handling isolated in backend modules. Wallet supports balances, activation from available funds, withdrawal requests/cancellation, and admin-managed processing. Do not treat frontend payment status as authoritative; webhooks/reconciliation and Convex mutations establish final state.
Paths: convex/payments.ts, convex/http.ts, src/routes/wallet.tsx, src/components/dashboard/fund-protocol-modal.tsx.
Identity, Authorization, and Verification
Convex Auth provides sign-in. Email verification gates most app access. Admin operations require authenticated and verified users plus both a persisted admin flag and allowlisted email. Mono is the supported identity/KYC integration; direct public BVN lookup is disabled. Security and rate limiting are backend responsibilities.
Paths: convex/auth.ts, convex/emailVerification.ts, convex/security.ts, convex/rateLimit.ts, convex/mono.ts.
Community, Administration, and Automation
Partner/witness relationships support discovery, recruitment, reporting, and community-facing integrity signals. Admin routes provide user review, transaction/payment operations, lifecycle overrides, and audit access. Convex crons drive scheduled lifecycle/penalty work; notifications provide user-facing follow-up.
Paths: convex/partners.ts, convex/admin.ts, src/routes/admin.tsx, convex/crons.ts, convex/notifications.ts.
Operations and Integrations
Deployment coordination is critical: frontend VITE_CONVEX_URL, Convex deployment, and Paystack webhook target must all reference the same environment. External services include Paystack, Mono, Google OAuth, Resend email, optional Sentry, and Vercel. The client includes an installable PWA shell and offline fallback.
Paths: app.config.ts, vercel.json, public/sw.js, convex/sentry.ts.
Main entry points: dashboard.tsx Product routes · client.tsx Client entry & router · payments.ts Wallet & payments · goals.ts Protocol lifecycle
Components 18
React client
- Client entry & router
src/client.tsx - Product routes · Dashboard, vault, wallet, community, and leaderboard surfaces.
src/routes/dashboard.tsx - Access & sharing routes · Verification-gated access and public vault sharing.
src/routes/verify-required.tsx - Funding UI
src/components/dashboard/fund-protocol-modal.tsx - PWA offline shell
public/sw.js
Convex backend
- Domain schema · Persistent users, vaults, goals, evidence, payments, ledger, and audit records.
convex/schema.ts - Protocol lifecycle · Creates goals and vaults, then governs activation and status transitions.
convex/goals.ts - Evidence & witness review · Manages pending check-ins and witness approval or rejection reports.
convex/verifications.ts - Penalties & rewards · Applies missed-requirement penalties, credits, shields, and rewards.
convex/penalties.ts - Wallet & payments · Authoritative funding, reconciliation, wallet activation, and withdrawals.
convex/payments.ts - HTTP & webhooks · Receives external webhook traffic.
convex/http.ts - Identity & access control · Auth, verification, admin authorization, and rate limiting.
convex/auth.ts - Mono KYC · Supported identity/KYC integration; public BVN lookup is disabled.
convex/mono.ts - Partners & administration · Witness relationships, integrity signals, admin review, overrides, and audits.
convex/admin.ts - Scheduled follow-up · Runs lifecycle and penalty work and triggers user notifications.
convex/crons.ts
External services
- Paystack
- OAuth, email & KYC services · Google OAuth, Resend email, and Mono support identity workflows.
- Vercel & deployment config · Frontend, Convex URL, and webhook target must use the same environment.
vercel.json
Connections 21
- Client entry & router → Product routes: renders
- Client entry & router → Access & sharing routes: routes through
- Client entry & router → PWA offline shell: installs
- Product routes → Identity & access control: requires access gate
- Product routes → Protocol lifecycle: queries and mutates
- Product routes → Evidence & witness review: submits and reviews evidence
- Funding UI → Wallet & payments: initiates funding
- Wallet & payments → Domain schema: persists authoritative state
- Protocol lifecycle → Domain schema: creates and transitions
- Evidence & witness review → Protocol lifecycle: drives protocol outcomes
- Penalties & rewards → Domain schema: records penalties and rewards
- Scheduled follow-up → Penalties & rewards: runs
- Partners & administration → Evidence & witness review: manages witness relationships
- Partners & administration → Identity & access control: enforces admin policy
- HTTP & webhooks → Wallet & payments: reconciles payment events
- Paystack → HTTP & webhooks: sends webhooks
- Wallet & payments → Paystack: initializes and verifies payments
- Identity & access control → OAuth, email & KYC services: uses auth and verification services
- Mono KYC → OAuth, email & KYC services: connects KYC provider
- Vercel & deployment config → Client entry & router: hosts frontend
- Vercel & deployment config → HTTP & webhooks: coordinates environment endpoint