An open API service indexing awesome lists of open source software.

https://github.com/maximcoding/driver-shield-mobile

DriveShield mobile app + design reference โ€” converting the design demo into React Native
https://github.com/maximcoding/driver-shield-mobile

Last synced: 12 days ago
JSON representation

DriveShield mobile app + design reference โ€” converting the design demo into React Native

Awesome Lists containing this project

README

          

# DriveShield Mobile

**Tamper-proof drive recording that protects drivers when it matters most.**

## ๐Ÿ’ก The idea

DriveShield is a mobile app that produces **tamper-proof evidence of how a driver actually drove**.
When a driver turns **Protection ON**, the app records GPS + speed telemetry for the trip, scores
how complete that recording was (**coverage**), and generates an immutable **verdict** โ€” e.g.
"No speeding events found (High coverage)". If a dispute arises (an insurer, employer, or
authority claims the driver was speeding), the driver can run an **Evidence Check** for a vehicle
and date/time and get a clear, verifiable answer backed by a session hash. The driver is protected
**only by what was actually monitored** โ€” no guessing, no smoothing, no after-the-fact edits.

## โœจ Features

**Product**
- ๐Ÿ›ก๏ธ **Protection toggle** โ€” start/stop tamper-proof recording per trip
- ๐Ÿ“ **Drive sessions** โ€” GPS + speed telemetry captured while protection is ON
- ๐Ÿ“Š **Coverage scoring** โ€” HIGH / MEDIUM / LOW / NOT_MONITORED based on data completeness
- โš–๏ธ **Verdicts** โ€” immutable, canonical results (speeding / no speeding / insufficient coverage)
- ๐Ÿ”Ž **Evidence Check** โ€” query by vehicle + date/time โ†’ matched session and verdict
- ๐Ÿงพ **Trip history & details** โ€” sessions, segments, gap intervals, event details
- ๐Ÿš— **Vehicles** โ€” add/edit/select default vehicle
- ๐Ÿ’ณ **Subscription** โ€” paywall, free trial, checkout, invoices, manage plan
- ๐Ÿ” **Evidence integrity** โ€” finalized sessions are immutable; SHA-256 session hash

