{"id":28627429,"url":"https://github.com/bryce-mcmath/storage-poc","last_synced_at":"2025-06-12T09:41:41.941Z","repository":{"id":296088235,"uuid":"982442510","full_name":"bryce-mcmath/storage-poc","owner":"bryce-mcmath","description":"Experimenting with migrating a React Native app from context store, AsyncStorage, and react-native-keychain, to Zustand, mmkv, and expo-secure-store","archived":false,"fork":false,"pushed_at":"2025-05-28T22:25:25.000Z","size":633,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-28T23:27:29.696Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bryce-mcmath.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-12T22:28:33.000Z","updated_at":"2025-05-28T22:25:28.000Z","dependencies_parsed_at":"2025-05-28T23:38:06.173Z","dependency_job_id":null,"html_url":"https://github.com/bryce-mcmath/storage-poc","commit_stats":null,"previous_names":["bryce-mcmath/storage-poc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bryce-mcmath/storage-poc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryce-mcmath%2Fstorage-poc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryce-mcmath%2Fstorage-poc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryce-mcmath%2Fstorage-poc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryce-mcmath%2Fstorage-poc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bryce-mcmath","download_url":"https://codeload.github.com/bryce-mcmath/storage-poc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryce-mcmath%2Fstorage-poc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259440486,"owners_count":22857930,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-12T09:41:36.781Z","updated_at":"2025-06-12T09:41:41.925Z","avatar_url":"https://github.com/bryce-mcmath.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Storage and State Management Migration POC\n\nThis project demonstrates a migration from a traditional React Native state management approach to a more modern and performant one. It provides a side-by-side comparison of both implementations, along with performance benchmarks.\n\n## Existing Implementation (`src/existing/`)\n\nThe existing implementation uses:\n\n- **State Management**: React Context API with useReducer\n- **Data Storage**: AsyncStorage for general data\n- **Secure Storage**: react-native-keychain for sensitive data (v8.x.x)\n\nThis represents a common pattern used in many React Native applications built in recent years.\n\n## New Implementation (`src/new/`)\n\nThe new implementation uses:\n\n- **State Management**: Zustand\n- **Data Storage**: React Native MMKV\n- **Secure Storage**: Expo Secure Store\n\n## Key Differences\n\n### State Management\n\n**Context + Reducer (Existing)**\n- Verbose boilerplate code\n- Requires provider wrapping\n- Explicit separation of state and actions\n- Makes testing components slightly more complex\n- No built-in persistence\n\n**Zustand (New)**\n- Minimal boilerplate\n- No providers needed\n- Integrated state and actions in one store\n- Easier to test components\n- Built-in persistence middleware\n\n### Storage\n\n**AsyncStorage (Existing)**\n- Asynchronous API\n- Serialization required (JSON.stringify/parse)\n- String-only storage\n- Less performant for large datasets or frequent access\n\n**MMKV (New)**\n- Synchronous API\n- Multiple data types supported\n- Up to 10x faster than AsyncStorage\n- Native implementation with high performance\n\n### Secure Storage\n\n**react-native-keychain (Existing)**\n- Uses Keychain (iOS) and Keystore (Android)\n- Limited to username/password and generic secure items\n- More complex API\n\n**expo-secure-store (New)**\n- Similar security guarantees \n- Simpler, more consistent API across platforms\n- Better integrated with Expo ecosystem\n\n## Performance Comparison\n\nThe MMKV storage implementation is significantly faster than AsyncStorage, especially for:\n- App startup time\n- Frequent read/write operations\n- Large datasets\n\n## Usage\n\nThis app demonstrates both implementations side-by-side for comparison. Toggle between them using the header buttons.\n\n## Migration Tips\n\nWhen migrating from the existing approach to the new one:\n\n1. Start by replacing AsyncStorage with MMKV for an immediate performance boost\n2. Convert your contexts and reducers to Zustand stores one by one\n3. Replace react-native-keychain usage with expo-secure-store\n4. Remove provider wrappers as they're no longer needed with Zustand\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryce-mcmath%2Fstorage-poc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbryce-mcmath%2Fstorage-poc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryce-mcmath%2Fstorage-poc/lists"}