ποΈ Project Structure
This page explains in detail the architecture and code organization in ExpoPlate, helping you understand where to find each element and how everything fits together.
π Overview
βββ app/
β βββ (auth)/
β β βββ resetPassword.tsx
β β βββ sign-in.tsx
β β βββ sign-up.tsx
β β βββ welcome.tsx
β βββ (protected)/
β β βββ (tabs)/
β β β βββ _layout.tsx
β β β βββ ai.tsx
β β β βββ index.tsx
β β β βββ notifications.tsx
β β β βββ offline.tsx
β β β βββ payment.tsx
β β β βββ premium.tsx
β β β βββ profile.tsx
β β β βββ settings.tsx
β β β βββ tasks.tsx
β β βββ _layout.tsx
β β βββ privacy-policy.tsx
β β βββ terms-of-service.tsx
β βββ onboarding/
β β βββ _layout.tsx
β β βββ index.tsx
β βββ _layout.tsx
β βββ +not-found.tsx
β βββ index.tsx
βββ assets/
β βββ fonts/
β β βββ InstrumentSerif-Italic.ttf
β β βββ InstrumentSerif-Regular.ttf
β βββ icons/
β β βββ adaptive_icon.png
β β βββ icon_base.png
β β βββ icon_dark.png
β β βββ icon_light.png
β βββ logo/
β β βββ revenuecat.png
β β βββ stripe.jpeg
β βββ splashscreen/
β β βββ splashscreen_dark.png
β β βββ splashscreen_light.png
β βββ icon.png
βββ components/
β βββ ai/
β β βββ AIThinkingLoader.tsx
β β βββ AutoResizingInput.tsx
β β βββ ChatHeader.tsx
β β βββ index.ts
β β βββ MessageActions.tsx
β β βββ MessageBubble.tsx
β β βββ PromptLabels.tsx
β β βββ ThinkingAnimation.tsx
β β βββ TypewriterText.tsx
β βββ auth/
β β βββ appleProviderButton.tsx
β β βββ EmailLoginForm.tsx
β β βββ EmailLoginToggle.tsx
β β βββ googleProviderButton.tsx
β β βββ index.ts
β β βββ Separator.tsx
β β βββ SocialLoginButtons.tsx
β βββ email/
β β βββ buttonSendEmail.tsx
β βββ layout/
β β βββ LayoutWrapper.tsx
β βββ notifications/
β β βββ DebugInfo.tsx
β β βββ DeviceInfoCard.tsx
β β βββ index.ts
β β βββ NotificationCenter.tsx
β β βββ NotificationHeader.tsx
β β βββ NotificationSettings.tsx
β β βββ PermissionStatusCard.tsx
β β βββ push.tsx
β β βββ TestButtonsSection.tsx
β βββ onboarding/
β β βββ index.ts
β β βββ NotificationSettings.tsx
β β βββ OnboardingFeatureCard.tsx
β β βββ OnboardingNavigationButtons.tsx
β β βββ OnboardingProgressBar.tsx
β β βββ OnboardingStep1.tsx
β β βββ OnboardingStep2.tsx
β β βββ OnboardingStep3.tsx
β βββ payment/
β β βββ index.ts
β β βββ PaymentButton.tsx
β β βββ PaymentSheet.tsx
β β βββ paywall.tsx
β β βββ stripeButtonPay.tsx
β βββ premium/
β β βββ index.ts
β β βββ PaywallScreen.tsx
β β βββ PremiumGate.tsx
β β βββ PremiumStatus.tsx
β β βββ RestorePurchaseButton.tsx
β βββ profile/
β β βββ EditFieldModal.tsx
β β βββ index.ts
β β βββ ProfileActionsSection.tsx
β β βββ ProfileEditSection.tsx
β β βββ ProfileHeaderSection.tsx
β β βββ ProfileInfoSection.tsx
β β βββ ProfileStatusSection.tsx
β βββ settings/
β β βββ AssistanceSection.tsx
β β βββ index.ts
β β βββ NotificationsSection.tsx
β β βββ PreferencesSection.tsx
β β βββ ProfileSection.tsx
β β βββ SettingsRow.tsx
β β βββ SettingsSection.tsx
β β βββ SubscriptionSection.tsx
β βββ tasks/
β β βββ CreateTaskForm.tsx
β β βββ EditTaskModal.tsx
β β βββ index.ts
β β βββ StatusBadges.tsx
β β βββ TaskCard.tsx
β β βββ TaskList.tsx
β βββ ui/
β βββ avatar.tsx
β βββ badge.tsx
β βββ button.tsx
β βββ card.tsx
β βββ checkbox.tsx
β βββ dialog.tsx
β βββ dynamic-header.tsx
β βββ header-menu.tsx
β βββ header-title.tsx
β βββ input.tsx
β βββ label.tsx
β βββ ProgressBar.tsx
β βββ select.tsx
β βββ sidebar.tsx
β βββ table.tsx
β βββ tabs.tsx
β βββ text.tsx
β βββ toggle.tsx
βββ config/
β βββ i18n.ts
β βββ linking.ts
β βββ supabase.ts
βββ constants/
β βββ colors.ts
β βββ emailTemplates.ts
β βββ navigation.ts
β βββ notifications.ts
β βββ onboarding.ts
β βββ promptData.ts
β βββ quickActions.ts
βββ context/
β βββ AuthContext.tsx
β βββ RevenuCatContext.tsx
β βββ SidebarContext.tsx
β βββ StripeContext.tsx
β βββ ThemeContext.tsx
βββ fetch/
β βββ profile.ts
β βββ tasks.ts
βββ hooks/
β βββ useAIChat.ts
β βββ useCache.ts
β βββ useColorScheme.ts
β βββ useIconColors.ts
β βββ useImageUpload.ts
β βββ useNetworkStatus.ts
β βββ useNotifications.ts
β βββ useOnboarding.ts
β βββ usePremiumStatus.ts
β βββ useProfile.ts
β βββ useSounds.ts
β βββ useTasks.ts
β βββ useTheme.tsx
β βββ useTranslation.ts
βββ icons/
β βββ index.tsx
βββ lib/
β βββ storage/
β β βββ index.ts
β β βββ supabase.ts
β β βββ zustand.ts
β
βββ queryClient.ts
βββ utils.ts
βββ locales/
β βββ en.json
β βββ es.json
β βββ fr.json
β βββ pt.json
βββ stores/
β βββ offlineStore.ts
β βββ onboardingStore.ts
β βββ profileStore.ts
β βββ README.md
βββ supabase/
β βββ functions/
β β βββ ai-completion/
β β β βββ index.ts
β β βββ create-payment-intent/
β β β βββ index.ts
β β βββ create-stripe-checkout/
β β β βββ index.ts
β β βββ resend-email/
β β β βββ index.ts
β β βββ send-notifications/
β β β βββ index.ts
β β βββ stripe-webhooks/
β β βββ index.ts
β
βββ migrations/
β βββ 20250202000000_init_supabase.sql
β
βββ templates/
β βββ invite.html
β
βββ config.toml
π Main Folders Detail
π± /app
- Expo Router Structure
The main application structure using Expo Router file-based routing.
app/
βββ (auth)/ # Authentication group
β βββ resetPassword.tsx # Password reset screen
β βββ sign-in.tsx # Sign in screen
β βββ sign-up.tsx # Sign up screen
β βββ welcome.tsx # Welcome screen
β
βββ (protected)/ # Protected routes group
β βββ (tabs)/ # Tab navigation
β β βββ _layout.tsx # Tab layout configuration
β β βββ ai.tsx # AI chat screen
β β βββ index.tsx # Home screen
β β βββ notifications.tsx # Notifications screen
β β βββ offline.tsx # Offline mode screen
β β βββ payment.tsx # Payment screen
β β βββ premium.tsx # Premium features screen
β β βββ profile.tsx # Profile screen
β β βββ settings.tsx # Settings screen
β β βββ tasks.tsx # Tasks screen
β βββ _layout.tsx # Protected layout
β βββ privacy-policy.tsx # Privacy policy
β βββ terms-of-service.tsx # Terms of service
β
βββ onboarding/ # Onboarding flow
β βββ _layout.tsx # Onboarding layout
β βββ index.tsx # Onboarding screens
β
βββ _layout.tsx # Root layout
βββ +not-found.tsx # 404 page
βββ index.tsx # App entry point
π¨ /assets
- Static Resources
Contains all static resources for your application.
assets/
βββ fonts/ # Custom fonts
β βββ InstrumentSerif-Italic.ttf
β βββ InstrumentSerif-Regular.ttf
β
βββ icons/ # App icons
β βββ adaptive_icon.png # Android adaptive icon
β βββ icon_base.png # Base icon
β βββ icon_dark.png # Dark theme icon
β βββ icon_light.png # Light theme icon
β
βββ logo/ # Service logos
β βββ revenuecat.png # RevenueCat logo
β βββ stripe.jpeg # Stripe logo
β
βββ splashscreen/ # Splash screens
β βββ splashscreen_dark.png
β βββ splashscreen_light.png
β
βββ icon.png # Main app icon
π§© /components
- Reusable Components
Reusable components organized by categories and features.
components/
βββ ai/ # AI-related components
β βββ AIThinkingLoader.tsx # AI processing indicator
β βββ AutoResizingInput.tsx # Dynamic height input
β βββ ChatHeader.tsx # Chat interface header
β βββ MessageActions.tsx # Message interaction buttons
β βββ MessageBubble.tsx # Chat message display
β βββ PromptLabels.tsx # Predefined prompts
β βββ ThinkingAnimation.tsx # AI thinking animation
β βββ TypewriterText.tsx # Animated text reveal
β βββ index.ts # Exports
β
βββ auth/ # Authentication components
β βββ appleProviderButton.tsx # Apple Sign In
β βββ EmailLoginForm.tsx # Email login form
β βββ EmailLoginToggle.tsx # Login/signup toggle
β βββ googleProviderButton.tsx # Google Sign In
β βββ Separator.tsx # Visual separator
β βββ SocialLoginButtons.tsx # Social login buttons
β βββ index.ts # Exports
β
βββ email/ # Email components
β βββ buttonSendEmail.tsx # Email sending button
β
βββ layout/ # Layout components
β βββ LayoutWrapper.tsx # Base layout wrapper
β
βββ notifications/ # Notification components
β βββ DebugInfo.tsx # Debug information display
β βββ DeviceInfoCard.tsx # Device information card
β βββ NotificationCenter.tsx # Notification center
β βββ NotificationHeader.tsx # Notifications header
β βββ NotificationSettings.tsx # Settings interface
β βββ PermissionStatusCard.tsx # Permission status display
β βββ push.tsx # Push notifications
β βββ TestButtonsSection.tsx # Testing utilities
β βββ index.ts # Exports
β
βββ onboarding/ # Onboarding components
β βββ NotificationSettings.tsx # Permission requests
β βββ OnboardingFeatureCard.tsx # Feature showcase
β βββ OnboardingNavigationButtons.tsx # Navigation
β βββ OnboardingProgressBar.tsx # Progress indicator
β βββ OnboardingStep1.tsx # Step 1 component
β βββ OnboardingStep2.tsx # Step 2 component
β βββ OnboardingStep3.tsx # Step 3 component
β βββ index.ts # Exports
β
βββ payment/ # Payment components
β βββ PaymentButton.tsx # Generic payment button
β βββ PaymentSheet.tsx # Payment form interface
β βββ paywall.tsx # Simple paywall
β βββ stripeButtonPay.tsx # Stripe payment button
β βββ index.ts # Exports
β
βββ premium/ # Premium features
β βββ PaywallScreen.tsx # Complete paywall screen
β βββ PremiumGate.tsx # Content protection
β βββ PremiumStatus.tsx # Subscription status
β βββ RestorePurchaseButton.tsx # Purchase restoration
β βββ index.ts # Exports
β
βββ profile/ # Profile components
β βββ EditFieldModal.tsx # Field editing modal
β βββ ProfileActionsSection.tsx # Profile actions
β βββ ProfileEditSection.tsx # Edit interface
β βββ ProfileHeaderSection.tsx # Header with avatar
β βββ ProfileInfoSection.tsx # Information display
β βββ ProfileStatusSection.tsx # Account status
β βββ index.ts # Exports
β
βββ settings/ # Settings components
β βββ AssistanceSection.tsx # Help and support
β βββ NotificationsSection.tsx # Notification settings
β βββ PreferencesSection.tsx # App preferences
β βββ ProfileSection.tsx # Profile settings
β βββ SettingsRow.tsx # Individual setting item
β βββ SettingsSection.tsx # Settings container
β βββ SubscriptionSection.tsx # Subscription management
β βββ index.ts # Exports
β
βββ tasks/ # Task management
β βββ CreateTaskForm.tsx # Task creation form
β βββ EditTaskModal.tsx # Task editing modal
β βββ StatusBadges.tsx # Task status indicators
β βββ TaskCard.tsx # Individual task display
β βββ TaskList.tsx # Task collection
β βββ index.ts # Exports
β
βββ ui/ # Base UI components
βββ avatar.tsx # User avatar component
βββ badge.tsx # Status badges
βββ button.tsx # Button component
βββ card.tsx # Card container
βββ checkbox.tsx # Checkbox input
βββ dialog.tsx # Modal dialogs
βββ dynamic-header.tsx # Context-aware header
βββ header-menu.tsx # Header menu
βββ header-title.tsx # Page title
βββ input.tsx # Text input
βββ label.tsx # Form labels
βββ ProgressBar.tsx # Progress indicator
βββ select.tsx # Dropdown selection
βββ sidebar.tsx # Navigation drawer
βββ table.tsx # Data table
βββ tabs.tsx # Tab navigation
βββ text.tsx # Typography
βββ toggle.tsx # Switch component
βοΈ /config
- Configuration Files
Application configuration and setup files.
config/
βββ i18n.ts # Internationalization setup
βββ linking.ts # Deep linking configuration
βββ supabase.ts # Supabase client configuration
π /constants
- App Constants
Global constants and configuration values.
constants/
βββ colors.ts # Color palette and theme colors
βββ emailTemplates.ts # Email template constants
βββ navigation.ts # Navigation constants
βββ notifications.ts # Notification constants
βββ onboarding.ts # Onboarding constants
βββ promptData.ts # AI prompt templates and data
βββ quickActions.ts # Quick action constants
π /context
- React Context Providers
Context providers for global state management.
context/
βββ AuthContext.tsx # Authentication state
βββ RevenuCatContext.tsx # Subscription management
βββ SidebarContext.tsx # Sidebar state
βββ StripeContext.tsx # Payment context
βββ ThemeContext.tsx # Theme and dark mode
π‘ /fetch
- API Layer
API service functions and data fetching logic.
fetch/
βββ profile.ts # Profile API operations
βββ tasks.ts # Task management API
π£ /hooks
- Custom React Hooks
Custom hooks for reusable logic and state management.
hooks/
βββ useAIChat.ts # AI chat functionality
βββ useCache.ts # Caching utilities
βββ useColorScheme.ts # System color scheme
βββ useIconColors.ts # Dynamic icon colors
βββ useImageUpload.ts # Image upload functionality
βββ useNetworkStatus.ts # Network connectivity
βββ useNotifications.ts # Push notifications
βββ useOnboarding.ts # Onboarding flow
βββ usePremiumStatus.ts # Premium subscription status
βββ useProfile.ts # Profile management
βββ useSounds.ts # Sound effects
βββ useTasks.ts # Task management
βββ useTheme.tsx # Theme management
βββ useTranslation.ts # Internationalization
π¨ /icons
- Icon Components
Centralized icon components and utilities.
icons/
βββ index.tsx # Icon library with all app icons
π§ /lib
- Utility Libraries
Core utility functions and libraries.
lib/
βββ storage/ # Storage utilities
β βββ index.ts # Main storage interface
β βββ supabase.ts # Supabase storage utilities
β βββ zustand.ts # Zustand storage configuration
β
βββ queryClient.ts
βββ utils.ts
π /locales
- Internationalization
Translation files for multi-language support.
locales/
βββ en.json
βββ es.json
βββ fr.json
βββ pt.json
π¦ /stores
- Zustand State Management
Global state stores using Zustand.
stores/
βββ offlineStore.ts # Offline data management
βββ onboardingStore.ts # Onboarding flow state
βββ profileStore.ts # User profile state
βββ README.md # Store documentation
ποΈ /supabase
- Backend Configuration
Supabase backend configuration, functions, and database migrations.
supabase/
βββ functions/ # Edge functions
β βββ ai-completion/ # AI completion function
β β βββ index.ts
β βββ create-payment-intent/ # Payment intent creation
β β βββ index.ts
β βββ create-stripe-checkout/
β β βββ index.ts
β βββ resend-email/
β β βββ index.ts
β βββ send-notifications/
β β βββ index.ts
β βββ stripe-webhooks/
β βββ index.ts
β
βββ migrations/
β βββ 20250202000000_init_supabase.sql
β
βββ templates/
β βββ invite.html
β
βββ config.toml
π /types
- TypeScript Definitions
Comprehensive TypeScript type definitions for the entire application.
types/
βββ ai.d.ts # AI chat types
βββ auth.d.ts # Authentication types
βββ hooks.d.ts # Hook types
βββ index.ts # Type exports
βββ navigation.d.ts # Navigation types
βββ onboarding.d.ts # Onboarding types
βββ payment.d.ts # Payment and subscription types
βββ profile.d.ts # User profile types
βββ revenuecat.d.ts # RevenueCat types
βββ settings.d.ts # Settings types
βββ stores.d.ts # Store types
βββ tasks.d.ts # Task management types
βββ theme.d.ts # Theme types
βββ ui.d.ts # UI component types
π οΈ /utils
- Utility Functions
Helper functions and utilities used throughout the application.
utils/
βββ clearSession.ts # Session cleanup utilities
βββ functionNavigations.ts # Navigation helper functions
ποΈ Architecture Principles
ExpoPlate follows clean architecture principles with clear separation of concerns:
π± Presentation Layer
- Components: Reusable UI components with clear props interfaces
- Screens: Route components that compose multiple components
- Hooks: Custom hooks for component logic and state management
πΌ Business Logic Layer
- Stores: Global state management with Zustand
- Context: React context for specific domains (auth, theme, etc.)
- Custom Hooks: Encapsulated business logic and API interactions
π Data Layer
- Fetch: API service functions for data operations
- Supabase: Backend-as-a-Service configuration and functions
- Storage: Local storage utilities (MMKV, Secure Store)
π¨ Presentation Patterns
// Component structure example
const ProfileScreen = () => {
// 1. Hooks and state
const { profile, loading, updateProfile } = useProfile();
const navigation = useNavigation();
// 2. Event handlers
const handleSave = useCallback(async (data) => {
await updateProfile(data);
navigation.goBack();
}, [updateProfile, navigation]);
// 3. Render logic
if (loading) return <LoadingSpinner />;
return (
<ProfileEditForm
profile={profile}
onSave={handleSave}
/>
);
};
π Data Flow
βββββββββββββββββββ ββββββββββββββββ βββββββββββββββ βββββββββββββββ
β Screen/ComponentβββββΆβ Custom Hook βββββΆβ API Service βββββΆβ Supabase β
βββββββββββββββββββ ββββββββββββββββ βββββββββββββββ βββββββββββββββ
β² β β
β βΌ β
β βββββββββββββββ β
ββββββββββββββββ Zustand Storeβββββββββββββββββββββββββββββββββ
βββββββββββββββ
π Naming Conventions
Files and Folders
- Components: PascalCase (
Button.tsx
,LoginForm.tsx
) - Hooks: camelCase with
use
prefix (useAuth.ts
,useApi.ts
) - Services: camelCase (
profileService.ts
,taskService.ts
) - Utilities: camelCase (
formatDate.ts
,validation.ts
) - Folders: camelCase (
components
,hooks
,stores
)
Variables and Functions
- Variables: camelCase (
isLoading
,userProfile
) - Constants: SCREAMING_SNAKE_CASE (
API_BASE_URL
,MAX_RETRY_ATTEMPTS
) - Functions: camelCase (
handleLogin
,formatCurrency
) - Components: PascalCase (
LoginScreen
,CustomButton
)
TypeScript Types
- Interfaces: PascalCase (
User
,ApiResponse
) - Types: PascalCase (
TaskStatus
,NavigationRoute
) - Enums: PascalCase (
AuthStatus
,PaymentStatus
)
π― Best Practices
Import Organization
// 1. External libraries
import React from 'react';
import { View, Text } from 'react-native';
// 2. Internal project imports
import { Button } from '../../components/ui';
import { useAuth } from '../../hooks/useAuth';
import { colors } from '../../constants/colors';
// 3. Type imports
import type { LoginScreenProps } from './types';
Centralized Exports
// components/ui/index.ts
export { Button } from './button';
export { Input } from './input';
export { Card } from './card';
export { Dialog } from './dialog';
// Usage
import { Button, Input, Card } from '../components/ui';
Component Structure
// Standard component structure
const TaskCard: React.FC<TaskCardProps> = ({
task,
onToggleComplete,
onEdit,
onDelete
}) => {
// 1. Hooks and state
const [isEditing, setIsEditing] = useState(false);
const { user } = useAuth();
// 2. Event handlers
const handleEdit = useCallback(() => {
setIsEditing(true);
}, []);
// 3. Effects
useEffect(() => {
// Component effects
}, []);
// 4. Render logic
return (
<Card className="p-4 mb-2">
{/* Component JSX */}
</Card>
);
};
π Next Steps
Now that you understand the structure:
- π Authentication - User management and security
- π¨ Design System - Colors and theming
- π― Icons System - Icon color management
- π Basic Example - Getting started examples
π‘ Pro Tip
This structure is designed to be scalable and maintainable. Feel free to adapt it according to your specific project needs while maintaining the core architectural principles!