Skip to content

shopnexus/shopnexus-server

Repository files navigation

Shopnexus Go Service

wakatime Lines of Code Quality Gate Status

A gRPC-based microservice for handling e-commerce operations including user accounts, product management, cart functionality, and payments.

Flow

Features

  • Account Management

    • User registration and authentication
    • Admin account management
    • JWT-based authentication
    • Role-based access control
  • Product Management

    • Product model and inventory tracking
    • Brand management
    • Product categorization with tags
    • Image management for products and brands
  • Shopping Cart

    • Add/remove items
    • Cart management
    • Checkout process
  • Payment Processing

    • Multiple payment methods (Cash, Momo, VNPay)
    • Order tracking
    • Payment status management

Technology Stack

  • Go
  • gRPC/Connect
  • PostgreSQL
  • Protocol Buffers
  • SQLC (for type-safe SQL)
  • Sentry (for error tracking)
  • AWS SDK v2
  • JWT v5
  • Zap Logger

Project Structure

.
├─ cmd/
│ └── main.go # Service entry point
├── config/ # Configuration management
│ ├── config.dev.yml
│ ├── config.example.yml
│ └── config.production.yml
├── gen/ # Generated code
│ └── sqlc/ # Generated sqlc code
├── internal/
│ ├── logger/ # Logging configuration
│ ├── model/ # Domain models
│ ├── repository/ # Database operations
│ ├── server/ # Server implementation
│ └── service/ # Business logic
└── Makefile # Build and development commands

Getting Started

Prerequisites

  • Go 1.24 or later
  • PostgreSQL
  • Node.js (for Prisma)
  • Protocol Buffer Compiler

Installation

  1. Clone the repository:
git clone https://github.com/shopnexus/shopnexus-go-service.git
cd shopnexus-go-service
  1. Install dependencies:
go mod download
npm install
  1. Initialize the database:
make init-migrate
  1. Generate required code:
make proto    # Generate protobuf code
make sqlc     # Generate SQL code

Configuration

Create a .env file in the root directory with the following variables:

DATABASE_URL="postgresql://user:password@localhost:5432/shopnexus?schema=public"
APP_STAGE="development"
JWT_SECRET="your-secret-key"

Running the Service

Development mode:

make dev

Production mode:

APP_STAGE=production make run

API Documentation

The service exposes gRPC endpoints for:

  • Account Service: User/Admin authentication and management
  • Product Service: Product and inventory management
  • Cart Service: Shopping cart operations
  • Payment Service: Payment processing

For detailed API documentation, refer to the proto files in the https://github.com/shopnexus/shopnexus-protobuf

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Shopnexus go service (old). Remasted version: https://github.com/shopnexus/shopnexus-remastered

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published