A modern React Native mobile application for DrugGuard Ghana, providing drug verification, search, and management capabilities for both citizens and FDA administrators.
DrugGuard Ghana Frontend is a comprehensive mobile application that enables:
- Drug Verification: QR code scanning and authenticity verification
- Drug Search: Advanced search with voice recognition
- Drug Reporting: Citizen report submission for suspicious drugs
- Admin Dashboard: Complete drug management for FDA administrators
- Analytics: Real-time insights and reporting
- Voice Features: Multi-language voice recognition and text-to-speech
- β Drug Verification - QR code scanning and authenticity checks
- β Drug Search - Advanced search with voice recognition
- β Drug Reporting - Citizen report submission and tracking
- β Admin Dashboard - Complete drug management interface
- β Analytics Dashboard - Real-time insights and reporting
- β Voice Processing - Multi-language voice recognition and TTS
- β Multi-language Support - English, Twi, Ga, Ewe
- β Offline Capabilities - Basic functionality without internet
- π¨ Modern UI/UX - Beautiful, intuitive interface
- π± Responsive Design - Optimized for all screen sizes
- π Dark/Light Mode - User preference support
- π Push Notifications - Real-time alerts and reminders
- π Real-time Updates - Live data synchronization
- π― Accessibility - Screen reader and voice navigation support
- π Secure Authentication - JWT-based admin login
- π‘ API Integration - RESTful API communication
- ποΈ Local Storage - Offline data persistence
- π State Management - Efficient data flow
- π± Cross-platform - iOS and Android support
- π Performance Optimized - Fast loading and smooth interactions
- Framework: React Native 0.79.3
- Language: TypeScript 5.8.3
- Navigation: Expo Router 5.1.0
- UI Library: NativeBase 3.4.28
- State Management: React Hooks + Context
- HTTP Client: Axios 1.7.2
- Storage: AsyncStorage 1.23.1
- Icons: Expo Vector Icons 14.1.0
- Build Tool: Expo CLI
- Development: Expo SDK 53
expo-speech- Text-to-speech functionalityexpo-av- Audio/video capabilitiesexpo-barcode-scanner- QR code scanningexpo-camera- Camera functionalityexpo-linear-gradient- Gradient effectsexpo-linking- Deep linking support
- Node.js 18+
- npm or yarn
- Expo CLI (
npm install -g @expo/cli) - iOS Simulator (for iOS development)
- Android Studio (for Android development)
- Git
git clone <repository-url>
cd drugguard-frontendnpm install
# or
yarn installCreate a .env file in the root directory:
# API Configuration
API_BASE_URL=http://localhost:8080/api
# App Configuration
APP_NAME=DrugGuard Ghana
APP_VERSION=1.0.0
# Feature Flags
ENABLE_VOICE_FEATURES=true
ENABLE_ANALYTICS=true
ENABLE_PUSH_NOTIFICATIONS=true# Start Expo development server
npm start
# or
expo start
# Run on iOS
npm run ios
# or
expo start --ios
# Run on Android
npm run android
# or
expo start --android
# Run on Web
npm run web
# or
expo start --web# Build for iOS
expo build:ios
# Build for Android
expo build:android
# Build for Web
expo build:webapp/
βββ _layout.tsx # Root layout
βββ index.tsx # Home screen
βββ onboarding/
β βββ _layout.tsx
β βββ index.tsx # Onboarding flow
βββ user-selection.tsx # User type selection
βββ auth/
β βββ _layout.tsx
β βββ admin-login.tsx # Admin authentication
βββ (tabs)/
β βββ _layout.tsx # Tab navigation
β βββ index.tsx # Home/Dashboard
β βββ search.tsx # Drug search
β βββ scan.tsx # QR code scanning
β βββ profile.tsx # Drug reporting
βββ admin/
βββ _layout.tsx # Admin layout
βββ dashboard.tsx # Admin dashboard
βββ analytics.tsx # Analytics
βββ drugs/
β βββ _layout.tsx
β βββ index.tsx # Drug list
β βββ create.tsx # Create drug
β βββ [id].tsx # Drug details
βββ settings.tsx # Admin settings
components/
βββ VoiceInput.tsx # Voice recognition component
βββ FloatingAiAssistant.tsx # AI health assistant
βββ SafeAreaWrapper.tsx # Safe area handling
βββ ErrorBoundary.tsx # Error handling
βββ BackHandlerPolyfill.ts # Back button handling
services/
βββ api.ts # API service layer
βββ voiceService.ts # Voice processing service
constants/
βββ Colors.ts # Color definitions
context/
βββ (context providers) # React context providers
- Colors: Consistent color palette with accessibility support
- Typography: Clear, readable fonts with proper hierarchy
- Spacing: Consistent spacing system (4px base unit)
- Components: Reusable, accessible components
- Animations: Smooth, purposeful animations
- Accessibility First: Screen reader support, voice navigation
- Mobile-First: Optimized for mobile interactions
- Consistency: Uniform design patterns throughout
- Performance: Fast loading and smooth interactions
- Inclusivity: Multi-language support and cultural considerations
// app.json
{
"expo": {
"name": "DrugGuard Ghana",
"slug": "drugguard-ghana",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash-icon.png",
"resizeMode": "contain",
"backgroundColor": "#4299E1"
},
"platforms": ["ios", "android", "web"],
"plugins": [
"expo-router",
"expo-barcode-scanner",
"expo-camera"
]
}
}// services/api.ts
const API_BASE_URL = process.env.API_BASE_URL || 'http://localhost:8080/api';
const api = axios.create({
baseURL: API_BASE_URL,
timeout: 10000,
headers: {
'Content-Type': 'application/json',
},
});- Open the app and select "Citizen"
- Navigate to the Search tab
- Use text search or voice search
- View drug details and authenticity status
- Go to the Scan tab
- Scan QR code on medication
- View verification results
- Report suspicious drugs if needed
- Navigate to the Report tab
- Fill out the report form
- Submit with details and photos
- Track report status
- Select "FDA Administrator"
- Enter credentials
- Access admin dashboard
- View all drugs in the database
- Add new drugs with QR codes
- Update drug information
- Monitor drug status
- View real-time analytics
- Monitor drug verification rates
- Track citizen reports
- Generate reports
# Run all tests
npm test
# Run specific test
npm test -- --testNamePattern="VoiceInput"
# Run with coverage
npm test -- --coverage- Unit Tests: Component and service testing
- Integration Tests: API integration testing
- E2E Tests: Full user flow testing
- Accessibility Tests: Screen reader and voice navigation
# Build for iOS
expo build:ios --type archive
# Build for Android
expo build:android --type apk
# Build for Android App Bundle
expo build:android --type app-bundle-
iOS App Store:
- Build with Expo
- Upload to App Store Connect
- Submit for review
-
Google Play Store:
- Build APK/AAB
- Upload to Google Play Console
- Submit for review
# Build for web
expo build:web
# Deploy to hosting service
npm run deploy- JWT token management
- Secure token storage
- Automatic token refresh
- Session management
- Encrypted local storage
- Secure API communication
- Input validation
- XSS protection
- Minimal data collection
- User consent management
- Data anonymization
- GDPR compliance
- Code Splitting: Lazy loading of components
- Image Optimization: Compressed images and lazy loading
- Caching: API response caching
- Bundle Optimization: Tree shaking and minification
- Performance Metrics: Load times, frame rates
- Error Tracking: Crash reporting and analytics
- User Analytics: Usage patterns and engagement
- API Monitoring: Response times and errors
- English (Primary)
- Twi (Akan)
- Ga
- Ewe
- Voice Recognition: Multi-language voice input
- Text-to-Speech: Localized voice output
- UI Translation: Complete interface translation
- Cultural Adaptation: Local customs and preferences
- Fork the repository
- Create a feature branch
- Install dependencies
- Make changes
- Run tests
- Submit pull request
- TypeScript: Strict type checking
- ESLint: Code quality enforcement
- Prettier: Code formatting
- Conventional Commits: Standard commit messages
- Unit tests for new components
- Integration tests for API calls
- Accessibility testing
- Performance testing
This project is licensed under the MIT License - see the LICENSE file for details.
- π User Guide
- π§ Developer Guide
- π¨ Design System
- π§ͺ Testing Guide
- π§ Email: [email protected]
- π± Phone: +233 XX XXX XXXX
- π Website: https://drugguard-ghana.com
- π¬ Discord: DrugGuard Community
- FDA Ghana for regulatory guidance
- React Native and Expo communities
- All contributors and stakeholders
- Ghanaian healthcare professionals
- Drug interaction checker
- Medication reminder system
- Offline mode improvements
- Enhanced analytics
- Telemedicine integration
- Pharmacy locator
- Price comparison
- Community features
- AI-powered drug recognition
- Blockchain integration
- Advanced analytics
- Multi-country support
DrugGuard Ghana Frontend - Empowering drug safety and verification in Ghana π¬π