This is an e-commerce project built with Go. The project aims to provide a robust and scalable platform for online shopping.
For a complete rundown of the bigger picture as well as the stack used visit: Architecture
ecommerce/
├── bin/ # Compiled binaries
├── cmd/ # Main applications for the project
│ └── ecommerceBackend/ # Backend application
│ └── main.go # Entry point of the application
├── docs/ # Documentation files
├── internal/ # Private application and library code
│ ├── api/ # Routes and database connection pool
│ ├── app/ # Main application
│ │ └── server.go # Code for creating and running the server
│ ├── database/ # Database related files
│ ├── helpers/ # Helper functions and utilities
│ └── types/ # Type definitions and database models
├── .gitignore # Git ignore file
├── go.mod # Go module file
├── README.md # Project README file
├── .env # Environment variables file
└── LICENSE # Project license file
To get started with the project, follow these steps:
-
Clone the repository:
git clone https://github.com/GRACENOBLE/ecommerce.git cd ecommerce
-
Install dependencies:
go mod tidy
-
Run the application:
go run cmd/ecommerceBackend/main.go
-
Build binaries for multiple platforms:
You can use the provided script to build binaries for Linux, macOS, and Windows. Create a file named
build.sh
in the root of your project and add the following content:#!/bin/bash set -e # Define target architectures in the format "GOOS/GOARCH" targets=("linux/amd64" "darwin/amd64" "windows/amd64") # Loop through each target for target in "${targets[@]}"; do # Split the target into OS and architecture IFS="/" read -r goos goarch <<< "$target" # Define output binary name (adjust path and name as needed) output="bin/ecommerceBackend-${goos}-${goarch}" echo "Building for $goos/$goarch..." # Set environment variables and build GOOS=$goos GOARCH=$goarch go build -o "$output" ./cmd/ecommerceBackend done echo "Builds completed!"
Make the script executable:
chmod +x build.sh
Run the script to build the binaries:
./build.sh
-
Environment variables:
Ensure you have a
.env
file in the root of your project with the necessary environment variables configured.
You are now ready to start developing and contributing to the project!
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT LICENSE.