A modern interest-based community backend written in Go with DDD (Domain-Driven Design), similar to Baidu Tieba / Reddit.
翻訳待ち
Loading the full README.
Read the full README ↗English | 简体中文
A modern interest-based community backend written in Go with DDD (Domain-Driven Design), similar to Baidu Tieba / Reddit.
Qubar is a full-featured interest community platform offering:
| Component | Version | Purpose |
|---|---|---|
| PostgreSQL | 18 | Primary database, UUIDv7 primary keys, JSONB support |
| Redis | 7+ | Cache & session store, atomic ops via Lua scripts |
| Elasticsearch | 8.x | Full-text search with real-time index sync (via CDC) |
| Redpanda | latest | Kafka-compatible message queue for async stats aggregation & notification fan-out |
| AWS S3 | - | Object storage (images/videos) with presigned URLs |
| Nacos | 3.x | Configuration center with multi-environment support |
| Mailtrap | - | Email delivery (verification codes / notifications) |
The project follows a modular monolith architecture, with packages split by domain boundaries so it can be smoothly decomposed into microservices later:
pkg/
├── composition/ # Composition layer: wire dependencies, register routes, cross-domain Facade bridges
│ ├── hertzadapter/ # Hertz framework adapter → framework-agnostic routing abstraction
│ └── middleware/ # Global middleware (CORS, logging)
│
├── domains/ # Domain layer (each domain is self-contained)
│ ├── auth/ # Authentication (login, registration, OAuth)
│ ├── user/ # User (profiles, search)
│ ├── category/ # Category (circle categories)
│ ├── circle/ # Circle (creation, membership, permissions, management)
│ ├── post/ # Post (publishing, lists, details)
│ ├── comment/ # Comment (two-level flattened structure)
│ ├── like/ # Like (atomic ops + events)
│ ├── collect/ # Favorites
│ ├── history/ # Browsing history
│ ├── discover/ # Discover page aggregation
│ ├── trending/ # Trending posts
│ ├── recommend/ # Home feed recommendation
│ ├── notice/ # Message center (notifications + SSE unread stream)
│ ├── aiagent/ # AI agents (global + circle-scoped bots, reply triggers)
│ ├── storage/ # Storage (file uploads)
│ └── [domain]/
│ ├── application/ # Application services: use-case orchestration
│ ├── domain/ # Domain layer: models, repository interfaces, core business rules
│ ├── infrastructure/ # Infrastructure: repository impls, cache, search, events
│ └── interfaces/http/ # Interface layer: handlers, routes, DTOs
│
├── shared/ # Shared kernel (domain-agnostic)
│ ├── appctx/ # Context abstraction
│ ├── domain/ # Domain base classes (BaseModel)
│ ├── httputil/ # HTTP response utilities
│ └── routing/ # Framework-agnostic routing abstraction
│
├── conf/ # Configuration loading (Nacos + local fallback)
└── logger/ # Logging initialization
routing.RouterGroup abstractionroot_id marks hierarchy, avoiding recursive queries and enabling efficient paginationQubar ships with a two-tier AI agent system:
This is the beginning of the README. Read the rest at the original. Read the full README ↗