This project is a high-performance and scalable E-Commerce backend API built using Go (Golang) and the Fiber web framework. It is designed to efficiently handle user authentication, product management, shopping carts, orders, and more. The system ensures speed, security, and scalability, making it ideal for production-grade applications.
Technology | Purpose | Why? |
---|---|---|
Go (Golang) | Backend Language | High performance, concurrency support, efficient memory management |
Fiber | Web Framework | Fast and lightweight, optimized for high-speed APIs |
GORM | ORM for Database | Simplifies database operations, provides robust query capabilities |
PostgreSQL/MySQL | Database | Reliable, scalable, and supports complex queries |
Bcrypt | Password Hashing | Ensures secure storage of user credentials |
JWT (JSON Web Token) | Authentication | Secure and scalable authentication mechanism |
Docker (Planned) | Containerization | Ensures consistency across environments |
C:\Go-Lang\ecommerce-backend
│── internal/
│ ├── config/ # Database & App Configurations
│ ├── models/ # Data Models (User, Product, Order, etc.)
│ ├── handlers/ # API Handlers (Business Logic)
│ ├── routes/ # Route Definitions
│── pkg/ # Utility Functions (Helper Methods, Middleware, etc.)
│── main.go # Entry Point (Main.go)
│── .env # Environment Variables (Database URL, Secrets, etc.)
│── go.mod # Go Module File
│── TODO.md # Pending Tasks & Features
│── README.md # Project Documentation
- Secure user registration with Bcrypt password hashing.
- JWT-based authentication for secure API access.
- User roles (Admin & Customer) to restrict access to specific actions.
- CRUD operations for products (Add, Update, Delete, Fetch).
- Admin-only access for adding and updating products.
- Users can browse the product catalog.
- Users can add, remove, and update cart items.
- The cart persists per user and is linked to their account.
- Users can checkout their cart, converting it into an order.
- Orders contain order items, total price, and status.
- Admin can update order status (e.g., Pending → Shipped → Delivered).
- Users can view their past orders with details.
- Each order includes ordered items, prices, and status updates.
🔜 Payment Integration (Stripe/PayPal for secure transactions)
🔜 Admin Dashboard (For managing products & orders)
🔜 Docker Support (For easy deployment & environment consistency)
🔜 Unit Testing & API Testing (Ensuring reliability)
git clone https://github.com/your-username/ecommerce-backend.git
cd ecommerce-backend
go mod tidy
Create a .env
file and configure the database connection:
DB_HOST=localhost
DB_PORT=5432
DB_USER=root
DB_PASSWORD=yourpassword
DB_NAME=ecommerce_db
JWT_SECRET=your-secret-key
go run migrate.go
go run main.go
API will be running at: http://localhost:8000
Method | Endpoint | Description |
---|---|---|
POST | /ecom/auth/register |
Register a new user |
POST | /ecom/auth/login |
Authenticate user & get JWT token |
Method | Endpoint | Description |
---|---|---|
POST | /ecom/products |
Add a new product (Admin only) |
GET | /ecom/products |
Get all products |
PUT | /ecom/products/:id |
Update product (Admin only) |
DELETE | /ecom/products/:id |
Delete product (Admin only) |
Method | Endpoint | Description |
---|---|---|
POST | /ecom/cart |
Add item to cart |
GET | /ecom/cart |
View cart items |
DELETE | /ecom/cart/:id |
Remove item from cart |
Method | Endpoint | Description |
---|---|---|
POST | /ecom/orders |
Checkout cart & place order |
GET | /ecom/orders |
Get user order history |
PUT | /ecom/orders/:id/status |
Update order status (Admin only) |
- RAHUL SHEKHAWAT(Lead Developer)
- Open to contributors! Feel free to submit PRs.
This project is open-source and licensed under the MIT License.
📢 Have suggestions or improvements? Feel free to open an issue or contribute! 🚀