# joaobortolotti/guiativa architecture

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

- Interactive diagram: https://gitdiagram.com/joaobortolotti/guiativa
- Repository: https://github.com/joaobortolotti/guiativa

## Overview

1. **What this repository is**
   - A monolithic Laravel application called **Guiativa**.
   - It is a **server-rendered** app using **Blade views** for UI, with **PHP/Laravel** as the backend and **Vite/Tailwind/vanilla JS** for front-end assets.
   - The product domain is a **local commerce directory / agenda**: consumers browse stores, promotions, contacts, hours, and locations; merchants manage their listing and plan status.

2. **Request entry and application bootstrap**
   - HTTP traffic enters through `public/index.php`, then Laravel boots via `bootstrap/app.php`.
   - Application structure is the standard Laravel layered flow: **routes → middleware → controllers → form requests → models → database → Blade responses**.
   - The repo includes separate route files for `web`, `auth`, `api`, `channels`, and `console`, so web pages, authentication, and ancillary endpoints are intentionally separated.

3. **Main user-facing surfaces**
   - `resources/views/welcome.blade.php` is the landing page and appears to support **search by commerce and city** plus category-style navigation.
   - `resources/views/announcement.blade.php` and `resources/views/announcement/info.blade.php` represent the public listing/detail experience for a commerce announcement.
   - `resources/views/dashboard.blade.php`, `resources/views/profile/*`, and `resources/views/plano/*` are the logged-in merchant/account areas.
   - `resources/views/auth/*` covers the standard authentication journey.

4. **Core domain subsystems**
   - The main business entities are modeled in `app/Models`:
     - `Anuncio` for the store/listing/announcement
     - `Endereco` for address data
     - `Contato` for contact details
     - `Horario_comercial` for opening hours
     - `Plano` for subscription/plan state
     - `CEP` for postal-code-driven address lookup or normalization
     - `User` for account identity
   - This suggests the app centers on a **merchant profile composed of several related records**, not a single flat table.

5. **Announcement management workflow**
   - `app/Http/Controllers/AnuncioController.php` handles the listing lifecycle.
   - `app/Http/Requests/Anuncio/StoreAnuncioRequest.php` indicates create/update validation is separated from controller logic.
   - Merchant-facing forms in `resources/views/profile/partials/update-anuncio-information-form.blade.php` and related partials suggest the merchant profile page is decomposed into sections for each domain area.
   - Public images for announcements live under `public/img/events`, implying uploaded/served storefront imagery is a key part of the listing model.

6. **Merchant account/profile subsystem**
   - `ProfileController` and `app/Http/Requests/ProfileUpdateRequest.php` manage account/profile edits.
   - The profile page is split into partial forms for:
     - profile identity
     - password
     - delete user
     - announcement info
     - contact info
     - address info
     - business hours
   - This is a strong indicator that the account screen is the **central control panel** for merchants to keep their commerce listing current.

7. **Plan and payment-related flow**
   - `PlanoController` and `resources/views/plano/{contrato,editar,pagar}.blade.php` define a dedicated plan/subscription area.
   - The README says merchants can verify the **status of the plan**, so plan state is likely tied to account eligibility or visibility.
   - The architecture appears to keep plan management separate from general profile editing, which is an important boundary in any diagram.

8. **Location, address, and contact enrichment**
   - `resources/js/cep.js` and the `CEP` model indicate postal-code lookup or address autofill.
   - `resources/js/maps.js` suggests map rendering or geolocation support for business location display.
   - The `EnderecoController` and `ContatoController` handle structured commerce contact/location data, likely feeding both merchant edit screens and public listing pages.

9. **Authentication and security boundaries**
   - Auth is implemented with dedicated controllers under `app/Http/Controllers/Auth`, including login, registration, password reset, email verification, and password confirmation.
   - Middleware in `app/Http/Middleware` includes:
     - `Authenticate`, `RedirectIfAuthenticated`
     - `VerifyCsrfToken`
     - `TrimStrings`
     - `EncryptCookies`
     - `PreventRequestsDuringMaintenance`
     - `HttpsProtocol` for forcing HTTPS
   - This means the app has a conventional Laravel security boundary with authenticated merchant-only sections and CSRF-protected forms.

10. **Frontend composition**
   - UI is built from Blade layouts and reusable components in `resources/views/components` and `app/View/Components`.
   - Layouts include `app`, `guest`, `navigation`, and `bottom_bar`, so the public site and authenticated area have distinct shells.
   - Client-side assets in `resources/js` also include `estrelas.js` and `imagem.js`, suggesting small interactive behaviors around rating/display and image handling.

