# shimulraj0/peptide architecture

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

- Interactive diagram: https://gitdiagram.com/shimulraj0/peptide
- Repository: https://github.com/shimulraj0/peptide

## Overview

1. **Overall shape**
   - This is a **Flutter cross-platform client** with targets for Android, iOS, web, macOS, Windows, and Linux.
   - The repository is mostly a **presentation-layer app**: there is no obvious backend service, database layer, or API client code in the tree.

2. **App entry and shell**
   - The main application entry is `lib/main.dart`.
   - It likely bootstraps the Flutter app, registers shared state/providers, applies theme, and decides the initial screen flow.
   - Platform-specific launch code is standard Flutter scaffolding in the `android/`, `ios/`, `macos/`, `windows/`, and `linux/` directories.

3. **Feature decomposition**
   - The app is organized by feature under `lib/presentation/`:
     - `splash/` for startup branding/loading
     - `onboarding/` for first-run education
     - `auth/` for login, register, verification, and profile setup
     - `home/` for the main product experience
   - This is a screen-centric architecture, with each feature owning its own UI, view widgets, and local state providers.

4. **Authentication flow**
   - `lib/presentation/auth/` contains the user access path:
     - `login_screen.dart`
     - `register_screen.dart`
     - `verification_screen.dart`
     - `profile_setup_screen.dart`
   - State is split into `auth_provider.dart` and `profile_provider.dart`, indicating the auth flow is managed through provider-based state rather than a separate service layer in the repo.

5. **Main product flow**
   - `lib/presentation/home/` contains the primary app functionality:
     - `home_screen.dart`
     - `add_peptide_screen.dart`
     - `peptide_details_screen.dart`
     - `peptide_library_screen.dart`
     - `log_entry_screen.dart`
   - This suggests the app is centered on **peptide management**, with flows for browsing a library, adding entries, viewing details, and recording logs.

6. **State and navigation**
   - `lib/presentation/home/providers/` contains:
     - `navigation_provider.dart`
     - `protocol_provider.dart`
   - The architecture appears to use providers for both **navigation state** and **domain/process state** around “protocols,” which likely drive the home experience and screen switching.
   - The UI is therefore probably composed of a shell screen plus nested views controlled by provider state.

7. **Reusable views and widgets**
   - `lib/presentation/home/views/` holds secondary panels and settings-style screens such as:
     - inventory, log history, notification settings, personal details, privacy policy, security, terms of service, leave review, and log confirmation
   - `lib/presentation/home/widgets/` contains reusable UI building blocks like the custom bottom nav, dashboard widgets, library widgets, log widgets, and protocol card.
   - This indicates a mixed composition model: screens assemble reusable widgets and smaller feature views.

8. **Domain model**
   - `lib/data/models/peptide_model.dart` is the only explicit model in the tree.
   - That suggests the app’s core domain object is a peptide record, which is likely passed from screen to screen and rendered in library/detail/log views.
   - There is no visible repository/service layer, so model handling is likely lightweight and UI-driven in this codebase.

9. **Shared design system**
   - `lib/core/theme/` contains `app_colors.dart` and `app_text_styles.dart`.
   - This implies a centralized styling layer used across all features for consistent color and typography.
   - `lib/utils/page_transitions.dart` suggests custom navigation animation behavior is part of the shared UI infrastructure.

10. **Splash, onboarding, and visual polish**
   - The splash feature includes `dna_helix_painter.dart`, indicating custom painting for a branded loading/intro screen.
   - Onboarding and splash exist as distinct phases before auth/home, which makes the app flow more like a guided product experience than a simple CRUD app.

11. **Assets and platform packaging**
   - `assets/` is present, but its contents are not listed here, so asset usage is likely for images/icons/media consumed by the Flutter UI.
   - The platform directories contain the usual Flutter runners and manifest/plist/configuration files; they do not appear to introduce custom native architecture beyond standard app launch and embedding.

12. **Testing and quality**
   - There is a minimal widget test in `test/widget_test.dart` and native template tests for some platforms.
   - `analysis_options.yaml` and `pubspec.lock` indicate standard Flutter/Dart tooling and dependency management.
   - Overall, the repo looks like an early-stage but well-structured Flutter app with provider-based state, feature-based screen grouping, and a peptide-centric user flow.

