# goravel/example architecture

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

- Interactive diagram: https://gitdiagram.com/goravel/example
- Repository: https://github.com/goravel/example

## Overview

This repository is a Goravel example web application demonstrating framework capabilities. Its main user workflow is an HTTP request routed to an application controller, which may validate input, use authentication or persistence, and return a response. Separate branches demonstrate gRPC, GraphQL, WebSockets, localization, views, and Swagger. Bootstrap explicitly wires the route sets and event listeners; unsampled route implementations limit claims about which controller each route dispatches to.

Main entry points: [`bootstrap/app.go`](https://github.com/goravel/example/blob/v1.18.x/bootstrap/app.go) (Bootstrap), [`app/http/controllers/auth_controller.go`](https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/auth_controller.go) (Authentication), [`routes/graphql.go`](https://github.com/goravel/example/blob/v1.18.x/routes/graphql.go) (GraphQL routes), [`app/facades`](https://github.com/goravel/example/tree/v1.18.x/app/facades) (Framework facades)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Application wiring"]
  node_bootstrap["Bootstrap<br/>[app.go]"]
  node_providers["Service providers<br/>[providers.go]"]
end

subgraph group_http["HTTP features"]
  node_web_routes["Web routes<br/>[web.go]"]
  node_api_routes["API routes<br/>[api.go]"]
  node_auth["Authentication<br/>[auth_controller.go]"]
  node_validation["Validation"]
  node_validation_request["Validation request"]
  node_database_demo["Database example<br/>[db_controller.go]"]
  node_websocket["WebSocket example"]
  node_swagger["Swagger example"]
end

subgraph group_services["Application services"]
  node_user_controller["User service<br/>[user.go]"]
  node_user_model["User model<br/>[user.go]"]
  node_facades["Framework facades"]
  node_events["Order events"]
  node_shipment_listener["Shipment listener"]
end

subgraph group_protocols["Other protocols"]
  node_grpc_routes["gRPC routes<br/>[grpc.go]"]
  node_grpc_controller["gRPC user service<br/>[user_controller.go]"]
  node_graphql_routes["GraphQL routes<br/>[graphql.go]"]
  node_graphql_resolvers["GraphQL resolvers"]
  node_localization["Localization<br/>[fs.go]"]
  node_websocket_client["WebSocket client<br/>[main.go]"]
end

node_user(("HTTP client"))

node_user -.->|"requests service"| node_bootstrap
node_bootstrap -->|"registers routes"| node_web_routes
node_bootstrap -->|"registers routes"| node_api_routes
node_bootstrap -->|"registers routes"| node_grpc_routes
node_bootstrap -->|"registers routes"| node_graphql_routes
node_bootstrap -->|"loads providers"| node_providers
node_bootstrap -->|"registers events"| node_events
node_bootstrap -->|"registers listener"| node_shipment_listener
node_auth -->|"uses auth and ORM"| node_facades
node_auth -->|"loads user"| node_user_model
node_validation -->|"validates request"| node_validation_request
node_database_demo -.->|"uses framework services"| node_facades
node_grpc_controller -.->|"returns user data"| node_user
node_graphql_routes -.->|"serves GraphQL"| node_graphql_resolvers
node_websocket_client -.->|"connects to WebSocket"| node_user

click node_bootstrap "https://github.com/goravel/example/blob/v1.18.x/bootstrap/app.go"
click node_providers "https://github.com/goravel/example/blob/v1.18.x/bootstrap/providers.go"
click node_web_routes "https://github.com/goravel/example/blob/v1.18.x/routes/web.go"
click node_api_routes "https://github.com/goravel/example/blob/v1.18.x/routes/api.go"
click node_auth "https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/auth_controller.go"
click node_validation "https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/validation_controller.go"
click node_validation_request "https://github.com/goravel/example/blob/v1.18.x/app/http/requests/validation_create.go"
click node_database_demo "https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/db_controller.go"
click node_websocket "https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/websocket_controller.go"
click node_swagger "https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/swagger_controller.go"
click node_user_controller "https://github.com/goravel/example/blob/v1.18.x/app/services/user.go"
click node_user_model "https://github.com/goravel/example/blob/v1.18.x/app/models/user.go"
click node_facades "https://github.com/goravel/example/tree/v1.18.x/app/facades"
click node_events "https://github.com/goravel/example/tree/v1.18.x/app/events"
click node_shipment_listener "https://github.com/goravel/example/blob/v1.18.x/app/listeners/send_shipment_notification.go"
click node_grpc_routes "https://github.com/goravel/example/blob/v1.18.x/routes/grpc.go"
click node_grpc_controller "https://github.com/goravel/example/blob/v1.18.x/app/grpc/controllers/user_controller.go"
click node_graphql_routes "https://github.com/goravel/example/blob/v1.18.x/routes/graphql.go"
click node_graphql_resolvers "https://github.com/goravel/example/blob/v1.18.x/graph/schema.resolvers.go"
click node_localization "https://github.com/goravel/example/blob/v1.18.x/lang_fs/fs.go"
click node_websocket_client "https://github.com/goravel/example/blob/v1.18.x/packages/websocket_client/main.go"

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_bootstrap,node_providers,node_user toneBlue
class node_web_routes,node_api_routes,node_auth,node_validation,node_validation_request,node_database_demo,node_websocket,node_swagger toneAmber
class node_user_controller,node_user_model,node_facades,node_events,node_shipment_listener toneMint
class node_grpc_routes,node_grpc_controller,node_graphql_routes,node_graphql_resolvers,node_localization,node_websocket_client toneRose
```

## Components

### Application wiring

- [Bootstrap](https://github.com/goravel/example/blob/v1.18.x/bootstrap/app.go): `bootstrap/app.go`
- [Service providers](https://github.com/goravel/example/blob/v1.18.x/bootstrap/providers.go): `bootstrap/providers.go`

### HTTP features

- [Web routes](https://github.com/goravel/example/blob/v1.18.x/routes/web.go): `routes/web.go`
- [API routes](https://github.com/goravel/example/blob/v1.18.x/routes/api.go): `routes/api.go`
- [Authentication](https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/auth_controller.go): `app/http/controllers/auth_controller.go`
- [Validation](https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/validation_controller.go): `app/http/controllers/validation_controller.go`
- [Validation request](https://github.com/goravel/example/blob/v1.18.x/app/http/requests/validation_create.go): `app/http/requests/validation_create.go`
- [Database example](https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/db_controller.go): `app/http/controllers/db_controller.go`
- [WebSocket example](https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/websocket_controller.go): `app/http/controllers/websocket_controller.go`
- [Swagger example](https://github.com/goravel/example/blob/v1.18.x/app/http/controllers/swagger_controller.go): `app/http/controllers/swagger_controller.go`

### Application services

- [User service](https://github.com/goravel/example/blob/v1.18.x/app/services/user.go): `app/services/user.go`
- [User model](https://github.com/goravel/example/blob/v1.18.x/app/models/user.go): `app/models/user.go`
- [Framework facades](https://github.com/goravel/example/tree/v1.18.x/app/facades): `app/facades`
- [Order events](https://github.com/goravel/example/tree/v1.18.x/app/events): `app/events`
- [Shipment listener](https://github.com/goravel/example/blob/v1.18.x/app/listeners/send_shipment_notification.go): `app/listeners/send_shipment_notification.go`

### Other protocols

- [gRPC routes](https://github.com/goravel/example/blob/v1.18.x/routes/grpc.go): `routes/grpc.go`
- [gRPC user service](https://github.com/goravel/example/blob/v1.18.x/app/grpc/controllers/user_controller.go): `app/grpc/controllers/user_controller.go`
- [GraphQL routes](https://github.com/goravel/example/blob/v1.18.x/routes/graphql.go): `routes/graphql.go`
- [GraphQL resolvers](https://github.com/goravel/example/blob/v1.18.x/graph/schema.resolvers.go): `graph/schema.resolvers.go`
- [Localization](https://github.com/goravel/example/blob/v1.18.x/lang_fs/fs.go): `lang_fs/fs.go`
- [WebSocket client](https://github.com/goravel/example/blob/v1.18.x/packages/websocket_client/main.go): `packages/websocket_client/main.go`

### Other components

- **HTTP client**

## Connections

- HTTP client → Bootstrap: requests service
- Bootstrap → Web routes: registers routes (evidence: `bootstrap/app.go`)
- Bootstrap → API routes: registers routes (evidence: `bootstrap/app.go`)
- Bootstrap → gRPC routes: registers routes (evidence: `bootstrap/app.go`)
- Bootstrap → GraphQL routes: registers routes (evidence: `bootstrap/app.go`)
- Bootstrap → Service providers: loads providers (evidence: `bootstrap/app.go`)
- Bootstrap → Order events: registers events (evidence: `bootstrap/app.go`)
- Bootstrap → Shipment listener: registers listener (evidence: `bootstrap/app.go`)
- Authentication → Framework facades: uses auth and ORM (evidence: `app/http/controllers/auth_controller.go`)
- Authentication → User model: loads user (evidence: `app/http/controllers/auth_controller.go`)
- Validation → Validation request: validates request (evidence: `app/http/controllers/validation_controller.go`)
- Database example → Framework facades: uses framework services
- gRPC user service → HTTP client: returns user data (evidence: `app/grpc/controllers/user_controller.go`)
- GraphQL routes → GraphQL resolvers: serves GraphQL
- WebSocket client → HTTP client: connects to WebSocket (evidence: `packages/websocket_client/main.go`)
