@@ -6,8 +6,8 @@ This document provides essential context for AI assistants working with the Spli
66
77Splitwiser is an expense tracking and splitting application with:
88- Backend: FastAPI + MongoDB
9- - Frontend POC: Streamlit
10- - Planned Frontend: Expo/ React Native (in development)
9+ - Mobile: Expo/React Native mobile app
10+ - Web: React + Vite + TypeScript web app
1111
1212The app allows users to create groups, add expenses with flexible splitting options, track balances, and handle settlements.
1313
@@ -23,35 +23,40 @@ The app allows users to create groups, add expenses with flexible splitting opti
2323 - ` app/user/ ` : User profile management
2424 - ` app/groups/ ` : Group creation & management
2525 - ` app/expenses/ ` : Expense tracking & splitting
26-
27- ### Frontend POC (Streamlit)
28- - Located in ` /ui-poc/ `
29- - ` Home.py ` : Entry point with login/registration
30- - ` pages/ ` : Contains main application pages
31- - ` Groups.py ` : Group management & expense creation
32- - ` Friends.py ` : Friend balance tracking
26+
27+ ### Mobile (Expo/React Native)
28+ - Located in ` /mobile/ `
29+ - ` App.js ` : Main application entry point
30+ - ` screens/ ` : Contains all screen components
31+ - ` navigation/ ` : App navigation structure
32+ - ` api/ ` : API client and service modules
33+ - ` context/ ` : React context providers (AuthContext)
34+ - ` utils/ ` : Utility functions (currency, balance calculations)
35+
36+ ### Web (React + Vite + TypeScript)
37+ - Located in ` /web/ `
38+ - ` App.tsx ` : Main application entry point
39+ - ` pages/ ` : Contains page components
40+ - ` components/ ` : Reusable UI components
41+ - ` contexts/ ` : React context providers
42+ - ` services/ ` : API client and service modules
3343
3444## Key Development Patterns
3545
3646### API Communication
37- ``` python
38- # Example API call with retry logic from Groups.py
39- response = make_api_request(
40- method = " get " ,
41- url = f " { API_URL } /groups/ { group_id } " ,
42- headers = { " Authorization " : f " Bearer { st.session_state.access_token } " } ,
43- max_retries = 3
44- )
47+ ``` javascript
48+ // Example API call from mobile/api/client.js
49+ import axios from ' axios ' ;
50+
51+ const client = axios . create ({
52+ baseURL : API_URL ,
53+ headers : { ' Content-Type ' : ' application/json ' }
54+ });
4555```
4656
4757### State Management
4858- Backend: MongoDB stores persistent data
49- - Frontend: Streamlit session state manages user session
50- ``` python
51- # Session state initialization (see Home.py)
52- if " access_token" not in st.session_state:
53- st.session_state.access_token = None
54- ```
59+ - Mobile/Web: React Context for auth state, component state for UI
5560
5661### Expense Handling
5762- Support for different split types: equal, unequal, percentage-based
@@ -67,34 +72,37 @@ if "access_token" not in st.session_state:
6772 pip install -r requirements.txt
6873 uvicorn main:app --reload
6974 ```
70- 2 . Frontend POC :
75+ 2 . Mobile :
7176 ``` bash
72- cd ui-poc
73- pip install -r requirements.txt
74- streamlit run Home.py
77+ cd mobile
78+ npm install
79+ npx expo start
7580 ```
76- 3 . Test Data Generation :
81+ 3 . Web :
7782 ``` bash
78- cd ui-poc
79- python setup_test_data.py
83+ cd web
84+ npm install
85+ npm run dev
8086 ```
8187
8288### Testing
8389- Backend tests in ` /backend/tests/ `
8490- Run tests with: ` cd backend && pytest `
85- - Test data setup script: ` /ui-poc/setup_test_data.py `
8691
8792## Critical Files & Dependencies
8893
8994- ` backend/main.py ` : Main FastAPI application entry point
9095- ` backend/app/config.py ` : Configuration settings
9196- ` backend/app/database.py ` : MongoDB connection
92- - ` ui-poc/Home.py ` : Streamlit application entry point
93- - ` ui-poc/openapi.json ` : API specification for frontend reference
97+ - ` mobile/App.js ` : Main React Native entry point
98+ - ` mobile/context/AuthContext.js ` : Authentication state management
99+ - ` web/App.tsx ` : Main web app entry point
100+ - ` web/contexts/AuthContext.tsx ` : Web authentication state management
94101
95102## Common Tasks
96103
97- - Adding new API endpoint: Add route to appropriate service router file
98- - Adding new UI component: Modify files in ` /ui-poc/pages/ `
99- - Testing data flow: Use the ` setup_test_data.py ` to create test scenarios
100- - Troubleshooting auth: Check JWT token handling in ` app/auth/security.py `
104+ - Adding new API endpoint: Add route to appropriate service router file in ` backend/app/ `
105+ - Adding new mobile screen: Create component in ` mobile/screens/ ` and add to navigation
106+ - Adding new web page: Create component in ` web/pages/ ` and add to routing
107+ - API integration: Add service functions in ` mobile/api/ ` or ` web/services/ `
108+ - Troubleshooting auth: Check JWT token handling in ` backend/app/auth/security.py `
0 commit comments