-
Notifications
You must be signed in to change notification settings - Fork 0
Developer Guidelines
Masked-Kunsiquat edited this page Dec 25, 2025
·
4 revisions
This page outlines the standards for working on the CrewSplit codebase.
-
npm start: Start development server. -
npm test: Run all tests. -
npm run type-check: Run TypeScript compiler check. -
npm run lint: Run ESLint. -
npm drizzle-kit generate: Generate migrations.
npm install# Start Expo development server
npm start
# Run on iOS/Android
npm run ios
npm run androidnpm testEach domain module is fully colocated under src/modules/<domain>/:
-
repository/: Database access (Local Data Engineer) -
hooks/: React hooks (UI Integration) -
screens/: UI Screens (UI/UX Engineer) -
types.ts: Domain types
The settlement module strictly separates concerns:
- Pure Math Layer: (Modeler) Zero dependencies, integer math (cents).
- Service Layer: (Integration) Loads data, calls pure functions. Operates on
convertedAmountMinor. - Hooks Layer: (UI) Consumes services for React components.
- Trip: Has a single
currency. - Expense: Stores
originalAmountMinor(entry) andconvertedAmountMinor(normalized to trip currency). - Settlement: Only uses
convertedAmountMinor.
- Determinism: Same data must always produce the same output.
- Edge Cases: Test for zero amounts, single participants, etc.
- Conservation: Net positions must sum to zero.
- Integer Math: All amounts in cents to avoid floating-point errors.
- Modify schema files in
src/db/schema/. - Generate migrations with Drizzle Kit.
- Never manually wipe the database in production code.
- Prefer additive changes.
- No Participants: If an expense exists but no participants, preserve data but return empty settlements.
- Sorting: Always sort by ID for determinism (
localeCompare). - Rounding: Use the largest remainder method for cent distribution.