Manufacture System API
A Go REST API for users, customers, suppliers, products and purchases, protected with JWT.
- Category
- Business management API
- Stack
- Go
- Gorilla Mux
- JWT
- MySQL
- GitHub Actions
- Source
- shiinobu/manufacture-system-api
Overview
A Go REST API for managing core manufacturing data across users, customers, suppliers, products and purchase transactions.
At a glance
- JWT authentication
- Protected API routes
- Multi-domain business entities
- User, customer, supplier and product management
- Purchase transaction management
- MySQL persistence
- Environment-based configuration
- Centralized response helpers
- Automated testing
- GitHub Actions CI
- go test validation
- go vet validation
Problem and approach
Problem
Manufacturing workflows involve several related business entities that have to be managed consistently in one backend.
Approach
A Go REST API that splits each domain into its own controller and model, with authentication, database persistence and automated CI validation.
Architecture
Gorilla Mux routes requests, JWT protects the endpoints, controllers handle each domain, and MySQL stores the data.
API client
Sends requests to the API for authentication and business operations.
Gorilla Mux
Routes each request to the controller for the requested resource.
HTTP + JWT
Controller
Handles requests and coordinates operations for users, customers, suppliers, products and purchases.
route match
MySQL
Stores manufacturing entities and purchase data.
SQL
Implementation
- JWT authentication
- Authentication protects the API and identifies the requesting user.
- Several domains, one API
- The backend manages users, customers, suppliers, products and purchases.
- Structured controllers
- Each controller owns the HTTP operations for one business resource.
- MySQL persistence
- Manufacturing and purchase data are stored in MySQL as structured relational data.
- Environment configuration
- Configuration lives outside the source code, in environment variables.
- CI validation
- GitHub Actions runs the automated tests and Go static analysis.
Notes
Challenges
- Organizing several related business entities in one API
- Keeping HTTP behavior consistent across controllers
- Protecting routes with JWT authentication
- Managing relational manufacturing and purchase data
- Keeping quality up with automated CI validation
Status
Backed by automated tests, with GitHub Actions running go test and go vet.
Next project
Tourism Management API