A gRPC-based microservice for handling e-commerce operations including user accounts, product management, cart functionality, and payments.
-
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
- Go
- gRPC/Connect
- PostgreSQL
- Protocol Buffers
- SQLC (for type-safe SQL)
- Sentry (for error tracking)
- AWS SDK v2
- JWT v5
- Zap Logger
.
├─ 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
- Go 1.24 or later
- PostgreSQL
- Node.js (for Prisma)
- Protocol Buffer Compiler
- Clone the repository:
git clone https://github.com/shopnexus/shopnexus-go-service.git
cd shopnexus-go-service- Install dependencies:
go mod download
npm install- Initialize the database:
make init-migrate- Generate required code:
make proto # Generate protobuf code
make sqlc # Generate SQL codeCreate 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"Development mode:
make devProduction mode:
APP_STAGE=production make runThe 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
This project is licensed under the MIT License - see the LICENSE file for details.
