# go实现的cms系统 **Repository Path**: dlmshk/ai-go-cms ## Basic Information - **Project Name**: go实现的cms系统 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-06 - **Last Updated**: 2026-08-07 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AI Go CMS A lightweight, high-performance CMS built with Go and Vue 3. ## Features - **Article Management** - Full CRUD with workflow-based publishing - **Category System** - Hierarchical tree with ownership permissions - **Template Engine** - Category-level label templates and Vue component templates - **Plugin System** - Backend Go plugins + Frontend Vue plugins - **Workflow Engine** - Configurable multi-step approval workflows - **RBAC** - Role-based access control - **Full-text Search** - Article search with filtering - **Public Page Cache** - URL/query-aware whole-page caching for public label templates - **Structured Logging** - JSON logs with slog - **Prometheus Metrics** - Built-in metrics endpoint - **Object Storage** - Pluggable storage (local, S3, OSS, COS) ## Tech Stack **Backend:** - Go 1.21+ - Gin web framework - GORM (SQLite/PostgreSQL) - JWT authentication - Vite plugin system **Frontend:** - Vue 3 - Vite - Element Plus - Vue Router - Pinia (state management) ## Project Structure ``` ai-go-cms/ ├── cmd/server/ # Application entry point ├── internal/ │ ├── app/ # Application bootstrap, container, routing, server lifecycle │ ├── codegen/ # CRUD code generator │ ├── config/ # Configuration loading │ ├── domain/ # Business domains │ ├── persistence/ # Database setup, dialects, GORM models, seed data │ ├── platform/ # Cache, logging, metrics, storage adapters │ ├── testsupport/ # Shared test-only helpers │ └── transport/ # HTTP handlers, response helpers, middleware ├── frontend/ # Vue 3 admin dashboard ├── templates/ # Label templates ├── gen/ # Generated code ├── proto/ # Protobuf definitions └── config.yaml # Configuration file ``` ## Getting Started ### Prerequisites - Go 1.21+ - Node.js 18+ - npm or yarn ### Backend ```bash # Install dependencies go mod download # Run the server go run cmd/server/main.go -c config.yaml # Run tests go test ./... ``` ### Frontend ```bash cd frontend # Install dependencies npm install # Development server npm run dev # Production build npm run build ``` ### Configuration Edit `config.yaml`: ```yaml server: host: "0.0.0.0" port: 8080 log_level: "info" # debug, info, warn, error database: driver: "sqlite" dsn: "./data/cms.db" jwt: secret: "your-secret-key" expire: 86400 # 24 hours storage: provider: "local" local: base_dir: "./data/uploads" cache: enabled: true max_size: 1000 ttl: 3600 # seconds ``` ## API Endpoints ### Authentication | Method | Endpoint | Description | |--------|----------|-------------| | POST | `/api/login` | User login | | POST | `/api/register` | User registration | | GET | `/api/user/info` | Get current user | ### Categories | Method | Endpoint | Description | |--------|----------|-------------| | GET | `/api/categories/tree` | Get category tree | | GET | `/api/categories/:id` | Get category | | POST | `/api/categories` | Create category | | PUT | `/api/categories/:id` | Update category | | DELETE | `/api/categories/:id` | Delete category | | GET | `/api/categories/:id/owners` | List owners | | POST | `/api/categories/:id/owners` | Add owner | | DELETE | `/api/categories/:id/owners/:userId` | Remove owner | ### Articles | Method | Endpoint | Description | |--------|----------|-------------| | GET | `/api/articles` | List articles | | GET | `/api/articles/:id` | Get article | | POST | `/api/articles` | Create article | | PUT | `/api/articles/:id` | Update article | | DELETE | `/api/articles/:id` | Delete article | | POST | `/api/articles/:id/publish` | Publish article | | POST | `/api/articles/:id/recall` | Recall article | ### Templates | Method | Endpoint | Description | |--------|----------|-------------| | GET | `/api/templates` | List templates | | GET | `/api/templates/:name` | Get template | | POST | `/api/templates` | Create template | | PUT | `/api/templates/:name` | Update template | | DELETE | `/api/templates/:name` | Delete template | ### Search | Method | Endpoint | Description | |--------|----------|-------------| | GET | `/api/search` | Search articles | ### Plugins | Method | Endpoint | Description | |--------|----------|-------------| | GET | `/api/plugins` | List plugins | | POST | `/api/plugins` | Install plugin | | DELETE | `/api/plugins/:name` | Uninstall plugin | ### Operations | Method | Endpoint | Description | |--------|----------|-------------| | GET | `/health` | Health check | | GET | `/ready` | Readiness check | | GET | `/live` | Liveness check | | GET | `/metrics` | Prometheus metrics | | POST | `/api/cache/pages/invalidate` | Clear public label page cache (admin permission required) | ## Template Tags ```html {cms:article category="news" limit="10"}

{$article.title}

{$article.summary}

{/cms:article} {cms:category} {/cms:category} {cms:search keyword="golang"}
{$title}
{/cms:search} {cms:dict key="article.status" value="published"} ``` ## Workflow Articles follow configurable workflows: ```yaml workflows: article_publish: steps: - name: "Draft" approvers: ["author"] - name: "Review" approvers: ["reviewer"] - name: "Approved" approvers: ["editor"] ``` ## License MIT