{"id":22756283,"url":"https://github.com/devenock/go-shoppers-api","last_synced_at":"2026-05-05T23:34:05.997Z","repository":{"id":255741312,"uuid":"852182961","full_name":"devenock/go-shoppers-api","owner":"devenock","description":"Golang version of the shopper API.","archived":false,"fork":false,"pushed_at":"2025-01-08T05:28:22.000Z","size":47,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T07:43:05.402Z","etag":null,"topics":["gin","gin-framework","go","golang","gorm-orm","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devenock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-04T11:21:43.000Z","updated_at":"2025-01-08T05:28:26.000Z","dependencies_parsed_at":"2025-02-01T17:43:36.785Z","dependency_job_id":"d8ffb77c-5838-4b69-bb95-179c3f8db29e","html_url":"https://github.com/devenock/go-shoppers-api","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"2fe381981ba24a9f0632eca2969a5886eb346cd6"},"previous_names":["trend20/go-shoppers-api","devenock/go-shoppers-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devenock/go-shoppers-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenock%2Fgo-shoppers-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenock%2Fgo-shoppers-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenock%2Fgo-shoppers-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenock%2Fgo-shoppers-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devenock","download_url":"https://codeload.github.com/devenock/go-shoppers-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devenock%2Fgo-shoppers-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32672675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gin","gin-framework","go","golang","gorm-orm","sqlite"],"created_at":"2024-12-11T07:11:33.699Z","updated_at":"2026-05-05T23:34:05.983Z","avatar_url":"https://github.com/devenock.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Shoppers Backend API (Golang)**\n\n---\n\n## **Overview**\n\nThis project is a monolithic eCommerce backend API built with Go and the Gin framework. It provides a robust, scalable, and secure foundation for managing all eCommerce operations, including user authentication, product management, order processing, payment handling, and more. The application is designed with a modular structure, making it easy to maintain and extend.\n\n---\n\n## **Features**\n\n- **User Management**: User registration, login, profile management, and authentication using JWT.\n- **Product Catalog**: CRUD operations for products and categories, including search and filters.\n- **Cart Management**: Add, update, and remove items in the shopping cart.\n- **Order Management**: Order placement, tracking, and status updates.\n- **Payment Processing**: Integration with multiple payment gateways.\n- **Admin Panel**: Administrative endpoints for managing users, products, orders, and reports.\n- **Analytics and Reporting**: Sales reports, user activity, and inventory tracking.\n- **Notifications**: Email and SMS notifications for order updates.\n- **Security**: Follows best practices for data protection, authentication, and authorization.\n\n---\n\n## **Technology Stack**\n\n- **Language**: Go\n- **Framework**: Gin\n- **Database**: PostgreSQL (primary), Redis (caching), SQLite (for local development/testing)\n- **ORM**: GORM\n- **Authentication**: JWT\n- **Message Broker**: RabbitMQ (optional, for event handling)\n- **File Storage**: AWS S3 or local storage for product images\n- **Testing**: Go testing tools with mocks\n- **Docker**: Containerization for deployment\n\n---\n\n## **Project Structure**\n\n```plaintext\nproject/\n├── cmd/\n│   └── server/\n│       └── main.go             # Entry point of the application\n├── internal/                   # Application-specific business logic\n│   ├── modules/                # Modularized features\n│   │   ├── users/              # User module\n│   │   │   ├── controllers/    # Handles HTTP requests for users\n│   │   │   │   ├── user_controller.go\n│   │   │   ├── services/       # Contains business logic\n│   │   │   │   ├── user_service.go\n│   │   │   ├── repositories/   # Handles database interactions\n│   │   │   │   ├── user_repository.go\n│   │   │   ├── routes/         # Defines routes for the user module\n│   │   │   │   ├── user_routes.go\n│   │   ├── products/           # Product module\n│   │   │   ├── controllers/    # Handles HTTP requests for products\n│   │   │   │   ├── product_controller.go\n│   │   │   ├── services/       # Contains business logic\n│   │   │   │   ├── product_service.go\n│   │   │   ├── repositories/   # Handles database interactions\n│   │   │   │   ├── product_repository.go\n│   │   │   ├── routes/         # Defines routes for the product module\n│   │   │   │   ├── product_routes.go\n│   │   ├── orders/             # Order module\n│   │       ├── controllers/    # Handles HTTP requests for orders\n│   │       ├── services/       # Contains business logic\n│   │       ├── repositories/   # Handles database interactions\n│   │       ├── routes/         # Defines routes for the order module\n│   │\n│   ├── middlewares/            # Application-wide middleware\n│   │   ├── auth.go             # JWT authentication\n│   │   ├── logging.go          # Request/response logging\n│   │   ├── recovery.go         # Error recovery middleware\n├── pkg/                        # Shared libraries/utilities\n│   ├── config/                 # Application configuration\n│   │   ├── config.go           # Reads and parses environment variables\n│   ├── db/                     # Database initialization\n│   │   ├── postgres.go         # PostgreSQL connection\n│   │   ├── redis.go            # Redis connection\n│   ├── logger/                 # Centralized logging utility\n│   │   ├── logger.go\n│   ├── utils/                  # Helper functions used across modules\n│       ├── hash.go             # Password hashing\n│       ├── response.go         # JSON response helpers\n│       ├── validator.go        # Request validation\n├── tests/                      # Unit and integration tests\n│   ├── modules/\n│   │   ├── users/              # Tests for user module\n│   │   ├── products/           # Tests for product module\n│   │   ├── orders/             # Tests for order module\n│   ├── middlewares_test.go\n├── docs/                       # API documentation\n│   ├── swagger.yaml            # OpenAPI specification\n├── go.mod                      # Go module file\n├── go.sum\n└── README.md                   # Project documentation\n```\n\n---\n\n## **Installation**\n\n### Prerequisites\n- Go 1.20+\n- PostgreSQL\n- Redis (optional, for caching)\n- Docker (optional, for containerization)\n\n### Setup\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/your-username/ecommerce-backend.git\n   cd ecommerce-backend\n   ```\n\n2. Install dependencies:\n   ```bash\n   go mod tidy\n   ```\n\n3. Set up environment variables:\n   Create a `.env` file based on `.env.example` and configure the database, JWT secret, and other settings.\n\n4. Run database migrations:\n   ```bash\n   go run cmd/migrate/main.go\n   ```\n\n5. Start the server:\n   ```bash\n   go run cmd/server/main.go\n   ```\n\n6. Access the API at `http://localhost:8080`.\n\n---\n\n## **API Endpoints**\n\n### **Authentication**\n- `POST /auth/register`: Register a new user\n- `POST /auth/login`: User login\n- `GET /auth/profile`: Get user profile (requires token)\n- `PUT /auth/profile`: Update user profile\n\n### **Product Management**\n- `GET /products`: Get a list of products\n- `GET /products/:id`: Get product details\n- `POST /products`: Create a new product (Admin)\n- `PUT /products/:id`: Update a product (Admin)\n- `DELETE /products/:id`: Delete a product (Admin)\n\n### **Category Management**\n- `GET /categories`: Get a list of categories\n- `POST /categories`: Create a new category (Admin)\n- `PUT /categories/:id`: Update a category (Admin)\n- `DELETE /categories/:id`: Delete a category (Admin)\n\n### **Cart Management**\n- `GET /cart`: Get the user's cart\n- `POST /cart/add`: Add an item to the cart\n- `PUT /cart/update`: Update cart item quantity\n- `DELETE /cart/remove`: Remove an item from the cart\n\n### **Order Management**\n- `POST /orders`: Place an order\n- `GET /orders/:id`: Get order details\n- `GET /orders`: Get a list of user orders\n- `PUT /orders/:id/cancel`: Cancel an order\n\n### **Payment Processing**\n- `POST /payments/process`: Process a payment\n- `GET /payments/status/:id`: Get payment status\n\n### **Admin Operations**\n- `GET /admin/users`: List all users\n- `GET /admin/orders`: List all orders\n- `GET /admin/reports`: Generate reports\n\n---\n\n## **Best Practices**\n\n1. **Modular Design**:\n    - Each module has its own business logic, controllers, and routes, ensuring clean separation of concerns.\n\n2. **Secure Authentication and Authorization**:\n    - JWT for secure token-based authentication.\n    - Role-based access control for endpoints.\n\n3. **Database Transactions**:\n    - Wrap critical operations (e.g., order placement and payment) in transactions to ensure data consistency.\n\n4. **Error Handling**:\n    - Centralized error handling middleware for uniform responses.\n\n5. **Caching**:\n    - Use Redis for frequently accessed data like product listings.\n\n6. **Scalability**:\n    - Modular architecture allows easy scaling of individual components.\n\n7. **Logging**:\n    - Structured logging for debugging and monitoring.\n\n8. **Testing**:\n    - Write unit and integration tests for all critical paths.\n\n---\n\n## **Deployment**\n\n1. Build the application:\n   ```bash\n   go build -o ecommerce-backend ./cmd/server\n   ```\n\n2. Create a Docker image:\n   ```bash\n   docker build -t ecommerce-backend .\n   ```\n\n3. Run with Docker Compose:\n   ```bash\n   docker-compose up\n   ```\n\n---\n\n## **Contributing**\n\nWe welcome contributions! Please submit a pull request or create an issue for discussion.\n\n---\n\n## **License**\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n---\n\n## **Acknowledgments**\n\nSpecial thanks to the Go and Gin communities and contributors to the open-source libraries used in this project.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevenock%2Fgo-shoppers-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevenock%2Fgo-shoppers-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevenock%2Fgo-shoppers-api/lists"}