# leoneville/gopportunities architecture

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

- Interactive diagram: https://gitdiagram.com/leoneville/gopportunities
- Repository: https://github.com/leoneville/gopportunities

## Overview

This repository implements a job-opening HTTP API. A client request enters through the Gin router, is dispatched to a CRUD handler, validated where applicable, and reads or writes an opening in SQLite before the handler formats a JSON response. The API also exposes Swagger UI. Configuration and handler initialization are shown, but the implementation of the top-level configuration and router initializers is not excerpted, so those internal links are left unverified where necessary.

Main entry points: [`router/routes.go`](https://github.com/leoneville/gopportunities/blob/master/router/routes.go) (API routes), [`schemas/opening.go`](https://github.com/leoneville/gopportunities/blob/master/schemas/opening.go) (Opening model), [`handler/createOpening.go`](https://github.com/leoneville/gopportunities/blob/master/handler/createOpening.go) (Create opening), [`handler/updateOpening.go`](https://github.com/leoneville/gopportunities/blob/master/handler/updateOpening.go) (Update opening)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Startup and routing"]
  node_main["Application startup<br/>[main.go]"]
  node_configuration["Configuration init<br/>[config.go]"]
  node_router["HTTP router<br/>[router.go]"]
  node_routes["API routes<br/>[routes.go]"]
end

subgraph group_operations["Opening operations"]
  node_create["Create opening<br/>[createOpening.go]"]
  node_list["List openings<br/>[listOpenings.go]"]
  node_show["Show opening<br/>[showOpening.go]"]
  node_update["Update opening<br/>[updateOpening.go]"]
  node_delete["Delete opening<br/>[deleteOpening.go]"]
end

subgraph group_storage["Persistence and model"]
  node_sqlite_init["SQLite initialization<br/>[sqlite.go]"]
  node_database[("SQLite database")]
  node_opening_model["Opening model<br/>[opening.go]"]
end

subgraph group_support["API support"]
  node_validation["Request validation<br/>[request.go]"]
  node_response["JSON responses<br/>[response.go]"]
  node_handler_init["Handler initialization<br/>[handler.go]"]
  node_swagger["Swagger documentation<br/>[docs.go]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_router
node_main -->|"initializes"| node_configuration
node_main -->|"starts"| node_router
node_router -.->|"registers routes"| node_routes
node_routes -->|"dispatches POST"| node_create
node_routes -->|"dispatches GET"| node_show
node_routes -->|"dispatches GET"| node_list
node_routes -->|"dispatches PUT"| node_update
node_routes -->|"dispatches DELETE"| node_delete
node_routes -->|"initializes handlers"| node_handler_init
node_routes -->|"serves UI"| node_swagger
node_handler_init -.->|"gets database"| node_sqlite_init
node_sqlite_init -->|"opens and migrates"| node_database
node_sqlite_init -->|"migrates model"| node_opening_model
node_create -->|"validates input"| node_validation
node_update -->|"validates input"| node_validation
node_create -->|"creates record"| node_database
node_list -->|"queries records"| node_database
node_show -->|"reads record"| node_database
node_update -->|"reads and saves"| node_database
node_delete -->|"reads and deletes"| node_database
node_create -->|"uses model"| node_opening_model
node_list -->|"uses model"| node_opening_model
node_show -->|"uses model"| node_opening_model
node_update -->|"uses model"| node_opening_model
node_delete -->|"uses model"| node_opening_model
node_create -->|"formats JSON"| node_response
node_list -->|"formats JSON"| node_response
node_show -->|"formats JSON"| node_response
node_update -->|"formats JSON"| node_response
node_delete -->|"formats JSON"| node_response

click node_main "https://github.com/leoneville/gopportunities/blob/master/main.go"
click node_configuration "https://github.com/leoneville/gopportunities/blob/master/config/config.go"
click node_router "https://github.com/leoneville/gopportunities/blob/master/router/router.go"
click node_routes "https://github.com/leoneville/gopportunities/blob/master/router/routes.go"
click node_create "https://github.com/leoneville/gopportunities/blob/master/handler/createOpening.go"
click node_list "https://github.com/leoneville/gopportunities/blob/master/handler/listOpenings.go"
click node_show "https://github.com/leoneville/gopportunities/blob/master/handler/showOpening.go"
click node_update "https://github.com/leoneville/gopportunities/blob/master/handler/updateOpening.go"
click node_delete "https://github.com/leoneville/gopportunities/blob/master/handler/deleteOpening.go"
click node_validation "https://github.com/leoneville/gopportunities/blob/master/handler/request.go"
click node_response "https://github.com/leoneville/gopportunities/blob/master/handler/response.go"
click node_handler_init "https://github.com/leoneville/gopportunities/blob/master/handler/handler.go"
click node_sqlite_init "https://github.com/leoneville/gopportunities/blob/master/config/sqlite.go"
click node_opening_model "https://github.com/leoneville/gopportunities/blob/master/schemas/opening.go"
click node_swagger "https://github.com/leoneville/gopportunities/blob/master/docs/docs.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_main,node_configuration,node_router,node_routes,node_client toneBlue
class node_create,node_list,node_show,node_update,node_delete toneAmber
class node_sqlite_init,node_database,node_opening_model toneMint
class node_validation,node_response,node_handler_init,node_swagger toneRose
```

## Components

### Startup and routing

- [Application startup](https://github.com/leoneville/gopportunities/blob/master/main.go): `main.go`
- [Configuration init](https://github.com/leoneville/gopportunities/blob/master/config/config.go): `config/config.go`
- [HTTP router](https://github.com/leoneville/gopportunities/blob/master/router/router.go): `router/router.go`
- [API routes](https://github.com/leoneville/gopportunities/blob/master/router/routes.go): `router/routes.go`

### Opening operations

- [Create opening](https://github.com/leoneville/gopportunities/blob/master/handler/createOpening.go): `handler/createOpening.go`
- [List openings](https://github.com/leoneville/gopportunities/blob/master/handler/listOpenings.go): `handler/listOpenings.go`
- [Show opening](https://github.com/leoneville/gopportunities/blob/master/handler/showOpening.go): `handler/showOpening.go`
- [Update opening](https://github.com/leoneville/gopportunities/blob/master/handler/updateOpening.go): `handler/updateOpening.go`
- [Delete opening](https://github.com/leoneville/gopportunities/blob/master/handler/deleteOpening.go): `handler/deleteOpening.go`

### Persistence and model

- [SQLite initialization](https://github.com/leoneville/gopportunities/blob/master/config/sqlite.go): `config/sqlite.go`
- **SQLite database**
- [Opening model](https://github.com/leoneville/gopportunities/blob/master/schemas/opening.go): `schemas/opening.go`

### API support

- [Request validation](https://github.com/leoneville/gopportunities/blob/master/handler/request.go): `handler/request.go`
- [JSON responses](https://github.com/leoneville/gopportunities/blob/master/handler/response.go): `handler/response.go`
- [Handler initialization](https://github.com/leoneville/gopportunities/blob/master/handler/handler.go): `handler/handler.go`
- [Swagger documentation](https://github.com/leoneville/gopportunities/blob/master/docs/docs.go): `docs/docs.go`

### Other components

- **API client**

## Connections

- API client → HTTP router: sends requests
- Application startup → Configuration init: initializes (evidence: `main.go`)
- Application startup → HTTP router: starts (evidence: `main.go`)
- HTTP router → API routes: registers routes
- API routes → Create opening: dispatches POST (evidence: `router/routes.go`)
- API routes → Show opening: dispatches GET (evidence: `router/routes.go`)
- API routes → List openings: dispatches GET (evidence: `router/routes.go`)
- API routes → Update opening: dispatches PUT (evidence: `router/routes.go`)
- API routes → Delete opening: dispatches DELETE (evidence: `router/routes.go`)
- API routes → Handler initialization: initializes handlers (evidence: `router/routes.go`)
- API routes → Swagger documentation: serves UI (evidence: `router/routes.go`)
- Handler initialization → SQLite initialization: gets database
- SQLite initialization → SQLite database: opens and migrates (evidence: `config/sqlite.go`)
- SQLite initialization → Opening model: migrates model (evidence: `config/sqlite.go`)
- Create opening → Request validation: validates input (evidence: `handler/createOpening.go`)
- Update opening → Request validation: validates input (evidence: `handler/updateOpening.go`)
- Create opening → SQLite database: creates record (evidence: `handler/createOpening.go`)
- List openings → SQLite database: queries records (evidence: `handler/listOpenings.go`)
- Show opening → SQLite database: reads record (evidence: `handler/showOpening.go`)
- Update opening → SQLite database: reads and saves (evidence: `handler/updateOpening.go`)
- Delete opening → SQLite database: reads and deletes (evidence: `handler/deleteOpening.go`)
- Create opening → Opening model: uses model (evidence: `handler/createOpening.go`)
- List openings → Opening model: uses model (evidence: `handler/listOpenings.go`)
- Show opening → Opening model: uses model (evidence: `handler/showOpening.go`)
- Update opening → Opening model: uses model (evidence: `handler/updateOpening.go`)
- Delete opening → Opening model: uses model (evidence: `handler/deleteOpening.go`)
- Create opening → JSON responses: formats JSON (evidence: `handler/createOpening.go`)
- List openings → JSON responses: formats JSON (evidence: `handler/listOpenings.go`)
- Show opening → JSON responses: formats JSON (evidence: `handler/showOpening.go`)
- Update opening → JSON responses: formats JSON (evidence: `handler/updateOpening.go`)
- Delete opening → JSON responses: formats JSON (evidence: `handler/deleteOpening.go`)
