This project is a microservices-based application built using Go. It consists of three microservices: User Service, Product Service, and Order Service.
The architecture of the application is illustrated below:
graph TD;
A[User Service] --> B[Database]
C[Product Service] --> D[Database]
E[Order Service] --> F[Database]
A --> G[API Gateway]
C --> G
E --> G
G --> H[Client]
- User Service: Manages user data and authentication.
- Product Service: Handles product information and inventory.
- Order Service: Manages order processing and status updates.
- Go 1.16 or higher
- PostgreSQL
-
Clone the repository:
git clone https://github.com/ozturkeniss/GoMicro-ThreeLayered cd gomicro-app -
Install dependencies:
go mod download
-
Set up environment variables:
- Create a
.envfile in the root directory and add necessary environment variables.
- Create a
-
Run the services:
go run user-service/main.go go run product-service/main.go go run order-service/main.go
-
User Service:
POST /api/users/register: Register a new userPOST /api/users/login: Login a userGET /api/users/:id: Get user detailsPUT /api/users/:id: Update user detailsDELETE /api/users/:id: Delete a userGET /api/users/: List all usersGET /api/health: Health check
-
Product Service:
POST /api/products/: Create a new productGET /api/products/:id: Get product detailsPUT /api/products/:id: Update product detailsDELETE /api/products/:id: Delete a productGET /api/products/: List all productsGET /api/products/search: Search for productsPUT /api/products/:id/stock: Update product stockGET /api/health: Health check
-
Order Service:
POST /api/orders/: Create a new orderGET /api/orders/:id: Get order detailsPUT /api/orders/:id: Update order detailsDELETE /api/orders/:id: Delete an orderGET /api/orders/: List all ordersPUT /api/orders/:id/status: Update order statusGET /api/health: Health check
This project is licensed under the MIT License - see the LICENSE file for details.