Decentralized utility management made simple. Manage customers, revenues and assets with this all-in one open source platform.
MicroPowerManager (MPM) is a decentralized utility and customer management tool. Manage customers, revenues and assets with this all-in one Open Source platform.
This repository contains the source code for the MicroPowerManager Field App — a cross-platform Expo / React Native app that lets field agents register customers, record appliance sales, and collect payments, online or offline.
- Node.js 20 LTS and npm
- Xcode (iOS) and/or Android Studio (Android)
- Git clone the repository
npm install
npm start # Metro dev server
npm run android # build & install on Android emulator/device
npm run ios # build & install on iOS simulator/deviceThe app uses location permissions, so ensure the emulator or device has location services enabled.
On first launch the app shows an environment picker:
| Option | Use when |
|---|---|
Demo |
Explore against the public demo tenant |
Cloud |
Sign in with a <company>.micropowermanager.cloud slug |
Custom |
Self-hosted, local, or staging |
For Android
npx expo prebuild --platform android
cd android && ./gradlew assembleRelease
# output: android/app/build/outputs/apk/releaseFor iOS, open the generated ios/ workspace in Xcode and archive (or use EAS Build).
File-based routing on Expo Router with an offline-first data layer.
- Expo Router for navigation (typed, file-based routes)
- TanStack React Query for server cache and request orchestration
- Axios client with auth +
device-idinterceptors and a 401 → re-login handler - AsyncStorage outbox; expo-secure-store for tokens
- React Hook Form + Zod for forms and validation
- Custom design system in
src/components+src/theme
(auth)—environment,login(app)/(tabs)—index,customers,sales,payments(app)/{customers,sales,payments}/—[id]andnewscreens
Mutations that fail offline are queued in src/storage/outbox.ts (AsyncStorage, capped at 200 entries) and replayed by outboxDrainer.ts once useNetworkStatus reports connectivity. SyncBanner surfaces pending and failed counts.
SessionContext (src/auth/SessionContext.tsx) holds the active environment, token, and agent. Tokens live in expo-secure-store; a stable device-id is generated on first launch.
Browse, search, register, and inspect customers.
Screens: (tabs)/customers.tsx, customers/new.tsx, customers/[id]/index.tsx.
Registration captures a geolocation fix and is enqueued in the outbox if offline.
Sell appliances on credit or PAYG.
Screens: (tabs)/sales.tsx, sales/new.tsx, sales/[id].tsx.
Record payments and view receipts.
Screens: (tabs)/payments.tsx, payments/new.tsx, payments/[id].tsx.
- TypeScript strict mode;
@/*aliasessrc/*. - Prefer
react-hook-form+zodResolverfor new forms — seecustomers/new.tsx. - Use theme tokens from
@/theme(semantic,spacing,radii,shadows) rather than hard-coded values. - SVGs load via
react-native-svg-transformer(types insvg.d.ts). - Location permission is requested on demand from the registration flow, not at boot.