How lazzerbeamstudios/spectra-react-native works
Project type and purpose
• This is a mobile-first, React Native (Expo) front-end application (app-v1/) written in TypeScript.
• It uses Expo Router for screen navigation, NativeWind (Tailwind CSS) for styling, Zustand for client state, and an OpenAPI-generated client to call an external REST API (the backend is out of scope).
File structure
• Top level: project meta (.gitignore, README.md, LICENSE, tool-config) and a single app folder (app-v1/).
• app-v1/: environment files, build scripts, TS configs, Expo configs (app.json, metro.config.js, babel.config.js, etc.).
• src/:
• api.ts – central API entry point.
• app/ – Expo Router folder-based navigation with (auth) and (app) layout groups.
• screens/ – feature-based UI screens (home, sign-in, profile, dashboard, not-found).
• components/ – shared UI components (e.g., BackButton).
• stores/ – Zustand or other client-state stores (auth.store.ts, profile.store.ts).
• openapi/ – generated OpenAPI client, docs, configs, and codegen scripts.
• assets/ – static images.
• scripts/ – utility scripts (error handling, Android nav bar fix).
• theme-constants.ts, tailwind.config.js – theming and styling.
Key README insights
• Dependencies: Node.js (via ASDF), Expo CLI.
• Commands: npm install/update, expo start/run, openapi-generator script.
• No backend code—everything here runs on the mobile client.
• Mobile Client (Expo Runtime)
• Navigation Layer (Expo Router with app/(auth) and app/(app) stacks)
• UI Components & Screens (React components under src/components & src/screens)
• State Management (Zustand stores in src/stores)
• API Client (OpenAPI-generated client modules under src/openapi)
• External REST API (backend service with Auth, Profile, Home endpoints)
• Asset Store (images in src/assets)
• Build & Tooling (Metro bundler, Babel, TypeScript compiler, Expo CLI)
b. Component relationships & data flow
1. User taps on Screen (UI layer)
2. Screen reads/writes client-state via Zustand store
3. Store triggers OpenAPI client (api.ts) to make HTTP requests to External REST API
4. HTTP response updates store or returns data to UI
5. Navigation Layer transitions between Screens
c. Architectural patterns & design principles
• Folder-based routing (Expo Router) for clear separation of auth vs. app flows
• Unidirectional data flow: UI → Store → API → Store → UI
• Code generation: OpenAPI schema → strongly typed client APIs
• Component reusability: shared UI components in src/components
• Theming via Tailwind (NativeWind) and centralized theme constants
d. Key technologies & frameworks
• Expo & React Native (mobile runtime)
• Expo Router (file-system–based navigation)
• TypeScript, Babel, Metro Bundler (build toolchain)
• Zustand (state management)
• OpenAPI Generator (client SDK)
• NativeWind / Tailwind CSS (styling)
• asdf, brew, npm, Expo CLI (development environment)