# shahvir-w/locked-in architecture

> Architecture diagram of the GitHub repository shahvir-w/locked-in, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shahvir-w/locked-in
- Repository: https://github.com/shahvir-w/locked-in

## Overview

##### Project Type & Purpose
- The project is a mobile application built using React Native with Expo.
- Its primary purpose is to help users track daily tasks and measure their “Locked In” consistency score by duplicating and managing daily task lists and displaying progress (with options for both light and dark themes).
- The README and file tree emphasize different tabs (habits, info, stats), user authentication (sign-in/sign-up), and integration with Firebase (in configs/FirebaseConfig.js).

##### File Structure
- Top level directories/files:
- app: Contains main application components, pages (layouts, tabs, auth pages, and screens for tasks and score calculations).
- components: Comprises common UI components (e.g., BarChart, Habit, TabBar, etc.) that are reused across screens.
- assets: Holds fonts and images used in the user interface.
- configs: Contains Firebase configuration for backend integration.
- databaseUtils: Includes helper scripts for interacting with databases (e.g., creating days, finding recent dates).
- The directory structure suggests component-based modular design. Notable is the use of subdirectories under “app” for tabs and authentication flows, indicating a navigational structure likely handled via React Navigation.

a. Mobile Client Core:
- Screens & Pages:
- Main App structure under "app" with separate screens for authentication, tasks, habits, and statistics.
- Tab navigation is evident (tabs, _layout.jsx files), which organizes the app into multiple sections.
- Components:
- UI components from the “components” directory (e.g., charts, list views, habit components, tab bar elements).
- These components are integrated within screens to render visual elements and handle user interactions.

b. Authentication Module:
- The app contains a dedicated “auth” folder with “sign-in” and “sign-up” pages.
- This module is responsible for user session management and likely interacts with Firebase (via configurations and databaseUtils).

c. Data & Business Logic:
- Database Utilities:
- Located in “databaseUtils”, these functions manage data operations (e.g., creating days, querying recent dates).
- They likely interact with Firebase, as indicated by configs/FirebaseConfig.js and FirebaseUtils.js.
- Scoring / Habit Calculation:
- Files like “scoreCalculationExp.jsx” show that task completion and scoring logic are important and encapsulated within dedicated scripts.

d. External Services & Configurations:
- Firebase Service:
- The “configs/FirebaseConfig.js” file sets up Firebase for database operations, authentication, and possibly analytics.
- Expo Environment:
- Related files such as “app.json”, “eas.json”, and the Expo CLI setup indicate that the app is built and deployed via Expo.

##### Architectural Patterns & Design Principles
- Component-Based Architecture:
- The separation of concerns is evident through distinct directories: views/screens (app), reusable components, and utility functions.
- Modular Organization:
- Separation between UI components, data handling, and configuration promotes maintainability.
- Navigation & Layout:
- The use of “_layout.jsx” files in multiple directories highlights a common pattern for consistent layout and navigation across different sections.
- The focus on mobile UX, routing (tabs and auth flows), and dependency management ensures the design remains scalable.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Frontend Layer"
        MC["Mobile Client Core (React Native App)"]
        Auth["Authentication Module"]
    end

    subgraph "UI Components Layer"
        UI["UI Components"]
        Const["Theming & Constants"]
    end

    subgraph "Data & Business Logic Layer"
        Score["Score Calculation"]
        DBUtils["Database Utilities"]
    end

    subgraph "External Services"
        Firebase["Firebase Service"]
    end

    MC -->|"usesUI"| UI
    UI -->|"styled_by"| Const
    MC -->|"to_auth"| Auth
    MC -->|"calculates"| Score
    Score -->|"queries"| DBUtils
    DBUtils -->|"persists_to"| Firebase
    Auth -->|"auth_with"| Firebase

    class MC,Auth frontend
    class UI,Const uicomponents
    class Score,DBUtils logic
    class Firebase external

    classDef frontend fill:#FAD7A0,stroke:#C0392B,stroke-width:2px
    classDef uicomponents fill:#BBF7D0,stroke:#059669,stroke-width:2px
    classDef logic fill:#E0BBE4,stroke:#9B59B6,stroke-width:2px
    classDef external fill:#AED6F1,stroke:#2471A3,stroke-width:2px

    click MC "https://github.com/shahvir-w/locked-in/tree/master/app/"
    click Auth "https://github.com/shahvir-w/locked-in/tree/master/app/auth/"
    click UI "https://github.com/shahvir-w/locked-in/tree/master/components/"
    click Const "https://github.com/shahvir-w/locked-in/tree/master/constants/"
    click Score "https://github.com/shahvir-w/locked-in/blob/master/app/scoreCalculationExp.jsx"
    click DBUtils "https://github.com/shahvir-w/locked-in/tree/master/databaseUtils/"
    click Firebase "https://github.com/shahvir-w/locked-in/blob/master/configs/FirebaseConfig.js"
```