11. **Persistence and schema**
   - The database layer is migration-driven via `database/migrations`, with tables for users, announcements, contacts, addresses, CEPs, opening hours, plans, and standard Laravel auth tables.
   - `database/factories/UserFactory.php` and `database/seeders/DatabaseSeeder.php` support test/data bootstrapping.
   - Because the domain tables are split by concern, the diagram should show the data model as a set of related business records rather than one monolithic listing table.

12. **Infrastructure and operational details**
   - `docker-compose.yml` suggests the project is intended to run in a containerized local/dev environment.
   - `storage/` and `bootstrap/cache/` are standard Laravel runtime areas for logs, cached config/views, sessions, and generated files.
   - `public/` hosts static assets and publicly served uploaded content.

13. **Localization and presentation**
   - The application is localized in **Portuguese (pt_BR)** with custom translation files under `lang/pt_BR`.
   - This matters because the UI, validation messages, and auth flows are likely all branded and worded for Brazilian users.
   - Any architecture diagram should reflect a **Brazilian commerce directory** with CEP/address and local-business semantics.

14. **What to emphasize in an architecture diagram**
   - Draw the system as a **single Laravel monolith** with three major zones:
     - **Public discovery**: welcome page, announcement listing/detail, search/navigation
     - **Merchant management**: dashboard/profile/plan/edit forms
     - **Platform services**: authentication, validation, persistence, static assets, localization
   - Show the primary flow as: **browser → Laravel routes/middleware → controllers/form requests → Eloquent models/database → Blade views/static assets**.

