mirror of
https://github.com/selfxyz/self.git
synced 2026-04-05 03:00:53 -04:00
* docs: align migration rules with updated checklist * docs: restore demo sample sections
2.5 KiB
2.5 KiB
Architecture Prompts
Each item from the architecture checklist expands into concrete tasks. Pick items independently to parallelize work.
Note
: This document uses standard Markdown
<details>and<summary>tags for collapsible sections.
Pre-flight checks
Run these commands before committing changes:
yarn workspace @selfxyz/mobile-sdk-alpha nice
yarn workspace @selfxyz/mobile-sdk-alpha build
yarn workspace @selfxyz/mobile-sdk-alpha types
yarn workspace @selfxyz/mobile-sdk-alpha test
yarn lint
yarn build
1. Modular feature directories
Split features into dedicated folders
- Under
src/, create folders likemrz/andqr/as features are added. - Re-export feature APIs from
src/index.tsusing explicit named exports to keep tree shaking intact.
2. Bridge layer for native events
Introduce shared event bridge
- Add
src/bridge/nativeEvents.tswrappingNativeModulesandNativeEventEmitter. - Expose
addListenerandremoveListenerhelpers so modules can register without touching React Native directly.
3. Exception classes
Add typed error hierarchy
- Create
src/errors/with classes likeInitErrorandLivenessErrorextendingError. - Replace generic throws with these classes and document them in the README.
4. SDK lifecycle management
Move to an SDK class
- Convert
createSelfClientinto a class exposinginitialize()anddeinitialize(). - Store configuration and adapters on the instance to avoid global state.
5. Package targets
Scaffold additional entry points
- Add build outputs for web, Capacitor, and Cordova under
dist/. - Configure
package.jsonexportsto point to the new bundles.
6. Dogfood in /app
Integrate with monorepo app
- Add
@selfxyz/mobile-sdk-alphatoapp/package.jsonand wire flows to use the SDK. - Validate builds and tests in the
appworkspace.
7. Android demo app
Provide minimal Android sample
- Under
samples/android/, scaffold a basic React Native project showing MRZ → proof generation. - Document setup steps in
samples/android/README.md.