System Overview
SmartCart is a React Native mobile application built with Expo framework (v52.0.31) using TypeScript. The app implements a stack-based navigation system with screens for authentication (Login, Registration, ConfirmSignUp), shopping functionality (Home, Scan, Cart, Checkout, Payment), and order management (Invoices).
Authentication is handled through AWS Amplify with Cognito user pools. The application entry point is App.tsx which configures AWS Amplify and sets up the navigation stack with context providers for theming and cart state management.
Technology Stack
| Technology | Version | Purpose |
|---|---|---|
| React Native | 0.76.7 | Cross-platform mobile framework |
| Expo SDK | 52.0.31 | Development platform & build tools |
| TypeScript | 5.3.3 | Type-safe JavaScript |
| AWS Amplify | 5.3.26 | Cloud backend services (auth) |
| React Navigation | 6.1.18 | Screen navigation & routing |
| React Native Paper | 5.12.5 | Material Design UI components |
Architecture Diagram
graph TD
A[App.tsx] --> B[AWS Amplify Config]
A --> C[Context Providers]
C --> D[ThemeProvider]
C --> E[CartProvider]
A --> F[Stack Navigator]
F --> G[Auth Screens]
F --> H[Shopping Screens]
F --> I[Invoice Screen]
G --> J[Login / Register / Confirm]
H --> K[Home / Scan / Cart / Checkout]
B --> L[AWS Cognito]
H --> M[Backend API]
Project Organization
SmartCart/
โโโ App.tsx # Entry point, Amplify config, navigation
โโโ aws-exports.ts # AWS Amplify configuration
โโโ context/
โ โโโ CartContext.tsx # Cart state management
โ โโโ ThemeProvider.tsx # Theme context
โโโ screens/
โ โโโ LoginScreen.tsx
โ โโโ RegistrationScreen.tsx
โ โโโ HomeScreen.tsx
โ โโโ ScanScreen.tsx
โ โโโ CartScreen.tsx
โ โโโ CheckoutScreen.tsx
โ โโโ PaymentScreen.tsx
โ โโโ InvoicesScreen.tsx
โโโ api.js # Axios HTTP client
Security Overview
Authentication uses AWS Cognito with email-based login and 8-character minimum passwords. Email verification is required. MFA is disabled. Local data is stored without encryption via AsyncStorage. The API client communicates over HTTP without HTTPS.
Security Findings
Screen Map
| Screen | File | Purpose |
|---|---|---|
| Login | LoginScreen.tsx | Email/password authentication |
| Registration | RegistrationScreen.tsx | New account creation |
| Home | HomeScreen.tsx | Main dashboard after login |
| Scan | ScanScreen.tsx | Camera barcode scanner |
| Cart | CartScreen.tsx | Shopping cart with quantities |
| Checkout | CheckoutScreen.tsx | Order finalization |
| Payment | PaymentScreen.tsx | Payment processing |
| Invoices | InvoicesScreen.tsx | Purchase history |
State Management
Two React Context providers manage global state:
- CartContext โ manages cart items, quantities, add/remove operations, and total calculation
- ThemeProvider โ manages light/dark theme preferences using React Native Paper's theming system
Navigation Flow
graph TD
A((Start)) --> B[Login]
B --> C{Authenticated?}
C -->|No| D[Register]
D --> E[Confirm Email]
E --> B
C -->|Yes| F[Home]
F --> G[Scan Barcode]
G --> H[Cart]
H --> I[Checkout]
I --> J[Payment]
J --> K[Invoice]
F --> K