Main entry points: [`lib/presentation/home/home_screen.dart`](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/home_screen.dart) (Home shell), [`lib/presentation/auth/providers/auth_provider.dart`](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/providers/auth_provider.dart) (Auth state), [`lib/data/models/peptide_model.dart`](https://github.com/shimulraj0/peptide/blob/main/lib/data/models/peptide_model.dart) (Peptide model), [`lib/presentation/auth/login_screen.dart`](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/login_screen.dart) (Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g_platform["Platform shells"]
  node_platform_runners["Platform runners<br/>native launchers"]
end

subgraph group_g_shared["Shared core"]
  node_main["App entry<br/>flutter entry<br/>[main.dart]"]
  node_peptide_model[("Peptide model<br/>data model<br/>[peptide_model.dart]")]
  node_theme_core["Theme core<br/>design system"]
  node_page_transitions(("Transitions<br/>navigation util"))
end

subgraph group_g_auth["Auth flow"]
  node_auth_login["Login<br/>auth screen<br/>[login_screen.dart]"]
  node_auth_register["Register<br/>auth screen"]
  node_auth_verify["Verify<br/>auth screen"]
  node_profile_setup["Profile setup<br/>setup screen"]
  node_auth_provider[("Auth state<br/>provider<br/>[auth_provider.dart]")]
  node_profile_provider[("Profile state<br/>provider")]
end

subgraph group_g_home["Home product"]
  node_home_screen["Home shell<br/>app shell<br/>[home_screen.dart]"]
  node_navigation_provider[("Nav state<br/>provider")]
  node_protocol_provider[("Protocol state<br/>provider")]
  node_peptide_library["Library"]
  node_add_peptide["Add peptide<br/>create screen"]
  node_peptide_details["Peptide details<br/>detail screen"]
  node_log_entry["Log entry<br/>logging screen"]
  node_home_views["Secondary views<br/>settings/views"]
  node_home_widgets["UI widgets<br/>ui components"]
end

subgraph group_g_startup["Startup flow"]
  node_splash_screen["Splash<br/>startup screen<br/>[splash_screen.dart]"]
  node_dna_painter(("DNA art<br/>custom painter"))
  node_onboarding_screen["Onboarding<br/>intro screen"]
end

node_main -->|"starts"| node_splash_screen
node_main -->|"routes"| node_home_screen
node_splash_screen -->|"renders"| node_dna_painter
node_splash_screen -->|"continues to"| node_onboarding_screen
node_onboarding_screen -->|"gates"| node_auth_login
node_auth_login -->|"uses"| node_auth_provider
node_auth_register -->|"uses"| node_auth_provider
node_auth_verify -->|"uses"| node_auth_provider
node_profile_setup -->|"uses"| node_profile_provider
node_auth_register -->|"advances to"| node_profile_setup
node_auth_provider -->|"hands off"| node_profile_provider
node_profile_setup -->|"enters"| node_home_screen
node_home_screen -->|"controls"| node_navigation_provider
node_home_screen -->|"drives"| node_protocol_provider
node_home_screen -->|"opens"| node_peptide_library
node_home_screen -->|"opens"| node_add_peptide
node_home_screen -->|"opens"| node_peptide_details
node_home_screen -->|"opens"| node_log_entry
node_home_screen -->|"composes"| node_home_views
node_home_screen -->|"composes"| node_home_widgets
node_peptide_library -->|"reads"| node_peptide_model
node_peptide_details -->|"reads"| node_peptide_model
node_add_peptide -->|"creates"| node_peptide_model
node_log_entry -->|"references"| node_peptide_model
node_home_widgets -->|"styles with"| node_theme_core
node_auth_login -->|"styles with"| node_theme_core
node_home_screen -->|"styles with"| node_theme_core
node_home_screen -->|"animates with"| node_page_transitions
node_platform_runners -->|"launches"| node_main

click node_main "https://github.com/shimulraj0/peptide/blob/main/lib/main.dart"
click node_splash_screen "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/splash/splash_screen.dart"
click node_dna_painter "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/splash/widgets/dna_helix_painter.dart"
click node_onboarding_screen "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/onboarding/onboarding_screen.dart"
click node_auth_login "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/login_screen.dart"
click node_auth_register "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/register_screen.dart"
click node_auth_verify "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/verification_screen.dart"
click node_profile_setup "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/profile_setup_screen.dart"
click node_auth_provider "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/providers/auth_provider.dart"
click node_profile_provider "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/providers/profile_provider.dart"
click node_home_screen "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/home_screen.dart"
click node_navigation_provider "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/providers/navigation_provider.dart"
click node_protocol_provider "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/providers/protocol_provider.dart"
click node_peptide_library "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/peptide_library_screen.dart"
click node_add_peptide "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/add_peptide_screen.dart"
click node_peptide_details "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/peptide_details_screen.dart"
click node_log_entry "https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/log_entry_screen.dart"
click node_home_views "https://github.com/shimulraj0/peptide/tree/main/lib/presentation/home/views"
click node_home_widgets "https://github.com/shimulraj0/peptide/tree/main/lib/presentation/home/widgets"
click node_peptide_model "https://github.com/shimulraj0/peptide/blob/main/lib/data/models/peptide_model.dart"
click node_theme_core "https://github.com/shimulraj0/peptide/tree/main/lib/core/theme"
click node_page_transitions "https://github.com/shimulraj0/peptide/blob/main/lib/utils/page_transitions.dart"

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_platform_runners toneBlue
class node_main,node_peptide_model,node_theme_core,node_page_transitions toneAmber
class node_auth_login,node_auth_register,node_auth_verify,node_profile_setup,node_auth_provider,node_profile_provider toneMint
class node_home_screen,node_navigation_provider,node_protocol_provider,node_peptide_library,node_add_peptide,node_peptide_details,node_log_entry,node_home_views,node_home_widgets toneRose
class node_splash_screen,node_dna_painter,node_onboarding_screen toneIndigo
```

## Components

### Platform shells

Flutter launchers and native runner scaffolding for each supported target.

- **Platform runners**: native launchers · Standard Android, iOS, macOS, Windows, Linux, and web runner scaffolding.

### Shared core

Theme, transitions, and domain model shared across the app.

- [App entry](https://github.com/shimulraj0/peptide/blob/main/lib/main.dart): flutter entry · Bootstraps the application and initial route flow. · `lib/main.dart`
- [Peptide model](https://github.com/shimulraj0/peptide/blob/main/lib/data/models/peptide_model.dart): data model · Core domain object used across library and detail flows. · `lib/data/models/peptide_model.dart`
- [Theme core](https://github.com/shimulraj0/peptide/tree/main/lib/core/theme): design system · Central colors and text styles for the app. · `lib/core/theme`
- [Transitions](https://github.com/shimulraj0/peptide/blob/main/lib/utils/page_transitions.dart): navigation util · Shared page transition behavior. · `lib/utils/page_transitions.dart`

### Auth flow

Login and profile setup screens plus their local state providers.

- [Login](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/login_screen.dart): auth screen · Entry point for returning users. · `lib/presentation/auth/login_screen.dart`
- [Register](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/register_screen.dart): auth screen · User account creation flow. · `lib/presentation/auth/register_screen.dart`
- [Verify](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/verification_screen.dart): auth screen · Verification step in the access flow. · `lib/presentation/auth/verification_screen.dart`
- [Profile setup](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/profile_setup_screen.dart): setup screen · Collects profile details after registration. · `lib/presentation/auth/profile_setup_screen.dart`
- [Auth state](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/providers/auth_provider.dart): provider · Holds login and registration state. · `lib/presentation/auth/providers/auth_provider.dart`
- [Profile state](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/auth/providers/profile_provider.dart): provider · Manages profile setup state. · `lib/presentation/auth/providers/profile_provider.dart`

### Home product

Primary peptide-centered experience, related views, and reusable widgets.

- [Home shell](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/home_screen.dart): app shell · Main navigation shell for the peptide experience. · `lib/presentation/home/home_screen.dart`
- [Nav state](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/providers/navigation_provider.dart): provider · Controls in-app navigation and tab state. · `lib/presentation/home/providers/navigation_provider.dart`
- [Protocol state](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/providers/protocol_provider.dart): provider · Holds domain/process state for home workflows. · `lib/presentation/home/providers/protocol_provider.dart`
- [Library](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/peptide_library_screen.dart): library screen · Browses peptide records and collections. · `lib/presentation/home/peptide_library_screen.dart`
- [Add peptide](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/add_peptide_screen.dart): create screen · Creates new peptide entries. · `lib/presentation/home/add_peptide_screen.dart`
- [Peptide details](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/peptide_details_screen.dart): detail screen · Shows a single peptide record in detail. · `lib/presentation/home/peptide_details_screen.dart`
- [Log entry](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/home/log_entry_screen.dart): logging screen · Records usage or protocol log data. · `lib/presentation/home/log_entry_screen.dart`
- [Secondary views](https://github.com/shimulraj0/peptide/tree/main/lib/presentation/home/views): settings/views · Inventory, history, settings, policy, and confirmation subviews. · `lib/presentation/home/views`
- [UI widgets](https://github.com/shimulraj0/peptide/tree/main/lib/presentation/home/widgets): ui components · Reusable navigation, dashboard, library, log, and protocol widgets. · `lib/presentation/home/widgets`

### Startup flow

Splash and onboarding screens that gate the main app experience.

- [Splash](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/splash/splash_screen.dart): startup screen · Branded loading screen with custom painting. · `lib/presentation/splash/splash_screen.dart`
- [DNA art](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/splash/widgets/dna_helix_painter.dart): custom painter · Draws the DNA helix visual used by splash. · `lib/presentation/splash/widgets/dna_helix_painter.dart`
- [Onboarding](https://github.com/shimulraj0/peptide/blob/main/lib/presentation/onboarding/onboarding_screen.dart): intro screen · First-run education and guided product entry. · `lib/presentation/onboarding/onboarding_screen.dart`

## Connections

- App entry → Splash: starts · App bootstraps into the splash flow.
- App entry → Home shell: routes · Initial routing eventually lands in the main shell.
- Splash → DNA art: renders · Splash screen uses custom painted branding art.
- Splash → Onboarding: continues to · Startup flow progresses into onboarding.
- Onboarding → Login: gates · Onboarding leads into authentication.
- Login → Auth state: uses · Login screen reads and updates auth state.
- Register → Auth state: uses · Registration screen reads and updates auth state.
- Verify → Auth state: uses · Verification screen uses auth state.
- Profile setup → Profile state: uses · Profile setup screen uses profile state.
- Register → Profile setup: advances to · Registration can lead into profile setup.
- Auth state → Profile state: hands off · Auth completion flows into profile completion.
- Profile setup → Home shell: enters · Successful setup leads into the home shell.
- Home shell → Nav state: controls · Home shell is driven by navigation state.
- Home shell → Protocol state: drives · Home shell coordinates protocol/domain state.
- Home shell → Library: opens · Home shell exposes the peptide library.
- Home shell → Add peptide: opens · Home shell launches peptide creation.
- Home shell → Peptide details: opens · Home shell routes to detail views.
- Home shell → Log entry: opens · Home shell launches logging flows.
- Home shell → Secondary views: composes · Secondary screens are part of the main experience.
- Home shell → UI widgets: composes · Shell assembles reusable UI widgets.
- Library → Peptide model: reads · Library renders peptide records.
- Peptide details → Peptide model: reads · Detail view displays the peptide model.
- Add peptide → Peptide model: creates · Add flow produces peptide records.
- Log entry → Peptide model: references · Log flow ties entries back to peptides.
- UI widgets → Theme core: styles with · Reusable UI follows shared design tokens.
- Login → Theme core: styles with · Auth screens share the app theme.
- Home shell → Theme core: styles with · Main shell uses shared theme definitions.
- Home shell → Transitions: animates with · Navigation uses custom page transitions.
- Platform runners → App entry: launches · Native shells start the Flutter entrypoint.
