How ccap-project/configmanager works
Project type and purpose
• This is a monolithic, backend-focused RESTful service in Go, generated via go-swagger, plus a minimal static HTML/JS UI.
• Its purpose is to manage “cells,” “components,” “customers,” “networks,” etc., storing relationships in a Neo4j graph database.
File structure
• cmd/config-manager-server/main.go – application entry point (initializes config, HTTP server).
• etc/config.yaml – runtime configuration (DB URL, ports, credentials).
• restapi/… – go-swagger generated server stub, routers, operations for every resource (cell, component, customer, host, etc.).
• handlers/… – your HTTP handlers (“controllers”), wiring swagger operations to business logic.
• models/… – domain structs (Customer, Cell, Network, etc.) auto-generated to match Swagger spec plus ULID helpers.
• neo4j/main.go – Neo4j driver initialization and DB session management.
• html/index.html & html/root.js – static single-page UI served by the same binary.
• util/util.go – shared helper functions (error formatting, common utilities).
• swagger/swagger.yml – API specification (source of truth).
• Makefile, govendor, swagger scripts – build and codegen tooling.
README
• Instructs on syncing dependencies via govendor.
• Instructs on regenerating server stubs/models with go-swagger.
A. HTTP/API Layer
– go-swagger router (restapi/server.go)
– Supports Swagger UI under /swagger/ui and JSON spec at /swagger.yaml
B. Controller/Handler Layer
– handlers/*.go implement business operations per resource
C. Domain Model Layer
D. Persistence Layer
– neo4j/*: Neo4j driver, session management, Cypher query wrappers
E. Configuration
– etc/config.yaml loaded at startup (DB credentials, server port)
F. Static UI
– html/index.html & root.js served via an embedded file server
– govendor for vendoring
– go-swagger codegen (swagger generate server …)
1. Client (browser or API client) → HTTP Server
2. HTTP Server → Swagger router → specific Operation handler
3. Handler → Domain model validation → Calls Persistence layer
4. Persistence layer → Neo4j DB → returns records
5. Handler → transforms DB records into models → writes HTTP response
6. Static UI requests index.html → served from binary → JS calls API endpoints
Architectural patterns & principles
• “MVC-light”:
– C: swagger router + handlers
– M: models/*.go
– V: JSON over HTTP, plus static HTML/JS
• Hexagonal/Ports & Adapters:
– Adapters: HTTP transport (swagger), Neo4j driver
– Core: business logic in handlers + util
• Single-process monolith (no separate microservices)
Technologies & frameworks
• Go language
• go-swagger (0.13.0) – API spec, server stub generation
• Neo4j (graph database) via official Go driver
• govendor – dependency management
• Embedded static assets (html, JS) in Go binary
Final checklist
• All main runtime components shown (HTTP, Handlers, Models, DB, UI, Config).
• Optional: note the codegen step off to the side, showing swagger.yml → Go code.