@@ -13,10 +13,12 @@ SplitPro is a **Next.js PWA** expense-splitting app (Splitwise alternative). Cor
1313
1414### 1. ** BigInt for All Financial Values**
1515- ** All amounts are stored and computed as ` BigInt ` , never floats** to prevent rounding errors
16- - When displaying: convert via ` toUIString() ` (divides by 100 for cents)
17- - When receiving input: convert via ` toSafeBigInt() ` (multiplies by 100)
18- - ` BigMath ` utility provides safe arithmetic operations
19- - Read: ` README.md ` FAQ and ` jest.config.ts ` for BigInt JSON serialization
16+ - Use ` getCurrencyHelpers({ currency, locale }) ` from ` src/utils/numbers.ts ` to get currency-aware helpers:
17+ - ` toUIString(value) ` - Display BigInt as formatted currency (divides by 100 for cents)
18+ - ` toSafeBigInt(input) ` - Parse user input to BigInt (multiplies by 100)
19+ - Access these via ` CurrencyHelpersContext ` in React components
20+ - ` BigMath ` utility (` src/utils/numbers.ts ` ) provides safe arithmetic: ` abs ` , ` sign ` , ` min ` , ` max ` , ` roundDiv `
21+ - ** Jest setup** : ` BigInt.prototype.toJSON ` is defined in ` jest.config.ts ` for JSON serialization
2022
2123### 2. ** Double-Entry Balance Accounting**
2224Every expense creates ** two balance records** (bidirectional):
@@ -85,7 +87,22 @@ pnpm db:studio # Open Prisma Studio GUI
8587pnpm db:seed # Seed database with dummy data
8688```
8789
88- ** Pre-commit hooks** (Husky): prettier + oxlint auto-fixes. Override with ` git commit --no-verify ` .
90+ ** Pre-commit hooks** (Husky):
91+ ``` bash
92+ pnpm lint-staged # Runs prettier on staged files
93+ pnpm tsgo --noEmit # TypeScript type checking without emit
94+ ```
95+ Override with ` git commit --no-verify ` if needed.
96+
97+ ## Environment Setup
98+
99+ Environment variables are validated via ` @t3-oss/env-nextjs ` in ` src/env.ts ` . Required variables:
100+ - ** Database** : ` DATABASE_URL ` or separate ` POSTGRES_* ` vars
101+ - ** Auth** : ` NEXTAUTH_URL ` , ` NEXTAUTH_SECRET ` , OAuth provider credentials (Google/Email SMTP)
102+ - ** Storage** : R2/S3 credentials (` R2_* ` or ` AWS_S3_* ` variables)
103+ - ** Optional** : Bank integration (Plaid/GoCardless), currency rate API keys, push notification VAPID keys
104+
105+ For local dev: run ` pnpm d ` to start PostgreSQL + MinIO in Docker. Access MinIO console at ` http://localhost:9001 ` (user: ` splitpro ` , pass: ` password ` ) to create access keys.
89106
90107## Data Flow Specifics
91108
@@ -113,6 +130,7 @@ GroupBalance(groupId, currency, userId, firendId) // note: typo "firendId"
113130- ** Currency Rates** : Pluggable providers (Frankfurter, OXR, NBP) in ` currencyRateService.ts `
114131- ** i18n** : next-i18next with Weblate; always add English keys first, let community translate
115132- ** Dates** : Use ` date-fns ` for formatting/parsing, store all dates in UTC
133+ - ** PWA** : Serwist service worker (` worker/index.ts ` → ` public/sw.js ` ), disabled in dev mode
116134
117135
118136## Avoiding Common Pitfalls
@@ -240,3 +258,5 @@ The backend uses **tRPC** for type-safe API communication. Routers are in `src/s
240258Always use context7 when I need code generation, setup or configuration steps, or
241259library/API documentation. This means you should automatically use the Context7 MCP
242260tools to resolve library id and get library docs without me having to explicitly ask.
261+
262+ Do not generate documentation or tests if not explicitly requested.
0 commit comments