Main entry points: [`routes/web.php`](https://github.com/joaobortolotti/guiativa/blob/main/routes/web.php) (Public routes), [`app/Models/Anuncio.php`](https://github.com/joaobortolotti/guiativa/blob/main/app/Models/Anuncio.php) (Models), [`app/Http/Controllers/AnuncioController.php`](https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Controllers/AnuncioController.php) (Anuncio controller), [`resources/views/profile/edit.blade.php`](https://github.com/joaobortolotti/guiativa/blob/main/resources/views/profile/edit.blade.php) (Profile editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_g1["Public discovery"]
  node_n2["Public routes<br/>route entry<br/>[web.php]"]
  node_n3["Welcome page<br/>public view<br/>[welcome.blade.php]"]
  node_n4["Announcement pages<br/>public views"]
  node_n5["Anuncio controller<br/>listing controller"]
  node_n6["Listing validation<br/>form request"]
end

subgraph group_g2["Merchant management"]
  node_n7["Merchant dashboard<br/>authenticated view"]
  node_n8["Profile editor<br/>merchant views<br/>[edit.blade.php]"]
  node_n9["Profile controller"]
  node_n10["Profile validation<br/>form request"]
  node_n11["Plan area<br/>subscription views<br/>[contrato.blade.php]"]
  node_n12["Plan controller"]
end

subgraph group_g3["Platform services"]
  node_n13["Auth stack<br/>auth routes/controllers<br/>[auth.php]"]
  node_n14["HTTP middleware<br/>security pipeline<br/>[Kernel.php]"]
  node_n15["Laravel bootstrap<br/>app bootstrap<br/>[app.php]"]
  node_n16["Layouts and components<br/>blade shell<br/>[app.blade.php]"]
end

subgraph group_g4["Data and assets"]
  node_n17[("Models<br/>[Anuncio.php]")]
  node_n18[("Database schema<br/>migrations")]
  node_n19["Assets and static<br/>frontend assets<br/>[app.js]"]
  node_n20["Localization<br/>translations<br/>[pt_BR.json]"]
end

node_n1(("Browser<br/>client"))

node_n1 -->|"requests"| node_n2
node_n2 -->|"renders"| node_n3
node_n2 -->|"renders"| node_n4
node_n2 -->|"dispatches"| node_n5
node_n5 -->|"validates"| node_n6
node_n5 -->|"persists"| node_n17
node_n5 -->|"returns"| node_n4
node_n1 -->|"authenticates"| node_n13
node_n13 -->|"protected by"| node_n14
node_n1 -->|"opens"| node_n7
node_n7 -->|"links to"| node_n8
node_n8 -->|"updates via"| node_n9
node_n9 -->|"validates"| node_n10
node_n9 -->|"updates"| node_n17
node_n8 -->|"links to"| node_n11
node_n11 -->|"handled by"| node_n12
node_n12 -->|"reads"| node_n17
node_n15 -->|"loads"| node_n14
node_n14 -->|"protects"| node_n2
node_n14 -->|"protects"| node_n13
node_n2 -->|"uses"| node_n16
node_n8 -->|"uses"| node_n16
node_n17 -->|"stored in"| node_n18
node_n19 -->|"enhances"| node_n3
node_n19 -->|"enhances"| node_n4
node_n20 -->|"localizes"| node_n3
node_n20 -->|"localizes"| node_n13
node_n17 -.->|"consumes"| node_n20

click node_n2 "https://github.com/joaobortolotti/guiativa/blob/main/routes/web.php"
click node_n3 "https://github.com/joaobortolotti/guiativa/blob/main/resources/views/welcome.blade.php"
click node_n4 "https://github.com/joaobortolotti/guiativa/blob/main/resources/views/announcement.blade.php"
click node_n5 "https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Controllers/AnuncioController.php"
click node_n6 "https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Requests/Anuncio/StoreAnuncioRequest.php"
click node_n7 "https://github.com/joaobortolotti/guiativa/blob/main/resources/views/dashboard.blade.php"
click node_n8 "https://github.com/joaobortolotti/guiativa/blob/main/resources/views/profile/edit.blade.php"
click node_n9 "https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Controllers/ProfileController.php"
click node_n10 "https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Requests/ProfileUpdateRequest.php"
click node_n11 "https://github.com/joaobortolotti/guiativa/blob/main/resources/views/plano/contrato.blade.php"
click node_n12 "https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Controllers/PlanoController.php"
click node_n13 "https://github.com/joaobortolotti/guiativa/blob/main/routes/auth.php"
click node_n14 "https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Kernel.php"
click node_n15 "https://github.com/joaobortolotti/guiativa/blob/main/bootstrap/app.php"
click node_n16 "https://github.com/joaobortolotti/guiativa/blob/main/resources/views/layouts/app.blade.php"
click node_n17 "https://github.com/joaobortolotti/guiativa/blob/main/app/Models/Anuncio.php"
click node_n18 "https://github.com/joaobortolotti/guiativa/blob/main/database/migrations/2023_05_16_211704_create_anuncios_table.php"
click node_n19 "https://github.com/joaobortolotti/guiativa/blob/main/resources/js/app.js"
click node_n20 "https://github.com/joaobortolotti/guiativa/blob/main/lang/pt_BR.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_n2,node_n3,node_n4,node_n5,node_n6 toneBlue
class node_n7,node_n8,node_n9,node_n10,node_n11,node_n12 toneAmber
class node_n13,node_n14,node_n15,node_n16 toneMint
class node_n17,node_n18,node_n19,node_n20 toneRose
class node_n1 toneNeutral
```

## Components

### Public discovery

Unauthenticated browsing and public listing pages for local commerce discovery.

- [Public routes](https://github.com/joaobortolotti/guiativa/blob/main/routes/web.php): route entry · Web entry points for landing, announcements, and general browsing. · `routes/web.php`
- [Welcome page](https://github.com/joaobortolotti/guiativa/blob/main/resources/views/welcome.blade.php): public view · Landing page with search and category-style navigation. · `resources/views/welcome.blade.php`
- [Announcement pages](https://github.com/joaobortolotti/guiativa/blob/main/resources/views/announcement.blade.php): public views · Listing and detail views for commerce announcements. · `resources/views/announcement.blade.php`
- [Anuncio controller](https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Controllers/AnuncioController.php): listing controller · Handles announcement lifecycle and public listing interactions. · `app/Http/Controllers/AnuncioController.php`
- [Listing validation](https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Requests/Anuncio/StoreAnuncioRequest.php): form request · Validates announcement create and update data. · `app/Http/Requests/Anuncio/StoreAnuncioRequest.php`

### Merchant management

Authenticated dashboard, profile, and plan workflows for listing owners.

- [Merchant dashboard](https://github.com/joaobortolotti/guiativa/blob/main/resources/views/dashboard.blade.php): authenticated view · Central merchant area for account and commerce management. · `resources/views/dashboard.blade.php`
- [Profile editor](https://github.com/joaobortolotti/guiativa/blob/main/resources/views/profile/edit.blade.php): merchant views · Profile screen and partial forms for merchant account and listing details. · `resources/views/profile/edit.blade.php`
- [Profile controller](https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Controllers/ProfileController.php): profile controller · Updates account and merchant profile data. · `app/Http/Controllers/ProfileController.php`
- [Profile validation](https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Requests/ProfileUpdateRequest.php): form request · Validates merchant profile updates. · `app/Http/Requests/ProfileUpdateRequest.php`
- [Plan area](https://github.com/joaobortolotti/guiativa/blob/main/resources/views/plano/contrato.blade.php): subscription views · Merchant plan pages for contract, edit, and payment flows. · `resources/views/plano/contrato.blade.php`
- [Plan controller](https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Controllers/PlanoController.php): plan controller · Manages subscription state and plan-related actions. · `app/Http/Controllers/PlanoController.php`

### Platform services

Cross-cutting Laravel runtime concerns: routing, auth, validation, middleware, and shared UI.

- [Auth stack](https://github.com/joaobortolotti/guiativa/blob/main/routes/auth.php): auth routes/controllers · Login, registration, reset, verification, and password confirmation flows. · `routes/auth.php`
- [HTTP middleware](https://github.com/joaobortolotti/guiativa/blob/main/app/Http/Kernel.php): security pipeline · CSRF, auth, redirects, HTTPS enforcement, and request hygiene. · `app/Http/Kernel.php`
- [Laravel bootstrap](https://github.com/joaobortolotti/guiativa/blob/main/bootstrap/app.php): app bootstrap · Bootstraps the application and wires core services. · `bootstrap/app.php`
- [Layouts and components](https://github.com/joaobortolotti/guiativa/blob/main/resources/views/layouts/app.blade.php): blade shell · Shared Blade layouts and reusable UI components. · `resources/views/layouts/app.blade.php`

### Data and assets

Persistence, seeded data, translations, and served frontend/static resources.

- [Models](https://github.com/joaobortolotti/guiativa/blob/main/app/Models/Anuncio.php): domain models · Eloquent models for listings, contacts, addresses, hours, plans, CEP, and users. · `app/Models/Anuncio.php`
- [Database schema](https://github.com/joaobortolotti/guiativa/blob/main/database/migrations/2023_05_16_211704_create_anuncios_table.php): migrations · Migration-driven tables for users, announcements, contacts, addresses, CEPs, hours, and plans. · `database/migrations/2023_05_16_211704_create_anuncios_table.php`
- [Assets and static](https://github.com/joaobortolotti/guiativa/blob/main/resources/js/app.js): frontend assets · Vite-built JavaScript/CSS, maps, CEP autofill, images, and public files. · `resources/js/app.js`
- [Localization](https://github.com/joaobortolotti/guiativa/blob/main/lang/pt_BR.json): translations · Portuguese Brazilian validation, auth, and UI strings. · `lang/pt_BR.json`

### Other components

- **Browser**: client · End users and merchants access the app through HTTP.

## Connections

- Browser → Public routes: requests · Browser traffic enters the web routes.
- Public routes → Welcome page: renders · Public route serves the landing page.
- Public routes → Announcement pages: renders · Public route serves announcement pages.
- Public routes → Anuncio controller: dispatches · Routes forward listing actions to the announcement controller.
- Anuncio controller → Listing validation: validates · Announcement input is validated before persistence.
- Anuncio controller → Models: persists · Listing controller reads and writes announcement data.
- Anuncio controller → Announcement pages: returns · Controller returns public announcement views.
- Browser → Auth stack: authenticates · Login, registration, and recovery flows are handled separately.
- Auth stack → HTTP middleware: protected by · Authentication endpoints are guarded by middleware and request checks.
- Browser → Merchant dashboard: opens · Authenticated merchants land in the dashboard.
- Merchant dashboard → Profile editor: links to · Dashboard exposes profile management.
- Profile editor → Profile controller: updates via · Profile form submits to the profile controller.
- Profile controller → Profile validation: validates · Profile updates use a dedicated request object.
- Profile controller → Models: updates · Profile controller writes merchant and listing-related models.
- Profile editor → Plan area: links to · Profile area surfaces plan management.
- Plan area → Plan controller: handled by · Plan pages are coordinated by the plan controller.
- Plan controller → Models: reads · Plan state is tied back to domain records.
- Laravel bootstrap → HTTP middleware: loads · Bootstrap initializes the HTTP middleware stack.
- HTTP middleware → Public routes: protects · Middleware wraps the web route surface.
- HTTP middleware → Auth stack: protects · Middleware also guards auth endpoints.
- Public routes → Layouts and components: uses · Web pages are composed from shared Blade layouts and components.
- Profile editor → Layouts and components: uses · Merchant forms reuse the same Blade shell and components.
- Models → Database schema: stored in · Eloquent models map to migration-defined tables.
- Assets and static → Welcome page: enhances · Frontend assets support search, maps, images, and small interactions.
- Assets and static → Announcement pages: enhances · Static assets enrich public listing presentation.
- Localization → Welcome page: localizes · UI strings and validation copy are localized in pt_BR.
- Localization → Auth stack: localizes · Authentication flows use Portuguese translation files.
- Models → Localization: consumes · Model and form messages are presented in the localized UI.
