# blitzbugg/entepocket architecture

> Architecture diagram of the GitHub repository blitzbugg/entepocket, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/blitzbugg/entepocket
- Repository: https://github.com/blitzbugg/entepocket

## Overview

1. **High-level shape**
   - EntePocket is a **single mobile client app** built with **Expo / React Native / TypeScript**.
   - The architecture is centered on **Expo Router** file-based navigation, with **Supabase** as the remote backend.
   - The codebase is split into a clear **UI layer**, **state layer**, **integration layer**, and **shared domain/config** files.

2. **Navigation and app shells**
   - `app/_layout.tsx` is the root composition point for the whole app.
   - `app/(tabs)/_layout.tsx` defines the main authenticated tab shell.
   - `app/auth/login.tsx` and `app/auth/verify.tsx` form the OTP auth flow.
   - `app/modal.tsx` is a separate modal route outside the main tab experience.

3. **Primary user-facing surfaces**
   - The main product area is the tab group under `app/(tabs)/`.
   - The key screens are:
     - `home.tsx` and `index.tsx` for landing/dashboard behavior,
     - `bills.tsx` for recurring bill tracking,
     - `family.tsx` for household/group collaboration,
     - `history.tsx` for past expenses/activity,
     - `profile.tsx` for user/account settings.
   - This suggests the app is organized around a **family expense notebook** rather than a deep finance dashboard.

4. **Authentication boundary**
   - Authentication is **phone OTP-based** and appears to be the main entry gate into the app.
   - The auth flow is isolated in the `app/auth/` routes, keeping unauthenticated screens separate from the tabbed app.
   - `store/authStore.ts` likely holds the session/user state and acts as the gatekeeper for route decisions.

5. **State management**
   - State is centralized with **Zustand** stores in `store/`.
   - `authStore.ts` manages identity/session-related state.
   - `expenseStore.ts` likely manages household expense data, monthly views, and mutation flows.
   - This creates a clean split: screens render UI, stores hold mutable app state, and Supabase handles persistence/auth.

6. **Backend and external service boundary**
   - `utils/supabase.ts` is the shared integration point for backend access.
   - Supabase is the main backend boundary, covering both **PostgreSQL data** and **OTP authentication**.
   - The README indicates phone OTP via SMS and RLS-based protection; architecturally, that means data access is expected to be server-enforced rather than trusted from the client.

7. **Domain model and static configuration**
   - `types/index.ts` defines the shared TypeScript domain shapes used across screens and stores.
   - `constants/categories.ts` contains the fixed expense categories used by the MVP.
   - `constants/theme.ts` provides shared visual tokens.
   - These files act as the app’s **domain vocabulary**, keeping UI and store logic aligned.

8. **Shared UI layer**
   - `components/` contains reusable presentation building blocks:
     - themed text/view primitives,
     - tab haptics,
     - parallax/scroll helpers,
     - a collapsible UI piece,
     - icon symbol wrappers,
     - small decorative helpers like `hello-wave`.
   - This suggests the app uses a **composed design system** rather than duplicating screen-specific UI.

9. **Theming and platform adaptation**
   - `hooks/use-color-scheme*` and `hooks/use-theme-color.ts` provide theme-aware styling helpers.
   - `components/themed-text.tsx` and `components/themed-view.tsx` indicate the app standardizes color/style access through reusable primitives.
   - Even though the README emphasizes a light, calm visual style, the code still has a small theming abstraction to keep UI consistent across platform settings.

10. **Assets and brand surface**
   - `assets/images/` contains the app logo and image assets used in the product.
   - The branding is part of the architecture because the app is intentionally designed for trust and familiarity, especially for family/parent users.
   - The visual identity is lightweight and embedded into the client, not managed by a separate design system service.

11. **Tooling and project plumbing**
   - `app.json`, `tsconfig.json`, `eslint.config.js`, and `.vscode/` support the Expo/TypeScript development workflow.
   - `scripts/reset-project.js` is a scaffolding/reset utility, not part of runtime behavior.
   - These pieces support maintainability but do not change the runtime architecture.

