# dilansalas/smilenotes architecture

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

- Interactive diagram: https://gitdiagram.com/dilansalas/smilenotes
- Repository: https://github.com/dilansalas/smilenotes

## Overview

##### Project type and purpose
- This is a Single-Page Application (SPA) built with React and Vite.
- Its purpose is a journaling app with authentication, notes storage, and image uploads, all backed by Firebase services.

##### File structure
- Top-level config: .gitignore, Dockerfile, vite.config.js, package.json, README.md, index.html.
- src/ is organized by feature:
- auth/ (layout, pages, routes)
- home/ (marketing landing pages, components, routes)
- journal/ (authenticated journal UI, components, layout, routes, views)
- firebase/ (config.js, provider.js)
- store/ (Redux Toolkit slices and thunks under auth/ and journal/)
- router/ (AppRouter.jsx orchestrating all route groups)
- hooks/, helpers/, theme/, ui/, styles.css
- The presence of Redux slices & thunks, Firebase config, React Router route modules and Vite/Eslint config points to an SPA front-end only project that uses Firebase as a BaaS.

##### README for insights
- Confirms a minimal React + Vite setup with Fast Refresh plugins.
- No custom backend—Firebase SDK is the sole “backend.”

##### Main components
a. Client (Browser) running the React/Vite App
b. Static Asset Host or Vite Dev Server (serving index.html, bundle.js, CSS)
c. React Application subdivided into:
- Routing Layer (AppRouter → HomeRoutes, AuthRoutes, JournalRoutes)
- UI & Layout Layer (components, pages, layouts under src/home, src/auth, src/journal)
- State Management (Redux store with authSlice & journalSlice + thunks)
- Theme & Context Providers (ThemeProviderWrapper, FirebaseProvider)
- Authentication (signup/login flows)
- Firestore Database (store and load notes via loadNotes thunk)
- Storage Bucket (fileUpload helper for images)

##### Relationships and data flows
- User → Browser/UI components → dispatch Redux thunks
- Thunks → Firebase SDK calls → Auth or Firestore or Storage → return Promises → update Redux store
- Redux store → UI components (via useSelector / custom hooks like useCheckAuth) → re-render
- Routing guards (CheckingAuth component) ensure private routes under /journal

##### Architectural patterns and design principles
- Single-Page Application with client-side routing (React Router v6)
- Feature-first folder structure (auth, home, journal modules)
- FLUX pattern using Redux Toolkit (slices + thunks)
- Encapsulation of side effects in thunks and helpers (loadNotes, fileUpload)
- Composition via React layouts and context providers

