Modular architecture and technical standards for Expo with Jotai, Expo Router, and Biome.
Consult these resources for detailed implementation patterns:
src/ directory organization.This document outlines the architectural patterns and technical standards used in this boilerplate.
The project follows a modular architecture that separates concerns into clear layers:
src/)app/: Expo Router routes and layouts. Handles file-based navigation.components/: Reusable UI components. Each component should be in its own folder.constants/: Global constants (Environment variables, Storage keys, Strings).hooks/: Custom React hooks for shared logic.models/: TypeScript interfaces and types (Data models).services/: API integration and external service handlers.stores/: Jotai atoms for global and persistent state.styles/: Global styles and styled-component-like abstractions.tasks/: Background tasks and cron-like jobs.theme/: Design tokens (Colors, Spacing, Fonts, Opacity, Border).utils/: Low-level utility functions (Storage, Cache, Matchers).We use Jotai for atomic state management.
src/stores/.Atom suffix for atom variables (e.g., articlesAtom).atomWithStorage for data that should persist across app reloads.Example:
import { atom } from 'jotai';
import { atomWithStorage } from 'jotai/utils';
export const countAtom = atom(0);
export const persistentCountAtom = atomWithStorage('count', 0);
Each component should follow the "Folder-per-Component" pattern:
src/components/MyComponent/
āāā MyComponent.tsx # Implementation
āāā MyComponent.styles.ts # StyleSheet definitions
āāā MyComponent.stories.tsx # Storybook documentation
āāā MyComponent.test.tsx # Unit tests (Co-located)
.styles.ts.theme() function from @/theme/colors inject colors.AppBar.tsx).http utility for base requests.src/services/api.ts.src/services/mocks/ for development and testing.app/ files lean. Delegate logic to hooks or stores._layout.tsx for shared UI (Headers, Providers, Sidebars).Slot or Stack depending on the navigation needs.bun format to ensure code style compliance.@/) to avoid deep relative paths (e.g., ../../../../utils).EXPO-TEST-SETUP.instructions.md.@testing-library/react-native.theme() from src/theme/colors.ts.src/theme/ (spacing, fonts, etc.) for consistency.expo-image over native Image for better caching and performance.