|
1 | | -# Welcome to your Expo app 👋 |
| 1 | +# CrimeLink Analyzer Mobile App |
2 | 2 |
|
3 | | -This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app). |
| 3 | +React Native + Expo mobile client for the CrimeLink Analyzer platform. |
4 | 4 |
|
5 | | -## Get started |
| 5 | +This app connects to: |
6 | 6 |
|
7 | | -1. Install dependencies |
| 7 | +- CrimeLink backend APIs (authentication, duty, leave, announcements, safety zones, weapon requests, officer location) |
| 8 | +- Firebase (chat/auth-related integrations) |
| 9 | +- Google Maps services (map and location features) |
8 | 10 |
|
9 | | - ```bash |
10 | | - npm install |
11 | | - ``` |
| 11 | +## Tech stack |
12 | 12 |
|
13 | | -2. Start the app |
| 13 | +- Expo SDK 54 |
| 14 | +- React Native 0.81 |
| 15 | +- Expo Router (file-based routing) |
| 16 | +- TypeScript |
| 17 | +- NativeWind |
| 18 | +- Axios |
| 19 | +- Firebase |
14 | 20 |
|
15 | | - ```bash |
16 | | - npx expo start |
17 | | - ``` |
| 21 | +## Prerequisites |
18 | 22 |
|
19 | | -In the output, you'll find options to open the app in a |
| 23 | +Install the following before running: |
20 | 24 |
|
21 | | -- [development build](https://docs.expo.dev/develop/development-builds/introduction/) |
22 | | -- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/) |
23 | | -- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/) |
24 | | -- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo |
| 25 | +- Node.js 18+ (recommended: latest LTS) |
| 26 | +- npm 9+ |
| 27 | +- Expo CLI (via npx, no global install required) |
| 28 | +- Android Studio (for Android emulator) or Xcode (for iOS simulator on macOS) |
25 | 29 |
|
26 | | -You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction). |
| 30 | +For API calls to work, run the backend service and make sure its URL is reachable from your device/emulator. |
27 | 31 |
|
28 | | -## Get a fresh project |
| 32 | +## Environment configuration |
29 | 33 |
|
30 | | -When you're ready, run: |
| 34 | +This project reads environment values from: |
| 35 | + |
| 36 | +- `.env.development` |
| 37 | +- `.env.preview` |
| 38 | +- `.env.production` |
| 39 | + |
| 40 | +The selected file depends on `APP_ENV` (default is `development`). |
| 41 | + |
| 42 | +### 1. Create your env file |
| 43 | + |
| 44 | +From this folder, copy `.env.example` to one of the environment files: |
| 45 | + |
| 46 | +```bash |
| 47 | +cp .env.example .env.development |
| 48 | +``` |
| 49 | + |
| 50 | +### 2. Fill required values |
| 51 | + |
| 52 | +At minimum, set all of the following keys: |
| 53 | + |
| 54 | +```env |
| 55 | +API_URL= |
| 56 | +FIREBASE_API_KEY= |
| 57 | +FIREBASE_AUTH_DOMAIN= |
| 58 | +FIREBASE_PROJECT_ID= |
| 59 | +FIREBASE_STORAGE_BUCKET= |
| 60 | +FIREBASE_MESSAGING_SENDER_ID= |
| 61 | +FIREBASE_APP_ID= |
| 62 | +``` |
| 63 | + |
| 64 | +Optional but recommended: |
| 65 | + |
| 66 | +```env |
| 67 | +GOOGLE_MAPS_API_KEY= |
| 68 | +``` |
| 69 | + |
| 70 | +### API_URL tips |
| 71 | + |
| 72 | +- Android emulator (calling backend on your machine): |
| 73 | + |
| 74 | +```env |
| 75 | +API_URL=http://10.0.2.2:8080 |
| 76 | +``` |
| 77 | + |
| 78 | +- iOS simulator: |
| 79 | + |
| 80 | +```env |
| 81 | +API_URL=http://localhost:8080 |
| 82 | +``` |
| 83 | + |
| 84 | +- Physical device (same Wi-Fi as your machine): |
| 85 | + |
| 86 | +```env |
| 87 | +API_URL=http://<YOUR_LOCAL_IP>:8080 |
| 88 | +``` |
| 89 | + |
| 90 | +## Install dependencies |
| 91 | + |
| 92 | +```bash |
| 93 | +npm install |
| 94 | +``` |
| 95 | + |
| 96 | +## Run the app |
| 97 | + |
| 98 | +### Start Expo dev server |
| 99 | + |
| 100 | +Development environment (default): |
| 101 | + |
| 102 | +```bash |
| 103 | +npx expo start |
| 104 | +``` |
| 105 | + |
| 106 | +Use a specific environment file: |
31 | 107 |
|
32 | 108 | ```bash |
33 | | -npm run reset-project |
| 109 | +APP_ENV=preview npx expo start |
| 110 | +APP_ENV=production npx expo start |
34 | 111 | ``` |
35 | 112 |
|
36 | | -This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing. |
| 113 | +### Run on Android |
| 114 | + |
| 115 | +```bash |
| 116 | +npm run android |
| 117 | +``` |
| 118 | + |
| 119 | +### Run on iOS (macOS only) |
| 120 | + |
| 121 | +```bash |
| 122 | +npm run ios |
| 123 | +``` |
| 124 | + |
| 125 | +### Run on web |
| 126 | + |
| 127 | +```bash |
| 128 | +npm run web |
| 129 | +``` |
| 130 | + |
| 131 | +## Lint |
| 132 | + |
| 133 | +```bash |
| 134 | +npm run lint |
| 135 | +``` |
| 136 | + |
| 137 | +## Typical local workflow |
| 138 | + |
| 139 | +1. Start backend service (default expected port: 8080). |
| 140 | +2. Configure `.env.development` with valid API/Firebase values. |
| 141 | +3. Install dependencies with `npm install`. |
| 142 | +4. Start Expo using `npx expo start`. |
| 143 | +5. Launch on emulator/device (`a` for Android, `i` for iOS in Expo terminal, or use npm scripts). |
| 144 | + |
| 145 | +## Build and deployment notes |
| 146 | + |
| 147 | +- App config values are injected through `app.config.js` into Expo `extra`. |
| 148 | +- If you use EAS Build, define the same env vars in your EAS environment. Missing values can cause runtime failures when reading config. |
37 | 149 |
|
38 | | -## Learn more |
| 150 | +## Project structure |
39 | 151 |
|
40 | | -To learn more about developing your project with Expo, look at the following resources: |
| 152 | +- `app/` route screens (Expo Router) |
| 153 | +- `src/api/` API client setup |
| 154 | +- `src/services/` feature service layers |
| 155 | +- `src/constants/` shared constants and runtime config |
| 156 | +- `src/components/` reusable UI and feature components |
| 157 | +- `src/context/` and `src/hooks/` app state and hooks |
41 | 158 |
|
42 | | -- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides). |
43 | | -- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web. |
| 159 | +## Troubleshooting |
44 | 160 |
|
45 | | -## Join the community |
| 161 | +- Error: Missing required app config |
| 162 | + - Check `.env.*` values and confirm you started the app with the intended `APP_ENV`. |
| 163 | +- Network request failed |
| 164 | + - Verify backend is running and `API_URL` is reachable from emulator/device. |
| 165 | +- Android physical device cannot reach backend |
| 166 | + - Use your machine local IP address, not `localhost`. |
46 | 167 |
|
47 | | -Join our community of developers creating universal apps. |
| 168 | +## Useful scripts |
48 | 169 |
|
49 | | -- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute. |
50 | | -- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions. |
| 170 | +- `npx expo start` - Start Expo development server |
| 171 | +- `npm run android` - Build/run on Android |
| 172 | +- `npm run ios` - Build/run on iOS |
| 173 | +- `npm run web` - Run web target |
| 174 | +- `npm run lint` - Lint project |
| 175 | +- `npm run reset-project` - Reset scaffolded starter structure |
0 commit comments