##### Technologies, frameworks, libraries
- React 18 + Vite
- React Router for routing
- Redux Toolkit for state management
- Firebase SDK (Auth, Firestore, Storage)
- Custom Hooks (useForm, useCheckAuth)
- ESLint + optional SWC/Babel Fast Refresh plugin

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef frontend fill:#cfe2f3,stroke:#0b5394,color:#0b5394
    classDef state fill:#d9ead3,stroke:#38761d,color:#38761d
    classDef external fill:#fce5cd,stroke:#b45f06,color:#b45f06

    Browser["User Browser"]:::external
    subgraph "Static Host / Dev Server"
        IndexHTML["index.html"]:::frontend
        ViteConfig["vite.config.js"]:::frontend
    end
    click IndexHTML "https://github.com/dilansalas/smilenotes/blob/main/index.html"
    click ViteConfig "https://github.com/dilansalas/smilenotes/blob/main/vite.config.js"

    Browser --> IndexHTML
    IndexHTML --> MainEntry["src/main.jsx"]:::frontend
    click MainEntry "https://github.com/dilansalas/smilenotes/blob/main/src/main.jsx"
    MainEntry --> JournalApp["src/JournalApp.jsx"]:::frontend
    click JournalApp "https://github.com/dilansalas/smilenotes/blob/main/src/JournalApp.jsx"

    subgraph "React Application"
        subgraph "Providers"
            ThemeProv["ThemeProviderWrapper"]:::frontend
            FirebaseProv["FirebaseProvider"]:::frontend
            ThemeProv --> FirebaseProv
        end
        FirebaseProv --> Router["AppRouter"]:::frontend
        click Router "https://github.com/dilansalas/smilenotes/blob/main/src/router/AppRouter.jsx"
    end

    subgraph "Routing Layer"
        AR["AppRouter.jsx"]:::frontend
        HR["HomeRoutes.jsx"]:::frontend
        AuR["AuthRoutes.jsx"]:::frontend
        JR["JournalRoutes.jsx"]:::frontend

        click AR "https://github.com/dilansalas/smilenotes/blob/main/src/router/AppRouter.jsx"
        click HR "https://github.com/dilansalas/smilenotes/blob/main/src/home/routes/HomeRoutes.jsx"
        click AuR "https://github.com/dilansalas/smilenotes/blob/main/src/auth/routes/AuthRoutes.jsx"
        click JR "https://github.com/dilansalas/smilenotes/blob/main/src/journal/routes/JournalRoutes.jsx"

        AR --> HR
        AR --> AuR
        AR --> JR
    end

    subgraph "Auth Module"
        AuthLayout["AuthLayout.jsx"]:::frontend
        Login["LoginPage.jsx"]:::frontend
        Register["RegisterPage.jsx"]:::frontend
        NavbarLogin["NavbarLogin.jsx"]:::frontend

        click AuthLayout "https://github.com/dilansalas/smilenotes/blob/main/src/auth/layout/AuthLayout.jsx"
        click Login "https://github.com/dilansalas/smilenotes/blob/main/src/auth/pages/LoginPage.jsx"
        click Register "https://github.com/dilansalas/smilenotes/blob/main/src/auth/pages/RegisterPage.jsx"
        click NavbarLogin "https://github.com/dilansalas/smilenotes/blob/main/src/auth/pages/NavbarLogin.jsx"

        AuR --> AuthLayout
        AuthLayout --> NavbarLogin
        AuthLayout --> Login
        AuthLayout --> Register
    end

    subgraph "Home Module"
        HomePage["HomePage.jsx"]:::frontend
        About["About.jsx"]:::frontend
        Navbar["Navbar.jsx"]:::frontend
        Hero["HeroSection.jsx"]:::frontend
        Cta["CtaSection.jsx"]:::frontend
        QuotesSec["QuotesSection.jsx"]:::frontend
        QuotesCard["QuotesCard.jsx"]:::frontend
        Reflect["ReflectionSection.jsx"]:::frontend
        Practice["PracticeSection.jsx"]:::frontend
        Importante["Importante.jsx"]:::frontend
        Footer["Footer.jsx"]:::frontend

        click HomePage "https://github.com/dilansalas/smilenotes/blob/main/src/home/page/HomePage.jsx"
        click About "https://github.com/dilansalas/smilenotes/blob/main/src/home/page/About.jsx"
        click Navbar "https://github.com/dilansalas/smilenotes/blob/main/src/home/components/Navbar.jsx"
        click Hero "https://github.com/dilansalas/smilenotes/blob/main/src/home/components/HeroSection.jsx"
        click Cta "https://github.com/dilansalas/smilenotes/blob/main/src/home/components/CtaSection.jsx"
        click QuotesSec "https://github.com/dilansalas/smilenotes/blob/main/src/home/components/QuotesSection.jsx"
        click QuotesCard "https://github.com/dilansalas/smilenotes/blob/main/src/home/components/QuotesCard.jsx"
        click Reflect "https://github.com/dilansalas/smilenotes/blob/main/src/home/components/ReflectionSection.jsx"
        click Practice "https://github.com/dilansalas/smilenotes/blob/main/src/home/components/PracticeSection.jsx"
        click Importante "https://github.com/dilansalas/smilenotes/blob/main/src/home/components/Importante.jsx"
        click Footer "https://github.com/dilansalas/smilenotes/blob/main/src/home/components/Footer.jsx"
        click HR "https://github.com/dilansalas/smilenotes/blob/main/src/home/routes/HomeRoutes.jsx"

        HR --> HomePage
        HomePage --> Navbar
        HomePage --> Hero
        HomePage --> Cta
        HomePage --> QuotesSec
        QuotesSec --> QuotesCard
        HomePage --> Reflect
        HomePage --> Practice
        HomePage --> Importante
        HomePage --> Footer
    end

    subgraph "Journal Module"
        JournalLayout["JournalLayout.jsx"]:::frontend
        JournalPage["JournalPage.jsx"]:::frontend
        NavBar["NavBar.jsx"]:::frontend
        SideBar["SideBar.jsx"]:::frontend
        SideBarItem["SideBarItem.jsx"]:::frontend
        ImageGallery["ImageGallery.jsx"]:::frontend
        NoteView["NoteView.jsx"]:::frontend
        NothingView["NothingSelectedView.jsx"]:::frontend

        click JournalLayout "https://github.com/dilansalas/smilenotes/blob/main/src/journal/layout/JournalLayout.jsx"
        click JournalPage "https://github.com/dilansalas/smilenotes/blob/main/src/journal/pages/JournalPage.jsx"
        click NavBar "https://github.com/dilansalas/smilenotes/blob/main/src/journal/components/NavBar.jsx"
        click SideBar "https://github.com/dilansalas/smilenotes/blob/main/src/journal/components/SideBar.jsx"
        click SideBarItem "https://github.com/dilansalas/smilenotes/blob/main/src/journal/components/SideBarItem.jsx"
        click ImageGallery "https://github.com/dilansalas/smilenotes/blob/main/src/journal/components/ImageGallery.jsx"
        click NoteView "https://github.com/dilansalas/smilenotes/blob/main/src/journal/views/NoteView.jsx"
        click NothingView "https://github.com/dilansalas/smilenotes/blob/main/src/journal/views/NothingSelectedView.jsx"
        click JR "https://github.com/dilansalas/smilenotes/blob/main/src/journal/routes/JournalRoutes.jsx"

        JR --> JournalLayout
        JournalLayout --> NavBar
        JournalLayout --> SideBar
        SideBar --> SideBarItem
        JournalLayout --> JournalPage
        JournalPage --> ImageGallery
        JournalPage --> NoteView
        JournalPage --> NothingView
    end

    subgraph "State Management"
        Store["store.js"]:::state
        AuthSlice["authSlice.js"]:::state
        AuthThunks["thunks.js"]:::state
        JournalSlice["journalSlice.js"]:::state
        JournalThunks["thunks.js"]:::state

        click Store "https://github.com/dilansalas/smilenotes/blob/main/src/store/store.js"
        click AuthSlice "https://github.com/dilansalas/smilenotes/blob/main/src/store/auth/authSlice.js"
        click AuthThunks "https://github.com/dilansalas/smilenotes/blob/main/src/store/auth/thunks.js"
        click JournalSlice "https://github.com/dilansalas/smilenotes/blob/main/src/store/journal/journalSlice.js"
        click JournalThunks "https://github.com/dilansalas/smilenotes/blob/main/src/store/journal/thunks.js"

        Store --> AuthSlice
        Store --> JournalSlice
        AuthSlice --> AuthThunks
        JournalSlice --> JournalThunks
    end

    subgraph "Helpers"
        FileUpload["fileUpload.js"]:::state
        LoadNotes["loadNotes.js"]:::state

        click FileUpload "https://github.com/dilansalas/smilenotes/blob/main/src/helpers/fileUpload.js"
        click LoadNotes "https://github.com/dilansalas/smilenotes/blob/main/src/helpers/loadNotes.js"

        JournalThunks --> LoadNotes
        JournalThunks --> FileUpload
    end

    subgraph "Hooks"
        useCheckAuth["useCheckAuth.js"]:::frontend
        useForm["useForm.js"]:::frontend

        click useCheckAuth "https://github.com/dilansalas/smilenotes/blob/main/src/hooks/useCheckAuth.js"
        click useForm "https://github.com/dilansalas/smilenotes/blob/main/src/hooks/useForm.js"
    end

    subgraph "Firebase Integration"
        Config["config.js"]:::external
        Provider["provider.js"]:::external

        click Config "https://github.com/dilansalas/smilenotes/blob/main/src/firebase/config.js"
        click Provider "https://github.com/dilansalas/smilenotes/blob/main/src/firebase/provider.js"

        AuthThunks --> Config
        AuthThunks --> Provider
        JournalThunks --> Config
        JournalThunks --> Provider
    end

    subgraph "Theme Layer"
        AppTheme["AppTheme.jsx"]:::frontend
        PurpleTheme["purpleTheme.js"]:::frontend

        click AppTheme "https://github.com/dilansalas/smilenotes/blob/main/src/theme/AppTheme.jsx"
        click PurpleTheme "https://github.com/dilansalas/smilenotes/blob/main/src/theme/purpleTheme.js"
    end

    Login --> AuthThunks
    Register --> AuthThunks
    JournalPage --> JournalThunks
    AR --> Store
    Store --> JournalPage
    Store --> Login
    Store --> Register
```