12. **End-to-end data flow**
   - A user enters the app through OTP login.
   - Auth state is stored in `authStore`, then the router transitions into the tabbed app shell.
   - Expense and family-related screens read/write through Zustand stores, which in turn use the Supabase client for backend persistence.
   - Shared types/constants keep the same expense categories, data shapes, and UI behavior consistent across all screens.

13. **Important architectural boundary to note**
   - There is **no separate backend code in this repo**; the app is a frontend client with backend responsibilities delegated to Supabase.
   - Similarly, there is no visible standalone `services/` layer in the tree, so most integration appears concentrated in `utils/` and the stores.
   - For a diagram, the clearest split is:
     - **Presentation:** `app/`, `components/`
     - **State/domain:** `store/`, `types/`, `constants/`
     - **Integration:** `utils/supabase.ts`
     - **Platform/tooling:** config files, assets, scripts

Main entry points: [`app/(tabs)/_layout.tsx`](https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/_layout.tsx) (Tab shell), [`store/expenseStore.ts`](https://github.com/blitzbugg/entepocket/blob/master/store/expenseStore.ts) (Expense store), [`app/_layout.tsx`](https://github.com/blitzbugg/entepocket/blob/master/app/_layout.tsx) (App shell), [`store/authStore.ts`](https://github.com/blitzbugg/entepocket/blob/master/store/authStore.ts) (Auth store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Presentation"]
  node_app_layout["App shell<br/>router root<br/>[_layout.tsx]"]
  node_tabs_layout["Tab shell<br/>router layout<br/>[_layout.tsx]"]
  node_auth_login["Login<br/>otp screen<br/>[login.tsx]"]
  node_auth_verify["Verify<br/>otp screen<br/>[verify.tsx]"]
  node_modal_route["Modal<br/>overlay route<br/>[modal.tsx]"]
  node_home_screen["Home<br/>dashboard screen<br/>[home.tsx]"]
  node_index_screen["Index<br/>entry screen<br/>[index.tsx]"]
  node_bills_screen["Bills<br/>recurring screen<br/>[bills.tsx]"]
  node_family_screen["Family<br/>collaboration screen<br/>[family.tsx]"]
  node_history_screen["History<br/>activity screen<br/>[history.tsx]"]
  node_profile_screen["Profile<br/>account screen<br/>[profile.tsx]"]
  node_ui_components["UI kit<br/>shared components"]
end

subgraph group_state["State & Domain"]
  node_auth_store["Auth store<br/>zustand store<br/>[authStore.ts]"]
  node_expense_store["Expense store<br/>zustand store<br/>[expenseStore.ts]"]
  node_types_domain["Types<br/>domain model<br/>[index.ts]"]
  node_categories["Categories<br/>domain config<br/>[categories.ts]"]
  node_theme_tokens["Theme tokens<br/>ui config<br/>[theme.ts]"]
end

subgraph group_integration["Integration"]
  node_supabase_client[("Supabase<br/>backend client<br/>[supabase.ts]")]
  node_color_scheme["Color scheme<br/>theme hook"]
end

subgraph group_tooling["Platform & Tooling"]
  node_assets_images["Brand assets<br/>static assets"]
  node_project_config["Project config<br/>tooling<br/>[app.json]"]
end

node_app_layout -->|"gates by session"| node_auth_store
node_app_layout -->|"hosts"| node_tabs_layout
node_app_layout -->|"routes to"| node_auth_login
node_app_layout -->|"overlays"| node_modal_route
node_tabs_layout -->|"contains"| node_home_screen
node_tabs_layout -->|"contains"| node_index_screen
node_tabs_layout -->|"contains"| node_bills_screen
node_tabs_layout -->|"contains"| node_family_screen
node_tabs_layout -->|"contains"| node_history_screen
node_tabs_layout -->|"contains"| node_profile_screen
node_auth_login -->|"writes session"| node_auth_store
node_auth_verify -->|"completes auth"| node_auth_store
node_auth_login -->|"requests OTP"| node_supabase_client
node_auth_verify -->|"verifies OTP"| node_supabase_client
node_home_screen -->|"reads state"| node_expense_store
node_bills_screen -->|"reads state"| node_expense_store
node_family_screen -->|"mutates data"| node_expense_store
node_history_screen -->|"reads state"| node_expense_store
node_profile_screen -->|"reads identity"| node_auth_store
node_expense_store -->|"persists"| node_supabase_client
node_auth_store -->|"authenticates"| node_supabase_client
node_expense_store -->|"uses shapes"| node_types_domain
node_expense_store -->|"uses categories"| node_categories
node_home_screen -->|"composes"| node_ui_components
node_bills_screen -->|"composes"| node_ui_components
node_family_screen -->|"composes"| node_ui_components
node_history_screen -->|"composes"| node_ui_components
node_ui_components -->|"uses tokens"| node_theme_tokens
node_ui_components -->|"adapts to"| node_color_scheme
node_app_layout -->|"loads brand"| node_assets_images
node_project_config -.->|"supports"| node_app_layout

click node_app_layout "https://github.com/blitzbugg/entepocket/blob/master/app/_layout.tsx"
click node_tabs_layout "https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/_layout.tsx"
click node_auth_login "https://github.com/blitzbugg/entepocket/blob/master/app/auth/login.tsx"
click node_auth_verify "https://github.com/blitzbugg/entepocket/blob/master/app/auth/verify.tsx"
click node_modal_route "https://github.com/blitzbugg/entepocket/blob/master/app/modal.tsx"
click node_home_screen "https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/home.tsx"
click node_index_screen "https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/index.tsx"
click node_bills_screen "https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/bills.tsx"
click node_family_screen "https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/family.tsx"
click node_history_screen "https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/history.tsx"
click node_profile_screen "https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/profile.tsx"
click node_auth_store "https://github.com/blitzbugg/entepocket/blob/master/store/authStore.ts"
click node_expense_store "https://github.com/blitzbugg/entepocket/blob/master/store/expenseStore.ts"
click node_types_domain "https://github.com/blitzbugg/entepocket/blob/master/types/index.ts"
click node_categories "https://github.com/blitzbugg/entepocket/blob/master/constants/categories.ts"
click node_theme_tokens "https://github.com/blitzbugg/entepocket/blob/master/constants/theme.ts"
click node_supabase_client "https://github.com/blitzbugg/entepocket/blob/master/utils/supabase.ts"
click node_color_scheme "https://github.com/blitzbugg/entepocket/blob/master/hooks/use-color-scheme.ts"
click node_assets_images "https://github.com/blitzbugg/entepocket/tree/master/assets/images"
click node_project_config "https://github.com/blitzbugg/entepocket/blob/master/app.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_layout,node_tabs_layout,node_auth_login,node_auth_verify,node_modal_route,node_home_screen,node_index_screen,node_bills_screen,node_family_screen,node_history_screen,node_profile_screen,node_ui_components toneBlue
class node_auth_store,node_expense_store,node_types_domain,node_categories,node_theme_tokens toneAmber
class node_supabase_client,node_color_scheme toneMint
class node_assets_images,node_project_config toneRose
```

## Components

### Presentation

Expo Router screens and reusable UI components

- [App shell](https://github.com/blitzbugg/entepocket/blob/master/app/_layout.tsx): router root · Root Expo Router composition and app-wide gating · `app/_layout.tsx`
- [Tab shell](https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/_layout.tsx): router layout · Main authenticated tab navigator · `app/(tabs)/_layout.tsx`
- [Login](https://github.com/blitzbugg/entepocket/blob/master/app/auth/login.tsx): otp screen · Phone-based sign-in entry screen · `app/auth/login.tsx`
- [Verify](https://github.com/blitzbugg/entepocket/blob/master/app/auth/verify.tsx): otp screen · OTP confirmation and session completion · `app/auth/verify.tsx`
- [Modal](https://github.com/blitzbugg/entepocket/blob/master/app/modal.tsx): overlay route · Standalone modal route outside tabs · `app/modal.tsx`
- [Home](https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/home.tsx): dashboard screen · Primary landing and summary surface · `app/(tabs)/home.tsx`
- [Index](https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/index.tsx): entry screen · Tab entry or redirect landing page · `app/(tabs)/index.tsx`
- [Bills](https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/bills.tsx): recurring screen · Recurring bill tracking and management · `app/(tabs)/bills.tsx`
- [Family](https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/family.tsx): collaboration screen · Household and shared expense coordination · `app/(tabs)/family.tsx`
- [History](https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/history.tsx): activity screen · Past expenses and activity timeline · `app/(tabs)/history.tsx`
- [Profile](https://github.com/blitzbugg/entepocket/blob/master/app/(tabs)/profile.tsx): account screen · User settings and account surface · `app/(tabs)/profile.tsx`
- **UI kit**: shared components · Reusable themed and decorative presentation components

### State & Domain

Zustand stores, shared types, and app constants

- [Auth store](https://github.com/blitzbugg/entepocket/blob/master/store/authStore.ts): zustand store · Session and identity gatekeeper · `store/authStore.ts`
- [Expense store](https://github.com/blitzbugg/entepocket/blob/master/store/expenseStore.ts): zustand store · Household expense and monthly app state · `store/expenseStore.ts`
- [Types](https://github.com/blitzbugg/entepocket/blob/master/types/index.ts): domain model · Shared TypeScript shapes across the app · `types/index.ts`
- [Categories](https://github.com/blitzbugg/entepocket/blob/master/constants/categories.ts): domain config · Fixed expense category vocabulary · `constants/categories.ts`
- [Theme tokens](https://github.com/blitzbugg/entepocket/blob/master/constants/theme.ts): ui config · Shared visual constants and color tokens · `constants/theme.ts`

### Integration

Backend access and platform hooks

- [Supabase](https://github.com/blitzbugg/entepocket/blob/master/utils/supabase.ts): backend client · Shared client for auth and persistence · `utils/supabase.ts`
- [Color scheme](https://github.com/blitzbugg/entepocket/blob/master/hooks/use-color-scheme.ts): theme hook · Platform color-scheme adaptation hooks · `hooks/use-color-scheme.ts`

### Platform & Tooling

Assets and project configuration

- [Brand assets](https://github.com/blitzbugg/entepocket/tree/master/assets/images): static assets · Logo and bundled image assets · `assets/images`
- [Project config](https://github.com/blitzbugg/entepocket/blob/master/app.json): tooling · Expo, TypeScript, linting, and editor support files · `app.json`

## Connections

- App shell → Auth store: gates by session · Root shell decides whether to show auth or app
- App shell → Tab shell: hosts · Mounts the authenticated tab experience
- App shell → Login: routes to · Sends unauthenticated users into OTP login
- App shell → Modal: overlays · Provides a separate modal entry point
- Tab shell → Home: contains · Defines the main tabbed app surfaces
- Tab shell → Index: contains · Defines the main tabbed app surfaces
- Tab shell → Bills: contains · Defines the main tabbed app surfaces
- Tab shell → Family: contains · Defines the main tabbed app surfaces
- Tab shell → History: contains · Defines the main tabbed app surfaces
- Tab shell → Profile: contains · Defines the main tabbed app surfaces
- Login → Auth store: writes session · Login flow updates identity state
- Verify → Auth store: completes auth · OTP verification finalizes the session
- Login → Supabase: requests OTP · Starts phone-based sign-in via backend
- Verify → Supabase: verifies OTP · Confirms code and establishes auth session
- Home → Expense store: reads state · Dashboard consumes shared expense state
- Bills → Expense store: reads state · Recurring bill UI depends on store data
- Family → Expense store: mutates data · Collaboration screen updates shared household state
- History → Expense store: reads state · History view renders store-backed activity
- Profile → Auth store: reads identity · Account screen depends on the current user session
- Expense store → Supabase: persists · Store synchronizes data through Supabase
- Auth store → Supabase: authenticates · Session state is backed by Supabase auth
- Expense store → Types: uses shapes · Store state and mutations follow shared domain types
- Expense store → Categories: uses categories · Store logic and screens rely on fixed category sets
- Home → UI kit: composes · Screens reuse shared presentation building blocks
- Bills → UI kit: composes · Screens reuse shared presentation building blocks
- Family → UI kit: composes · Screens reuse shared presentation building blocks
- History → UI kit: composes · Screens reuse shared presentation building blocks
- UI kit → Theme tokens: uses tokens · Shared UI primitives pull from central theme values
- UI kit → Color scheme: adapts to · UI primitives vary by platform color scheme
- App shell → Brand assets: loads brand · App shell and screens use bundled visual assets
- Project config → App shell: supports · Tooling underpins the Expo app runtime and build
