Go + PostgreSQL (pgx & sqlc) + React
High-throughput systems architecture rules for Go (Golang), pgxpool connection management, sqlc type-safe query generation, and React web dashboards.
- Formats
- 4 files
- AGENTS.md
- 59 lines
- CLAUDE.md
- 15 lines
- Languages
- Go, TypeScript
- Updated
- Oct 2026
- Used by
- 4 projects
Writes .claude/skills/go-postgres-react/SKILL.md
$ curl -s --create-dirs -o .claude/skills/go-postgres-react/SKILL.md https://stackitfast.com/rules/go-postgres-react/SKILL.mdRule files
Works with Cursor · Claude Code · Windsurf · AGY
Architecture notes
Architecture Overview
Production conventions for high-throughput, low-latency concurrent systems with Go (Golang), pgxpool, sqlc, and React.
Verified Real-World Adoption
This exact architecture powers massive monitoring and messaging systems including Grafana, Mattermost, Lago, and PocketBase.
Key Architectural Nuances
- Compile-Time Type Safety:
sqlcvalidates SQL queries against actual PostgreSQL schema at build time. - Context-Aware Query Execution: Automatically cancels long-running database queries if clients drop HTTP connections.
Frequently asked questions
Does this AGENTS.md work with Cursor, Claude Code, and Windsurf?
Yes — AGENTS.md is the open, cross-tool standard read by Cursor, Claude Code, Windsurf, and 30+ other agents. A dedicated .mdc file is also included for Cursor's native .cursor/rules format.
Why use sqlc instead of an ORM like GORM?
sqlc compiles hand-written SQL into type-safe Go structs and functions at build time, so a broken query fails the build instead of failing at runtime in production. ORMs like GORM generate SQL dynamically at runtime, which trades compile-time safety for convenience — sqlc keeps the performance and predictability of raw SQL with full type safety.
Why propagate context.Context into every database call?
If an HTTP client disconnects mid-request, Go's context carries that cancellation signal down into pgx, which immediately aborts the in-flight query instead of letting it run to completion on an abandoned connection. Skipping this wastes database connections and CPU on work nobody is waiting for anymore.
Used in production
Explore all stacksGotify
6Gotify keeps the server one deployable Go binary by embedding its Vite/React web UI, using Gin and gorilla/websocket for the REST and streaming API, and swapping SQLite, MySQL or PostgreSQL through GORM, while a compiled Go plugin system handles extensibility instead of a scripting layer.
Grafana
6Grafana splits its backend into a growing set of independently versioned Go modules under apps/, tied together by a go.work workspace and modeled with Kubernetes-style APIs (pkg/apiserver, CUE-defined kinds), so individual product areas like alerting or dashboards can evolve without one monolithic backend module.
SeaweedFS
1Decoupling directory metadata from physical volume storage eliminates central metadata bottlenecks, enabling massive horizontal scaling for small and large files alike.
Mattermost
1A single Go binary keeps the API, scheduler, and websocket hub in one deployable process backed by a required PostgreSQL database, while optional Redis, Elasticsearch, and OpenSearch clients let larger deployments add caching and full-text search without changing the core architecture.