@@ -6,8 +6,7 @@ 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+ - Frontend: Expo/React Native mobile app
1110
1211The app allows users to create groups, add expenses with flexible splitting options, track balances, and handle settlements.
1312
@@ -23,35 +22,32 @@ The app allows users to create groups, add expenses with flexible splitting opti
2322 - ` app/user/ ` : User profile management
2423 - ` app/groups/ ` : Group creation & management
2524 - ` 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
25+
26+ ### Frontend (Expo/React Native)
27+ - Located in ` /frontend/ `
28+ - ` App.js ` : Main application entry point
29+ - ` screens/ ` : Contains all screen components
30+ - ` navigation/ ` : App navigation structure
31+ - ` api/ ` : API client and service modules
32+ - ` context/ ` : React context providers (AuthContext)
33+ - ` utils/ ` : Utility functions (currency, balance calculations)
3334
3435## Key Development Patterns
3536
3637### 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- )
38+ ``` javascript
39+ // Example API call from frontend/api/client.js
40+ import axios from ' axios ' ;
41+
42+ const client = axios . create ({
43+ baseURL : API_URL ,
44+ headers : { ' Content-Type ' : ' application/json ' }
45+ });
4546```
4647
4748### State Management
4849- 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- ```
50+ - Frontend: React Context for auth state, component state for UI
5551
5652### Expense Handling
5753- Support for different split types: equal, unequal, percentage-based
@@ -67,34 +63,28 @@ if "access_token" not in st.session_state:
6763 pip install -r requirements.txt
6864 uvicorn main:app --reload
6965 ```
70- 2 . Frontend POC:
71- ``` bash
72- cd ui-poc
73- pip install -r requirements.txt
74- streamlit run Home.py
75- ```
76- 3 . Test Data Generation:
66+ 2 . Frontend:
7767 ``` bash
78- cd ui-poc
79- python setup_test_data.py
68+ cd frontend
69+ npm install
70+ npx expo start
8071 ```
8172
8273### Testing
8374- Backend tests in ` /backend/tests/ `
8475- Run tests with: ` cd backend && pytest `
85- - Test data setup script: ` /ui-poc/setup_test_data.py `
8676
8777## Critical Files & Dependencies
8878
8979- ` backend/main.py ` : Main FastAPI application entry point
9080- ` backend/app/config.py ` : Configuration settings
9181- ` 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
82+ - ` frontend/App.js ` : Main React Native entry point
83+ - ` frontend/context/AuthContext.js ` : Authentication state management
9484
9585## Common Tasks
9686
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 `
87+ - Adding new API endpoint: Add route to appropriate service router file in ` backend/app/ `
88+ - Adding new screen: Create component in ` frontend/screens/ ` and add to navigation
89+ - API integration: Add service functions in ` frontend/api/ `
90+ - Troubleshooting auth: Check JWT token handling in ` backend/ app/auth/security.py`
0 commit comments