This e-commerce REST API is built with Go and provides a robust backend for e-commerce applications. The API supports user authentication, product creation, product retrieve, and cart checkout functionality.
- User registration and login with JWT authentication.
- Product management (create, retrieve).
- Cart checkout process.
- Go - The primary programming language.
- PostgreSQL - Relational database management system.
- JWT (JSON Web Tokens) - For authorization and secure communication.
- Golang-Migrate - For database migrations.
- Validator - For data validation.
- Bcrypt - For password hashing.
- PQ - PostgreSQL driver for Go.
- Godotenv - For loading environment variables from .env files.
git clone git@github.com:vnsonvo/ecom-rest-api.git
cd ecom-rest-api
Copy the sample environment configuration file and edit it to suit your needs:
cp .env.sample .env
Edit .env and set your database connection details and JWT secret key.
Refer to this page migrate-cli
Ensure your PostgreSQL database is running, and then execute the following command to apply database migrations:
make migrate-up
Build and Run the Application
make run
Run the command
make test
docker-compose up --build
- Introduce a feature to manage user addresses. This will enable the storage of addresses for each user, which can then be dynamically used during the checkout process.
- Develop functionality to record and retrieve the history of orders placed by each user. This will allow orders to be stored and displayed within the user's profile area.
- Create an endpoint to cancel orders. This will provide users with the option to cancel their orders.
Contributions are welcome! Please feel free to submit a pull request.