Skip to main content

@amisi-mobile-starter/core

@amisi-mobile-starter/core exports shared infrastructure used throughout the workspace.

Storage

Secure storage is asynchronous:
secureStorage exposes setItem, getItem, deleteItem, hasItem, setObject, and getObject. setItem and setObject accept optional { keychainService?, keychainAccessible? }. Native uses expo-secure-store; web uses localStorage with a __secure_ key prefix. Key-value storage is synchronous:
kvStorage exposes initialize, get, setItem, getItem, deleteItem, hasItem, clear, getAllKeys, setObject, getObject, setNumber, getNumber, setBoolean, and getBoolean. Initialization defaults to the MMKV ID default and falls back to in-memory storage if MMKV cannot load.

Logging

The signatures are debug|info|warn(message, context?) and error(message, error?, context?). Configure logging with logger.configure({ minLevel, enableConsole, enableRemote, remoteHandler? }). Defaults are info, console enabled, and remote disabled.

Errors

The exported factories are createNetworkError, createAuthError, createValidationError, createNotFoundError, createPermissionError, createRateLimitError, and createServerError. wrapError(error, defaultMessage?) preserves an existing AppError. ErrorBoundary accepts children, fallback?: (error, resetError) => ReactNode, and onError?: (error, errorInfo) => void.

Platform and app state

device exposes getPlatform, isIOS, isAndroid, isWeb, getOSVersion, getDeviceInfo, screen dimensions and scales, pixelToDP, and small/medium/large screen checks.
appState also exposes getCurrentState, isActive, isInBackground, isInactive, addListener, removeListener, removeAllListeners, onActive, and onInactive.

Utilities

The package exports debounce, throttle, debounceAsync, invariant, assertion helpers, InvariantError, and cn(...inputs) for clsx plus tailwind-merge class composition.