How rohanberadev/expo-scroll-v1 works
Project type and purpose
• This is a cross-platform mobile app built on Expo (React Native) with file-based routing and Tailwind styling.
• It leverages Appwrite as a BaaS for authentication, database, and storage.
File structure
• android/: Native Android project (Gradle, Manifest, Kotlin entry points).
• app/: Expo Router file-based routes → each .tsx maps to a screen (tabs, auth flow, profile, posts).
• components/: Reusable presentational React components (cards, buttons, inputs).
• contexts/: React Contexts (e.g. auth.tsx) for global state (authentication).
• hooks/: Custom hooks for CRUD operations (posts, comments, follows, userProfiles).
• services/ + data/: Wrappers around the Appwrite client (data/appwrite.ts initializes client; services/appwrite.ts exposes typed API functions).
• constants/, interfaces/, types/: Shared types, enums, and static assets definitions.
• lib/: Utility functions (e.g. file handling).
• Config & tooling: babel.config.js, metro.config.js, tailwind.config.js, package.json.
Main components and their interactions
a. UI Layer
• Screens (app/…/*.tsx) drive the navigation flow.
• Components render structured UI elements.
b. State & Business Logic
• Contexts provide authentication state and dispatcher functions.
• Hooks perform data fetching/mutations and emit states (loading, error, data).
c. Data Layer
• Services implement calls to the Appwrite SDK.
• Appwrite SDK (in data/appwrite.ts) handles low-level HTTP communication.
d. Native & Build Tools
• Expo Runtime / Metro Bundler builds and serves JS to devices.
• Android Container hosts the JS engine on Android devices.
e. External Services
• Appwrite Server (hosted externally) for auth, database, storage.
Architectural patterns & design principles
• File-based routing: directory names → URI/screen mapping.
• Component-based architecture: separation of concerns between UI, logic, and data.
• Hooks for side-effects: encapsulate data logic, align with React Query patterns.
• Context API: manage cross-cutting concerns (auth).
• BaaS integration: Appwrite as single source of truth for back-end services.