# seahuyty/goghi architecture

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

- Interactive diagram: https://gitdiagram.com/seahuyty/goghi
- Repository: https://github.com/seahuyty/goghi

## Overview

This repository contains two small Go HTTP services: a post service on port 8081 and a user service on port 8082. Each exposes a health endpoint and a database endpoint; the latter invokes its service-specific PostgreSQL connector, which reads DATABASE_URL or uses a local default and pings the database. The excerpts show these routes and connection attempts, but do not establish how the SQL migrations are applied or whether the services are deployed together.

Main entry points: [`services/post-service/cmd/main.go`](https://github.com/seahuyty/goghi/blob/main/services/post-service/cmd/main.go) (Post service), [`services/user-service/cmd/main.go`](https://github.com/seahuyty/goghi/blob/main/services/user-service/cmd/main.go) (User service), [`services/post-service/internal/database/database.go`](https://github.com/seahuyty/goghi/blob/main/services/post-service/internal/database/database.go) (Post DB connector), [`services/user-service/internal/database/database.go`](https://github.com/seahuyty/goghi/blob/main/services/user-service/internal/database/database.go) (User DB connector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP services"]
  node_post_http["Post service<br/>[main.go]"]
  node_user_http["User service<br/>[main.go]"]
end

subgraph group_data["Database access"]
  node_post_db["Post DB connector<br/>[database.go]"]
  node_user_db["User DB connector<br/>[database.go]"]
end

node_client(("HTTP client"))
node_postgres[("PostgreSQL")]

node_client -->|"requests routes"| node_post_http
node_client -->|"requests routes"| node_user_http
node_post_http -->|"invokes on /database"| node_post_db
node_user_http -->|"invokes on /database"| node_user_db
node_post_db -->|"opens and pings"| node_postgres
node_user_db -->|"opens and pings"| node_postgres

click node_post_http "https://github.com/seahuyty/goghi/blob/main/services/post-service/cmd/main.go"
click node_user_http "https://github.com/seahuyty/goghi/blob/main/services/user-service/cmd/main.go"
click node_post_db "https://github.com/seahuyty/goghi/blob/main/services/post-service/internal/database/database.go"
click node_user_db "https://github.com/seahuyty/goghi/blob/main/services/user-service/internal/database/database.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_post_http,node_user_http,node_client toneBlue
class node_post_db,node_user_db,node_postgres toneAmber
```

## Components

### HTTP services

- [Post service](https://github.com/seahuyty/goghi/blob/main/services/post-service/cmd/main.go): `services/post-service/cmd/main.go`
- [User service](https://github.com/seahuyty/goghi/blob/main/services/user-service/cmd/main.go): `services/user-service/cmd/main.go`

### Database access

- [Post DB connector](https://github.com/seahuyty/goghi/blob/main/services/post-service/internal/database/database.go): `services/post-service/internal/database/database.go`
- [User DB connector](https://github.com/seahuyty/goghi/blob/main/services/user-service/internal/database/database.go): `services/user-service/internal/database/database.go`

### Other components

- **HTTP client**
- **PostgreSQL**

## Connections

- HTTP client → Post service: requests routes (evidence: `services/post-service/cmd/main.go`)
- HTTP client → User service: requests routes (evidence: `services/user-service/cmd/main.go`)
- Post service → Post DB connector: invokes on /database (evidence: `services/post-service/cmd/main.go`)
- User service → User DB connector: invokes on /database (evidence: `services/user-service/cmd/main.go`)
- Post DB connector → PostgreSQL: opens and pings (evidence: `services/post-service/internal/database/database.go`)
- User DB connector → PostgreSQL: opens and pings (evidence: `services/user-service/internal/database/database.go`)
