This guide explains how to run the Bitka Flutter application alongside its local mock backend.
lib/: Contains the Flutter application code.bitka-mock-backend/: Contains the local server scripts acting as the mock database and API.
You must start the Mock Backend first, so the Flutter app has an API to connect to.
The backend runs locally to simulate authentication, wallet transactions, and market data.
-
Open a terminal and navigate to the backend folder:
cd bitka-mock-backend -
Set up and Run:
-
Windows:
python -m venv venv .\venv\Scripts\activate pip install -r requirements.txt uvicorn main:app --port 8000 --reload
-
macOS / Linux:
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt uvicorn main:app --port 8000 --reload
The server is now running at
http://127.0.0.1:8000. -
-
Open a new terminal window and navigate to the project root.
-
Install Dependencies:
flutter pub get
-
Configure Connection (
.env): Create a file named.env.developmentin the root directory. Add theBASE_URLvariable corresponding to your device:-
For Android Emulator:
BASE_URL=http://10.0.2.2:8000(Note:
10.0.2.2is the special alias for the host's localhost in Android Studio). -
For iOS Simulator:
BASE_URL=http://127.0.0.1:8000 -
For Physical Devices:
BASE_URL=http://YOUR_PC_IP_ADDRESS:8000(Replace
YOUR_PC_IP_ADDRESSwith your computer's local IP, e.g.,192.168.1.50).
-
-
Run the App:
flutter run
The mock database is pre-filled with this user for testing:
- Email:
abc@gmail.com - Password:
123456
- Connection Refused / Network Error:
- Verify the backend terminal is still running.
- Double-check your
.env.developmentfile. If you are on Android, you cannot uselocalhostor127.0.0.1; you must use10.0.2.2.
- Changes not reflecting:
- If you edit the
.envfile, perform a full restart of the app (stop and runflutter runagain), as Hot Restart does not reload environment variables.
- If you edit the