Thāyṃ is a robust and scalable e-commerce API built with GoLang, leveraging Hexagonal Architecture. This design pattern ensures that the application is maintainable and adaptable over time, with clear separation of concerns. The API provides essential features for managing e-commerce operations, including secure JWT authentication, email confirmation, advanced filtering capabilities, inventory management, role-based access control and sure payment gateway integration. Thāyṃ is designed to support multiple user roles such as Admin, User, and Store Owner, and allows for seamless product management, order tracking, and payment integrations. With its flexible and modular structure, Thāyṃ is ready to power a wide range of e-commerce applications while maintaining high performance and security.
- Configure Your .env File
Create and configure a .env file in your project directory with the following variables:
# Server
PUBLIC_HOST=
PORT=8085
# Database
DB_USER=root
DB_PASSWORD=root
DB_HOST=127.0.0.1
DB_PORT=3306
DB_NAME=ecom
# JWT
JWT_SECRET=
# SMTP for Gmail
FROM_EMAIL=
FROM_EMAIL_PASSWORD= # using passkey
FROM_EMAIL_SMTP="smtp.gmail.com"
SMTP_ADDR="smtp.gmail.com:587"
# Stripe
SECRET_KEY_STRIPE=
WEBHOOK_SECRET_STRIPE=
#Payment Variable
ORDER_STATUS_PENDING="pending"
ORDER_STATUS_PROCESSING="processing"
ORDER_STATUS_SHIPPED="shipped"
ORDER_STATUS_COMPLETED="completed"
ORDER_STATUS_CANCELLED="cancelled"
ORDER_STATUS_REFUNDED="refunded"
PAYMENT_STATUS_PENDING="pending"
PAYMENT_STATUS_PAID="paid"
PAYMENT_STATUS_REFUNDED="refunded"
- Build and Run the Project Using Docker Compose
docker-compose up --build
Once the project is built and the containers are running, you can access the API at:
API URL: http://localhost:8085
- Stop Containers
docker-compose down
Build
Compile the application and output the binary in the bin
directory:
make build
Run
Build and run the application:
make run
Once the project is built and the containers are running, you can access the API at:
API URL: http://localhost:8085
Generate a new migration file in the cmd/migrate/migrations
directory:
make migration <your_migration_name>
Apply Migrations
make migrate-up
Rollback Migrations
make migrate-down
- JWT Authentication: Secure authentication using JSON Web Tokens.
- Role-based Access Control: Supports roles such as Admin, User, and Store Owner.
- Email confirmation using custom HTML templates.
- Complete CRUD (Create, Read, Update, Delete) operations for user accounts.
- Advanced filtering by tags and categories.
- Search functionality for products and orders.
- Inventory management:
- Control product quantity
- Product stocking
- Activation and deactivation of products.
- Order management:
- Seamless integration with payment gateways.
- Tracking and updating order statuses.
- Supports mutliple payment providers (e.g., Stripe, Banks[can be configure])
- Secure transaction handling with encryption.
- Payment successfull Alerting mechanism
- Go 1.23.4: The core programming language.
- Hexagonal Architecture: Ensures separation of concerns and maintainability.
- go-playground/validator: Input validation.
- go-sql-driver/mysql: MySQL database driver.
- golang-jwt/jwt: JWT authentication.
- golang-migrate/migrate: Database migrations.
- gorilla/mux: HTTP request router.
- joho/godotenv: Environment variable management.
- stretchr/testify: Testing utilities.
- golang.org/x/crypto: Cryptographic functions.