A monorepo containing a React Native Expo application and Fastify API for managing users, iBeacon orders, and receipts with MongoDB integration.
This monorepo contains two workspaces:
- app/ - React Native mobile application
- api/ - Fastify backend API with MongoDB
The application allows users to:
- Manage user profiles and customer data
- Place orders for iBeacon devices with delivery information
- Generate and view receipts stored in MongoDB
- View statistics and manage application settings
- Switch between light and dark themes
driversnote-assessment/
βββ app/ # React Native mobile application
β βββ app/ # App screens and components
β βββ android/ # Android native code
β βββ ios/ # iOS native code
β βββ __mocks__/ # Jest mocks
β βββ package.json # App dependencies
β
βββ api/ # Fastify API service
β βββ src/ # API source code
β βββ tests/ # API tests
β βββ vercel.json # Vercel deployment config
β βββ package.json # API dependencies
β
βββ package.json # Root workspace configuration
COMPLETED IMPLEMENTATION - The application has been successfully built with modern React Native + Expo managed workflow, featuring:
- β Complete user management system
- β Full order flow with iBeacon selection and delivery
- β Receipt generation and MongoDB storage
- β Material Design 3 theming with dark/light mode
- β Navigation flow fixes and proper stack management
- β TypeScript strict configuration
- β Fastify API backend with MongoDB integration
- β Redux Toolkit state management
- β Consistent safe area handling across Android/iOS
- β Centralized and consistent style system
- β Navigation stack reset after order completion
- β API key authentication and security
- β Monorepo structure with npm workspaces
- β Vercel deployment configuration
- Frontend: React Native with Expo (bare workflow)
- Navigation: React Navigation v6 with nested stack/tab navigators
- State Management: Redux Toolkit with Redux Persist
- API: Fastify 5.2.2 with MongoDB 6.12.0
- Deployment: Vercel (serverless)
- UI Framework: React Native Paper (Material Design 3)
- Language: TypeScript (strict configuration)
- Development: Expo CLI, Metro bundler
- Monorepo: npm workspaces
- Material Design 3 theming with light/dark mode support
- Custom tab navigation with floating action button
- Responsive design with proper screen transitions
- Loading states and error handling throughout
- View existing users from MongoDB
- Create new users with comprehensive form validation
- Country selection with discount calculations
- Tag management for customer categorization
- Select users and configure iBeacon quantities
- Input delivery addresses with form validation
- Calculate pricing with automatic discounts
- Order overview with confirmation
- Automatic receipt generation after order completion
- Receipt storage in MongoDB with proper indexing
- Receipt listing with detailed information
- Integration with order completion flow
- Statistics dashboard
- Theme toggle between light and dark modes
- Application settings and preferences
- Node.js >= 18.0.0
- npm >= 9.0.0
- iOS Simulator (for macOS) or Android Emulator
- Expo CLI (
npm install -g @expo/cli) - MongoDB instance (hosted or local)
# Install all workspace dependencies
npm installMONGODB_URI=your-mongodb-connection-string
NODE_ENV=development
PORT=3000
API_KEY=your-api-key-hereAPI_BASE_URL=http://localhost:3000/api
API_KEY=your-api-key-hereImportant:
- API key is required for ALL operations (create, read, update, delete)
- The
.envfiles are git-ignored for security
# Start Expo dev server
npm run app
# Run on Android
npm run app:android
# Run on iOS
npm run app:ios# Run in development mode
npm run api
# Build for production
npm run api:build
# Start production server
npm run api:start# Run all tests
npm test
# Run tests for specific workspace
npm test --workspace=app
npm test --workspace=apidriversnote-assessment/
βββ app/ # Main application code
β βββ components/ # Reusable UI components
β βββ context/ # React contexts (Theme)
β βββ data/ # Static data and utilities
β βββ navigation/ # Navigation configuration
β βββ screens/ # Screen components
β βββ services/ # API and external services
β βββ store/ # Redux store and slices
β βββ styles/ # Shared styles and themes
β βββ types/ # TypeScript type definitions
βββ assets/ # Static assets (images, icons)
βββ android/ # Android native code
βββ ios/ # iOS native code
βββ App.tsx # Application entry point
βββ app.json # Expo configuration
TabNavigator
βββ Users (Stack)
β βββ UsersList
β βββ Beacons
β βββ Delivery
β βββ OrderOverview
βββ Receipts (Screen)
βββ CreateUser (Screen) - Floating Action Button
βββ Stats (Screen)
βββ Settings (Screen)
The app connects to a hosted API service on Render.com:
Base URL: https://driversnote-assessment-api.onrender.com/api
API Repository: driversnote-assessment-api
Public Endpoints (no authentication required):
GET /- Root endpointGET /api/health- Health checkGET /docs- API documentation
Protected Endpoints (require X-API-Key header):
GET /api/users- Get all usersGET /api/users/:id- Get user by IDPOST /api/users- Create new userPUT /api/users/:id- Update userDELETE /api/users/:id- Delete userGET /api/receipts- Get all receiptsPOST /api/receipts- Create new receiptDELETE /api/receipts/:id- Delete receipt
Authentication: All data endpoints require a valid API key sent in the X-API-Key header.
Documentation: Available at https://driversnote-assessment-api.onrender.com/docs
- Authentication: All API endpoints (except health check and docs) require API key authentication
- API Key: Must be provided in the
X-API-Keyheader for all requests - Rate Limiting: API includes rate limiting to prevent abuse
- CORS: Configured to allow requests from approved origins
- Input Validation: All inputs are validated and sanitized
- Error Handling: Proper error responses without exposing sensitive information
- Never commit secrets: The
.envfile is git-ignored to prevent API key exposure - Environment isolation: Separate environment variables for development, testing, and production
- API key rotation: API keys should be rotated regularly in production environments
- Secure storage: API keys are stored securely and never logged
- Network security: All API communications use HTTPS
- Data validation: Input validation on both client and server sides
- Error boundaries: Proper error handling to prevent crashes
If you discover a security vulnerability in this project:
- Do not create a public GitHub issue
- Email the project maintainer directly with details
- Include steps to reproduce the vulnerability
- Allow reasonable time for the issue to be addressed
- Security issues will be acknowledged within 48 hours
This project is part of a technical assessment. Security updates are provided for:
| Version | Supported |
|---|---|
| 1.0.x | β Current |
| < 1.0 | β Not supported |
Implemented centralized styling to ensure consistent title spacing and visibility on Android:
- Unified style usage across screens
- Leveraged platform-specific configurations for Android safe areas
- Removed all inline styles and inconsistencies for predictability
The application includes a fix for navigation stack issues where the order flow would persist after completion. When navigating to Users or Receipts tabs after completing an order, the navigation stack is properly reset.
- Uses hosted API service with MongoDB backend
- Includes proper error handling and retry logic with exponential backoff
- Fallback to sample data when API is unavailable
- No local database setup required
- Material Design 3 theming
- Dynamic light/dark mode switching
- Persistent theme preference
npx expo build:ios # For iOS
npx expo build:android # For Androidnpm test-
Metro bundler issues:
npx expo start --clear
-
iOS build issues:
cd ios && pod install && cd .. npx expo run:ios
-
Environment variables not loading:
- Ensure
.envfile is in the root directory - Restart the development server
- Ensure
This project is part of a technical assessment and is for evaluation purposes.