**Engineering foundation** (from [react-native-bare-starter](https://github.com/maximcoding/react-native-bare-starter))
- ๐Ÿงฑ Bare React Native 0.82 (no Expo) + React 19, **strict TypeScript**
- ๐Ÿงญ React Navigation 7 โ€” stacks, tabs, modals
- ๐Ÿ“ฆ TanStack Query 5 โ€” caching, retries, persistence
- ๐Ÿชถ Zustand 5 โ€” light, hook-based state
- โšก MMKV 4.3 storage via Nitro Modules (offline-first)
- ๐Ÿ“ก Offline-ready โ€” query persistence, queue/replay, transport offline mode
- ๐Ÿ”Œ Pluggable transport โ€” REST / GraphQL / WebSocket / Firebase adapters
- ๐ŸŽจ Theming โ€” light/dark with semantic tokens + `useTheme()`
- ๐ŸŒ i18next 25 โ€” typed translations (EN/DE/RU) via `useT()`
- ๐Ÿ–ผ๏ธ SVG icons via `npm run gen:icons`; BootSplash 6
- ๐Ÿงช Biome 2, Jest 29, Maestro E2E

This repository contains the DriveShield **mobile frontend** and its **design reference**. The
current goal is to **convert the design demo into the React Native app** โ€” building real screens
on top of the existing foundation (theme tokens, UI kit, navigation shell).

> **Built on:** the React Native app in `client/DriveShield` is built on top of the
> [**react-native-bare-starter**](https://github.com/maximcoding/react-native-bare-starter)
> template (bare RN 0.82, TypeScript, React Navigation 7, TanStack Query, Zustand, MMKV,
> offline-ready transport, theming, i18next, Biome/Jest). Extend that foundation โ€” do not rebuild
> theme, navigation, state, or folder structure from scratch. See the starter's README for the
> full architecture and conventions.

## Repository layout

```
driver-shield-mobile/
โ”œโ”€โ”€ client/ # React Native mobile app (bare workflow, TypeScript)
โ”‚ โ”œโ”€โ”€ AGENTS.md # โ† READ FIRST before any client work
โ”‚ โ””โ”€โ”€ DriveShield/ # The RN project
โ””โ”€โ”€ uix-design/ # React + Vite design demo = visual source of truth
โ”œโ”€โ”€ AGENTS.md # Design system rules
โ”œโ”€โ”€ demo/ # Runnable demo (all screens, UI kit, tokens)
โ””โ”€โ”€ src/ # theme/, ui/, screens/, data/
```

## The task

Convert the `uix-design` demo screens into real React Native screens in `client/DriveShield`.

- **`uix-design`** is the **design source of truth** โ€” every screen, the UI kit, tokens, and
states already exist there as a runnable React/Vite demo.
- **`client/DriveShield`** is the **target** โ€” a React Native starter with theme tokens, a shared
UI Kit, an i18n setup, and a navigation shell already in place. Screens are currently
placeholders.

Your job is to implement the real screens in the client so the mobile app matches the demo.

**Deliverable: a fully clickable prototype.** No real backend in this phase โ€” the whole app must
be **clickable, with working navigation and changing states, fully driven by mock data** behind a
service layer that mimics backend integration (loading/empty/error/content included). It should
feel indistinguishable from the finished app, except the data is mocked โ€” so when the real API
arrives, only the mock layer is swapped and screens/navigation stay untouched.

๐Ÿ‘‰ **Start here: [BUILD_GUIDE.md](BUILD_GUIDE.md)** โ€” step-by-step instructions for reusing the
design system, tokens, theme, and UI Kit so the app looks and behaves exactly like the demo,
including token/component mapping tables and a per-screen Definition of Done.

### Ground rules (see `client/AGENTS.md` for the full list)

1. **Tokens only** for styling โ€” no raw hex/rgb, no magic spacing/size/radius values.
2. **i18n for all visible text** โ€” no hardcoded strings in JSX.
3. **No duplicate UI** โ€” repeated UI becomes a shared component/variant.
4. **Alias imports only** (`@/features/...`, `@/shared/...`, `@/navigation/...`, `@/i18n/...`) โ€” no `../../../`.
5. **Strict TypeScript** โ€” no `any`.
6. **No new dependencies** without approval.
7. **`uix-design` is the visual reference** โ€” the mobile app must match the demo.
8. After each phase: run iOS, run Android, run lint, commit a checkpoint.

## Getting started

### Design demo (React + Vite)

```bash
cd uix-design/demo
npm install
npm run dev # http://localhost:5173
```

### Mobile app (React Native)

```bash
cd client/DriveShield
cp .env.example .env # fill in values
npm install
npx pod-install ios # iOS only (macOS)

npm start # Metro bundler
npm run ios # build + run on iOS simulator
npm run android # build + run on Android emulator

npm run lint # Biome
npm test # Jest
```

> **Note:** `.env` is gitignored. Use `.env.example` as the template. Never commit secrets.

## Mobile stack

- React Native 0.82 + React 19, TypeScript (strict)
- Navigation: React Navigation 7 (native-stack + bottom-tabs)
- State/data: Zustand + TanStack Query, MMKV (offline-first)
- Theme + i18n: custom token theme + i18next (EN/DE/RU)
- Reanimated 4, Gesture Handler, SVG, Vector Icons
- Tooling: Biome, Jest, Husky

## React Native project structure (`client/DriveShield`)

Feature-first architecture inherited from the boilerplate. **Build new screens inside
`src/features//screens/` and shared UI inside `src/shared/components/ui/` โ€” do not
introduce a new architecture.**

```
client/DriveShield/
โ”œโ”€โ”€ App.tsx # Root: providers (theme, query, i18n, nav)
โ”œโ”€โ”€ index.js # RN entry point
โ”œโ”€โ”€ app.json # App name / config
โ”œโ”€โ”€ babel.config.js # Babel + module-resolver (@/ aliases)
โ”œโ”€โ”€ metro.config.js # Metro + SVG transformer
โ”œโ”€โ”€ tsconfig.json # Strict TS + path aliases
โ”œโ”€โ”€ biome.json # Lint/format config
โ”œโ”€โ”€ jest.config.js # Test config
โ”œโ”€โ”€ .env.example # Env template (copy โ†’ .env, gitignored)
โ”‚
โ”œโ”€โ”€ android/ # Native Android project (Gradle)
โ”œโ”€โ”€ ios/ # Native iOS project (Xcode workspace, Podfile)
โ”œโ”€โ”€ assets/ # Fonts, images, bootsplash logo
โ”œโ”€โ”€ maestro/ # E2E smoke flows (iOS + Android)
โ”œโ”€โ”€ scripts/ # Icon/bootsplash/env generators
โ”‚
โ””โ”€โ”€ src/
โ”œโ”€โ”€ config/ # App constants + feature flags
โ”‚
โ”œโ”€โ”€ features/ # โญ Feature-first โ€” each feature is self-contained
โ”‚ โ”œโ”€โ”€ auth/ # sign-in / phone / OTP / terms
โ”‚ โ”‚ โ”œโ”€โ”€ api/ # request builders
โ”‚ โ”‚ โ”œโ”€โ”€ hooks/ # feature hooks (queries/mutations)
โ”‚ โ”‚ โ”œโ”€โ”€ screens/ # โญ screens go here
โ”‚ โ”‚ โ”œโ”€โ”€ services/ # feature service layer
โ”‚ โ”‚ โ””โ”€โ”€ types/ # feature TypeScript types
โ”‚ โ”œโ”€โ”€ home/ # home / feed / session entry
โ”‚ โ”œโ”€โ”€ settings/ # settings + reusable settings rows
โ”‚ โ”‚ โ”œโ”€โ”€ components/ # feature-local components
โ”‚ โ”‚ โ””โ”€โ”€ screens/
โ”‚ โ””โ”€โ”€ user/ # profile / me
โ”‚
โ”œโ”€โ”€ navigation/ # React Navigation setup
โ”‚ โ”œโ”€โ”€ root/ # root navigator + param lists
โ”‚ โ”œโ”€โ”€ tabs/ # bottom tab bar (the "Dock")
โ”‚ โ”œโ”€โ”€ helpers/ # typed navigation helpers
โ”‚ โ”œโ”€โ”€ persistence/ # nav state persistence
โ”‚ โ””โ”€โ”€ routes.ts # route name constants
โ”‚
โ”œโ”€โ”€ i18n/ # i18next setup
โ”‚ โ”œโ”€โ”€ locales/ # en / de / ru translation files
โ”‚ โ””โ”€โ”€ useT.ts # typed translation hook
โ”‚
โ”œโ”€โ”€ session/ # Drive-session domain (protection/telemetry)
โ”‚
โ””โ”€โ”€ shared/ # โญ Cross-feature building blocks
โ”œโ”€โ”€ components/ui/ # โญ shared UI Kit (Button, Card, Sheets, โ€ฆ)
โ”œโ”€โ”€ hooks/ # generic hooks (useForm, useDebouncedValue, โ€ฆ)
โ”œโ”€โ”€ stores/ # Zustand global stores
โ”œโ”€โ”€ theme/ # โญ design system
โ”‚ โ”œโ”€โ”€ tokens/ # brand, spacing, radius, typography, elevation, fonts
โ”‚ โ”œโ”€โ”€ light.ts # light theme
โ”‚ โ”œโ”€โ”€ dark.ts # dark theme
โ”‚ โ”œโ”€โ”€ ThemeProvider.tsx
โ”‚ โ””โ”€โ”€ useTheme.ts # useTheme() hook โ†’ theme.colors / spacing / radius / typography
โ”œโ”€โ”€ services/ # infra
โ”‚ โ”œโ”€โ”€ api/ # http client, query layer, offline, transport adapters
โ”‚ โ”œโ”€โ”€ storage/ # MMKV wrapper
โ”‚ โ””โ”€โ”€ monitoring/ # error/perf hooks
โ”œโ”€โ”€ types/ # shared types
โ””โ”€โ”€ utils/ # helpers (platform, formatting, โ€ฆ)
```

**Where things go**
- New screen โ†’ `src/features//screens/MyScreen.tsx`
- Reused UI (used by 2+ screens) โ†’ `src/shared/components/ui/`
- Colors / spacing / radius / fonts โ†’ `src/shared/theme/` (tokens + `light.ts`/`dark.ts`)
- Visible text โ†’ `src/i18n/locales/` (use `useT()`)
- Routes โ†’ `src/navigation/`
- Import with aliases only: `@/features/...`, `@/shared/...`, `@/navigation/...`, `@/i18n/...`

## Design demo stack

- React 18 + Vite 5 (JSX), Framer Motion
- Custom design system โ€” tokens (`T`, `L`) + hand-built UI kit (no UI library)