# luizeduarddev/book_store architecture

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

- Interactive diagram: https://gitdiagram.com/luizeduarddev/book_store
- Repository: https://github.com/luizeduarddev/book_store

## Overview

##### Project type and purpose
- This is a full-stack mobile application (“Book Store Project”) combining:
- A Django-based REST backend (Python, Django, Django REST Framework)
- A React Native frontend (TypeScript, Expo) for Android/iOS
- Integration with an external recommendation service (“Gemini”)

##### File structure
- Top level:
- Pipfile / Pipfile.lock → Python dependencies
- Projeto_Final/ → Django project (asgi.py, wsgi.py, settings.py, urls.py)
- manage.py → Django CLI entry point
- db.sqlite3 → Relational database
- media/ → Uploaded book-cover images
- playground/ → Django “app” containing models, views, URLs, utils, migrations
- client/ → React Native mobile app (App.tsx, android/, ios/, src/, babel.config.js, metro.config.js)
- Backend pattern: MVC (models.py, views.py, urls.py) plus a utils package
- Frontend pattern: Component-based navigation (LoginPage, admin_side, cliente_side, utils/PedidosNavigator.tsx)
- Config & deployment:
- Django settings handle DB, media, CORS, REST
- Expo for React Native bundling (app.json, package.json, tsconfig.json)
- ngrok for local exposure of backend to mobile device

##### README for additional insights
- Purpose: allow users to browse, purchase, and manage books; admin side for inventory
- Gemini integration: recommendation & availability queries via an external API
- Runtime instructions: run Django server, run Expo, expose server via ngrok

a. Main components
1. Mobile App (Expo React Native)
2. API Gateway / Backend Server (Django + DRF)
3. Database (SQLite)
4. Media Storage (local file system under /media)
5. External Service (Gemini for recommendations)
6. Admin Interface (Django admin or mobile admin section)
b. Relationships & interactions
- Mobile App ⇄ Backend API: REST calls over HTTP/HTTPS
- Backend ⇄ Database: ORM queries to SQLite
- Backend ⇄ Media Storage: Read/write cover images
- Backend ⇄ Gemini: HTTP requests to external recommendation API
c. Architectural patterns & design principles
- Client–Server separation
- MVC on backend, component-based UI on frontend
- Layered architecture:
– Presentation Layer (mobile components)
– Application Layer (Django views/serializers, playground/utils)
– Data Layer (models + SQLite + media files)
- Single codebase for mobile (shared TS code, navigation)
d. Key technologies & libraries
- Python, Django, Django REST Framework
- SQLite (or pluggable to Postgres)
- React Native + Expo
- TypeScript, Babel, Metro bundler
- ngrok for tunneling

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Presentation Layer"
        MobileApp["Mobile App (iOS/Android)"]:::frontend
        subgraph "Mobile App Details"
            Customer["Customer App"]:::frontend
            Admin["Admin App"]:::frontend
            PetNav["PedidosNavigator"]:::frontend
            ApiConf["API Routes Config"]:::frontend
        end
    end

    subgraph "ngrok Tunnel"
        ngrok["ngrok"]:::external
    end

    subgraph "Backend API Server"
        APIServer["Django API Server"]:::backend
        subgraph "Django Project"
            Settings["Projeto_Final/"]:::backend
            Urls["urls.py"]:::backend
        end
        subgraph "Playground App"
            Models["Models (ORM)"]:::data
            Views["API Views"]:::backend
            UrlsApp["App URLs"]:::backend
            AdminCfg["Django Admin"]:::backend
            Utils["Utils"]:::backend
            HotFns["Gemini Integration"]:::external
        end
    end

    DB["SQLite DB"]:::storage
    Media["Media Storage"]:::storage
    External["External Gemini Service"]:::external

    MobileApp -->|"HTTP GET/POST"| ngrok
    ngrok -->|"HTTP"| APIServer
    APIServer -->|"ORM queries"| DB
    APIServer -->|"File I/O"| Media
    APIServer -->|"REST call"| External

    click MobileApp "https://github.com/luizeduarddev/book_store/tree/main/client/"
    click Customer "https://github.com/luizeduarddev/book_store/tree/main/client/app/src/cliente_side/"
    click Admin "https://github.com/luizeduarddev/book_store/tree/main/client/app/src/admin_side/"
    click PetNav "https://github.com/luizeduarddev/book_store/blob/main/client/app/src/utils/PedidosNavigator.tsx"
    click ApiConf "https://github.com/luizeduarddev/book_store/blob/main/client/app/ApiConfigs/ApiRoute.tsx"
    click Settings "https://github.com/luizeduarddev/book_store/tree/main/Projeto_Final/"
    click Urls "https://github.com/luizeduarddev/book_store/blob/main/Projeto_Final/urls.py"
    click Models "https://github.com/luizeduarddev/book_store/blob/main/playground/models.py"
    click Views "https://github.com/luizeduarddev/book_store/blob/main/playground/views.py"
    click UrlsApp "https://github.com/luizeduarddev/book_store/blob/main/playground/urls.py"
    click AdminCfg "https://github.com/luizeduarddev/book_store/blob/main/playground/admin.py"
    click Utils "https://github.com/luizeduarddev/book_store/tree/main/playground/utils/"
    click HotFns "https://github.com/luizeduarddev/book_store/blob/main/playground/utils/hot_functions.py"
    click DB "https://github.com/luizeduarddev/book_store/blob/main/db.sqlite3"
    click Media "https://github.com/luizeduarddev/book_store/tree/main/media/"

    classDef frontend fill:#B3D4FC,stroke:#0366d6,color:#000
    classDef backend fill:#C8E6C9,stroke:#2e7d32,color:#000
    classDef data fill:#FFE082,stroke:#ef6c00,color:#000
    classDef storage fill:#FFCC80,stroke:#fb8c00,color:#000
    classDef external fill:#E0E0E0,stroke:#757575,color:#000
    classDef layer fill:none,stroke:#aaa,color:#000,stroke-dasharray:5 5
```
