Implementation Plan: Complete Content Management Features
Plans six implementation steps to add content versioning, tag filtering, profile customization, tests, and complexity reduction for a flat-file CMS.
What this file does
Plans six implementation steps to add content versioning, tag filtering, profile customization, tests, and complexity reduction for a flat-file CMS.
When to use it
- You need to add version history and revert commands to a flat-file content system
- You want to implement tag-based filtering with CLI and HTTP routes
- You plan to expand test coverage and refactor high-complexity functions
- You are tracking progress toward completing README-stated features
Assumes this stack
Implementation Plan: Complete Content Management Features
Project Context
- What it does: Createon is a self-hosted Patreon alternative enabling cryptocurrency (BTC/XMR) monetization with flat-file storage.
- Current goal: Implement content versioning—the highest-priority missing feature claimed in README.
- Estimated Scope: Medium (11 functions above complexity 9.0, 4 feature gaps remaining)
Goal-Achievement Status
| Stated Goal | Current Status | This Plan Addresses |
|---|---|---|
| Content versioning | ❌ Missing | Yes |
| Tags and categories | ⚠️ Partial (data exists, no UI/filtering) | Yes |
| Profile customization | ⚠️ Partial (fields exist, no upload/CLI) | Yes |
| Test coverage >50% | ⚠️ Partial (30% weighted average) | Yes |
| Bitcoin (BTC) payments | ✅ Achieved | No |
| Monero (XMR) payments | ✅ Achieved | No |
| Tier-based access control | ✅ Achieved | No |
| Subscription management | ✅ Achieved | No |
| Backup/restore | ✅ Achieved | No |
| Thread-safe operations | ✅ Achieved | No |
Metrics Summary
- Complexity hotspots on goal-critical paths: 11 functions above threshold 9.0
CreateSubscription(15.3) — subscription creationverifyAccessImpl(15.0) — access controlrunSubList(14.0) — CLIrunServer(14.0) — HTTP server setuprunBackupRestore(12.7) — backuprunListCreators(11.4) — CLIatomicWrite(10.9) — file operationshandleSubscribe(10.1) — HTTP handlerrunPostPublish(9.6) — post publishing (goal-critical for versioning)handleViewPost(9.6) — post viewingfindSubscriptionByPaymentID(9.3) — payment lookup
- Duplication ratio: 0.42% (10 duplicated lines in
pkg/files/manager.go:135-144and167-176) - Doc coverage: 88.2% overall (functions: 100%, methods: 82%, types: 90%)
- Package coupling:
clipackage (1125 lines) concentrates HTTP handlers, CLI commands, and business logic—potential future separation point
Implementation Steps
Step 1: Implement Content Versioning Core
- Deliverable: Add version storage mechanism for posts
- Add
Version intfield toPoststruct intypes.go - Create versioned directory structure:
data/creators/{username}/posts/{post-id}/v{n}.md - Modify
pkg/files/manager.goto preserve previous versions on update - Add
GetPostVersion()andListPostVersions()methods to file manager
- Add
- Dependencies: None (foundational work)
- Goal Impact: Directly implements "Content versioning" feature claimed in README
- Acceptance: Post update creates new version file; previous version preserved;
go test ./pkg/files/...passes - Validation:
# Create post, update twice, verify 3 versions exist createon post publish testuser content.md -t "Test" createon post publish testuser content.md -t "Test v2" ls data/creators/testuser/posts/*/ # Should show v1.md, v2.md
Step 2: Add Version CLI Commands
- Deliverable: CLI commands for version management
- Add
post history [username] [post-id]subcommand inpkg/cli/post.go - Add
post revert [username] [post-id] [version]subcommand - Display version list with timestamps and sizes
- Add
- Dependencies: Step 1 (versioning storage)
- Goal Impact: Makes versioning user-accessible; completes the "Content versioning" feature
- Acceptance:
createon post historylists versions;createon post revertrestores content - Validation:
createon post history testuser test-post-id # Lists versions createon post revert testuser test-post-id 1 # Restores v1
Step 3: Complete Tag Filtering and Display
- Deliverable: Functional tags system
- Update
templates/post.htmlto render tags as clickable links - Add route
GET /c/{username}/tags/{tag}inpkg/cli/server.go - Implement
ListPostsByTag()inpkg/files/manager.gousingPostFilter.Tags - Add
post list --tag=<tag>CLI flag - Add tag cloud section to
templates/profile.html
- Update
- Dependencies: None (independent feature)
- Goal Impact: Completes "Tags and categories" feature; enables content discovery
- Acceptance: Tags visible on posts; clicking tag filters posts; CLI filters work
- Validation:
go-stats-generator analyze ./pkg/cli/server.go --skip-tests --format json | grep -c "handleTagFilter" createon post list testuser --tag=tutorial # Filters by tag curl http://localhost:8080/c/testuser/tags/tutorial # Returns filtered posts
Step 4: Complete Profile Customization
- Deliverable: Avatar and social link management
- Add
-a/--avatarand-s/--socialflags tocreator addinpkg/cli/creator.go - Add
creator updatecommand for modifying existing profiles - Add
POST /c/{username}/avatarendpoint for file uploads - Store avatars to
data/creators/{username}/avatar.{ext} - Serve avatars via
/assets/avatars/static route - Render social links in
templates/profile.html
- Add
- Dependencies: None (independent feature)
- Goal Impact: Completes "Profile customization" feature
- Acceptance:
creator add --avatar=./photo.jpg --social="twitter.com/x"works; profile displays both - Validation:
createon creator add testuser -n "Test" -a ./avatar.png -s "github.com/test" ls data/creators/testuser/avatar.* # Avatar file exists curl http://localhost:8080/c/testuser | grep -c "github.com/test" # Social link rendered
Step 5: Expand Test Coverage to Critical Paths
- Deliverable: Unit tests for untested packages
- Create
pkg/auth/auth_test.go:TestRegisterUser(success, duplicate email)TestLoginUser(success, wrong password, no user)TestSessionManagement(create, validate, expire)
- Create
pkg/cli/cli_test.go:TestCreatorAddCommandTestPostPublishCommandTestBackupRestoreRoundtrip
- Create
pkg/templates/templates_test.go:TestRenderMarkdown(GFM features)TestTemplateExecution(all templates render)
- Create
- Dependencies: Steps 1-4 (test new features)
- Goal Impact: Reduces regression risk; enables confident refactoring
- Acceptance:
go test -cover ./...reports >50% overall - Validation:
go test -cover ./... 2>&1 | grep "coverage" # Target: pkg/auth >70%, overall >50%
Step 6: Reduce Complexity Hotspots
- Deliverable: Refactor highest-complexity functions
- Extract
generatePaymentAddresses()helper fromCreateSubscription(15.3 → <12) - Extract
validateAndLoadSubscription()fromverifyAccessImpl(15.0 → <12) - Extract duplicated atomic write logic in
pkg/files/manager.go:135-144and167-176into sharedwriteAtomically()helper - Consider extracting HTTP handlers from
pkg/cli/server.gointopkg/handlers/if time permits
- Extract
- Dependencies: Step 5 (tests protect refactoring)
- Goal Impact: Improves maintainability; reduces bug surface
- Acceptance: No function with complexity >12; duplication ratio <0.3%
- Validation:
go-stats-generator analyze . --skip-tests --format json --sections functions,duplication 2>/dev/null | \ python3 -c "import sys,json; d=json.load(sys.stdin); \ high=[f['name'] for f in d['functions'] if f['complexity']['overall']>12]; \ print('High complexity:', high or 'None'); \ print('Duplication:', d['duplication']['duplication_ratio'])"
Dependency Graph
Step 1 (Versioning Core)
└── Step 2 (Version CLI)
└── Step 5 (Tests) ──→ Step 6 (Refactoring)
↑
Step 3 (Tags) ────────┘
Step 4 (Profiles) ────┘
Risk Assessment
| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| Versioning breaks existing posts | Low | High | Migrate existing posts to v1 on first access; add version detection |
| Test coverage slows development | Medium | Low | Prioritize critical paths (auth, subscription); defer CLI tests if needed |
| Refactoring introduces regressions | Medium | Medium | Complete Step 5 before Step 6; run tests continuously |
Dependency Status (No Action Required)
| Dependency | Version | Security Status |
|---|---|---|
| btcd | v0.24.2 | ✅ Patched (CVE-2024-38365 fixed) |
| go-monero-rpc-client | Dec 2024 | ✅ Maintained |
| cobra | v1.8.1 | ✅ Current |
| chi | v5.2.0 | ✅ Current |
| goldmark | v1.7.8 | ✅ Current |
| Go | 1.21.3 | ✅ Supported until ~Feb 2027 |
Success Criteria
Completing Steps 1-4 achieves 100% of README-stated features.
| Milestone | Steps | Verification |
|---|---|---|
| Content versioning complete | 1-2 | post history and post revert work |
| Tags feature complete | 3 | Posts filterable by tag via URL and CLI |
| Profile customization complete | 4 | Avatar and social links settable and visible |
| Test coverage threshold | 5 | go test -cover ./... reports >50% |
| Complexity reduced | 6 | No function with complexity >12 |
Estimated Effort
| Step | Effort | Notes |
|---|---|---|
| Step 1 | 4-6 hours | Core versioning logic; migration handling |
| Step 2 | 2-3 hours | CLI is straightforward with existing patterns |
| Step 3 | 3-4 hours | Route + template + filter logic |
| Step 4 | 3-4 hours | File upload adds complexity |
| Step 5 | 4-6 hours | Test writing is time-intensive |
| Step 6 | 2-3 hours | Mechanical refactoring with test safety net |
| Total | 18-26 hours | ~3-4 developer days |
What's inside
6 implementation steps, a dependency graph, risk assessment, dependency status table, success criteria, and estimated effort breakdown
Change this for your project
- Replace
createonwith your own binary name in all validation commands - Replace
data/creators/{username}/posts/with your own storage path - Replace
pkg/files/manager.gowith your own file manager package path
Where it goes
A standard operating procedure. Keep where the team or agent running the process will find it.
Worth borrowing
- Goal-achievement status table mapping stated features to current status and plan coverage
- Validation commands shown as executable bash snippets for each step
- Complexity hotspot list with function names and scores to guide refactoring priorities
Related Documents
Comprehensive AI Assistant Tools Reference
Lists 80+ tools with MCP server associations, bulk support, parallel capability, resource impact, and execution type for AI agent workflows.
iOS Deployment Guide
Walks through setting up an iOS development environment, building a Tauri app for iOS, and publishing to the App Store or alternative channels.
How to Add Resources to Your FastMCP Server
Teaches how to add static and dynamic MCP resources to a FastMCP server, with six ready-to-copy examples for a GitHub crawler.
PCI Compliance Guide
Explains PCI DSS compliance via tokenization, lists forbidden and allowed data, and provides code examples for BigCommerce and Stripe.