Implemented using go-fiber, postgres and sqlc.
-
The first
db/
contains all the SQL queries with/migration/
including the db migration and/queries/
having all the required SQL queries used in this application. -
cmd/
contains the entry point of the application -
pkg/
contains the application code which is further divided into/controllers/
,/services/
and/repositories/
as per the MVC pattern. -
internal/
is used for utilities like finding the unique elements in a slice, implementing a simplistic DI mechanism, handling JWT, etc.
First build the fiber application
docker compose build fiber-application
Then the postgres container is put up
docker compose up db
Then the fiber container is put up
docker compose up fiber-application
POST api/v1/admin/products
- To add products.DELETE api/v1/admin/products
- To delete products based on idPOST api/v1/admin/categories
- To add categories.GET api/v1/admin/orders
- To get all the orders based on id and statusPOST api/v1/login
- To loginPOST api/v1/register
- To signupGET api/v1/profile
- To get the current user and all his ordersGET api/v1/products
- To get the default list of productsGET api/v1/products/search
- To search products based on name and category idGET api/v1/cart
- To get the current order, with the product id and total costPOST api/v1/cart
- To add items to cartPOST api/v1/checkout
- To checkout items in cart