| .. | ||
| cmd | ||
| internal/cmc | ||
| sql | ||
| static | ||
| templates | ||
| tmp | ||
| .air.toml | ||
| .env.example | ||
| go.mod | ||
| go.sum | ||
| goose.env.example | ||
| Makefile | ||
| MIGRATIONS.md | ||
| README.md | ||
| server | ||
| sqlc.yaml | ||
CMC Sales Go Application
Modern Go web application for CMC Sales system, designed to work alongside the legacy CakePHP application.
Architecture
- Backend: Go with Gorilla Mux for HTTP routing
- Database: sqlc for type-safe SQL queries
- Frontend: Go templates with HTMX for dynamic interactions
- Styling: Bulma CSS framework
- Database Driver: MySQL/MariaDB
Quick Start
Local Development
- Configure private module access (required for code.springupsoftware.com):
go env -w GOPRIVATE=code.springupsoftware.com
# If using SSH keys with git:
git config --global url."git@code.springupsoftware.com:".insteadOf "https://code.springupsoftware.com/"
- Install dependencies:
make install
- Copy environment variables:
cp .env.example .env
- Generate sqlc code:
make sqlc
- Run the server:
make run
Docker Development
From the project root:
# Standard build (requires Go 1.23+)
docker compose up cmc-go
# If you encounter Go version issues, use the legacy build:
# Edit docker-compose.yml to use: dockerfile: Dockerfile.go.legacy
Web Interface
The application provides a modern web interface accessible at:
- Home:
/- Dashboard with quick links - Customers:
/customers- Customer management interface - Products:
/products- Product catalog management - Purchase Orders:
/purchase-orders- Order tracking
Features
- Real-time search with HTMX
- Responsive design with Bulma CSS
- Form validation and error handling
- Pagination for large datasets
- CRUD operations with dynamic updates
API Endpoints
REST API endpoints are available under /api/v1:
Customers
GET /api/v1/customers- List customers (JSON)GET /api/v1/customers/{id}- Get customer by IDPOST /api/v1/customers- Create new customerPUT /api/v1/customers/{id}- Update customerDELETE /api/v1/customers/{id}- Delete customerGET /api/v1/customers/search?q={query}- Search customers
Products
GET /api/v1/products- List products (JSON)GET /api/v1/products/{id}- Get product by IDPOST /api/v1/products- Create new productPUT /api/v1/products/{id}- Update productDELETE /api/v1/products/{id}- Delete productGET /api/v1/products/search?q={query}- Search products
Purchase Orders
GET /api/v1/purchase-orders- List purchase orders (JSON)GET /api/v1/purchase-orders/{id}- Get purchase order by IDPOST /api/v1/purchase-orders- Create new purchase orderPUT /api/v1/purchase-orders/{id}- Update purchase orderDELETE /api/v1/purchase-orders/{id}- Delete purchase orderGET /api/v1/purchase-orders/search?q={query}- Search purchase orders
Health Check
GET /api/v1/health- Service health check
Development
Adding New Queries
- Add SQL queries to
sql/queries/ - Run
make sqlcto generate Go code - Create handler in
internal/cmc/handlers/ - Register routes in
cmd/server/main.go
Testing
make test
Building
make build
The binary will be output to bin/server