Skip to content

πŸ›οΈ E-Commerce REST APIs with Hexagonal Architecture v2

Notifications You must be signed in to change notification settings

Supakornn/hexagonal-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ E-Commerce REST APIs With GO

A modern e-commerce backend service built with Hexagonal Architecture in Go

πŸ“Œ Features

  • πŸ” Authentication & Authorization
  • πŸ‘₯ User Management
  • πŸ“¦ Product Management
  • πŸ›’ Order Processing
  • πŸ’³ Payment Integration
  • 🏷️ Category Management

πŸš€ Technologies

  • 🐹 Golang (Fiber) - Fast HTTP web framework
  • 🐳 Docker - Containerization
  • 🐘 PostgreSQL - Database

πŸ—οΈ Architecture

This project follows Hexagonal Architecture (Ports and Adapters) pattern:

  • core - Business logic and domain models
  • handlers - HTTP handlers (API endpoints)
  • repositories - Database interactions
  • services - Application services

πŸ“Š Database Schema

Database Schema

βš™οΈ Getting Started

Prerequisites

  • Go 1.20 or higher
  • Docker & Docker Compose
  • PostgreSQL

πŸ”§ Installation

  1. Clone the repository
git clone https://github.com/yourusername/hexagonal-go.git
  1. Navigate to project directory
cd hexagonal-go
  1. Run with Docker
docker-compose up -d

πŸ”§ Environment Setup

# Required environment variables
DB_HOST=localhost
DB_PORT=5432
DB_USER=postgres
DB_PASS=postgres
DB_NAME=ecommerce
JWT_SECRET=your-secret-key

πŸ›£οΈ API Endpoints

Users API

POST /api/v1/auth/register    # Register new user
POST /api/v1/auth/login       # Login user
GET /api/v1/users/profile     # Get user profile

Products API

GET /api/v1/products         # List all products
POST /api/v1/products        # Create product
GET /api/v1/products/:id     # Get product details
PUT /api/v1/products/:id     # Update product
DELETE /api/v1/products/:id  # Delete product

Orders API

POST /api/v1/orders         # Create order
GET /api/v1/orders          # List user orders
GET /api/v1/orders/:id      # Get order details

πŸ—οΈ Project Structure

.
β”œβ”€β”€ cmd/
β”‚   └── main.go
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ handlers/
β”‚   β”œβ”€β”€ repositories/
β”‚   └── services/
β”œβ”€β”€ tests/
β”œβ”€β”€ docker-compose.yml
└── README.md

About

πŸ›οΈ E-Commerce REST APIs with Hexagonal Architecture v2

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published