[This app is a WIP. Please refer to below for things that work / don't work]
- all server apis
- GET_PRODUCT
- LIST_PRODUCTS
- CREATE_PRODUCT
- EDIT_PRODUCT
- DELETE_PRODUCT
- UPLOAD_PHOTO
- frontend
- display products
- display single product
- create product (no image link)
- frontend elements
- upload product image
- update product
- delete product
- improving UI flow
- redis caching get requests and invalidating cache when update / deletion happens
Consists of a dockerized NextJS application. To run the nextjs application, please refer to the instructions in [How to setup Dev Environment]. The frontend will be ran together with the backend.
Consists of the following (dockerized) applications:
- node/express server
- has the following endpoints:
- list products (
GET http://localhost:4000/api/v1/products
) - get product by Id (
GET http://localhost:4000/api/v1/product/{id}
) - add product (
POST http://localhost:4000/api/v1/product
)body: { "name" : "product y22", "description" : "test desc", "image_url": "https://www.test.com", "price" : 15.00 }
- update product (
PUT http://localhost:4000/api/v1/product/{id}
) - delete product (
DELETE http://localhost:4000/api/v1/product/{id}
)
- list products (
- has the following endpoints:
- postgres SQL (dockerized instance)
- minio (dockerized instance)
- redis (dockerized instance) - not used with server yet
- Fork / Clone the repository
- Navigate into the folder
$ cd grocery-store-admin-app
- Create an
.env
file in the/server
folder (by copying .env.template)$ cd server/ $ cp .env.template .env $ (update values in .env file) - for minio accessKeys, use the ui after app is running
- Navigate to root directory and start applications using docker compose
cd .. $ docker-compose -f docker-compose-dev.yml up --build
- The applications should run successfully with 5 products created. They should look like that when running
docker ps
IMAGE PORTS NAMES postgres:10.5 0.0.0.0:5432->5432/tcp grocery-store-db grocery-store-admin-app-client 0.0.0.0:3000->3000/tcp grocery-store-fe grocery-store-admin-app-server 0.0.0.0:4000->4000/tcp grocery-store-server bitnami/minio:2022 0.0.0.0:9000-9001->9000-9001/tcp grocery-store-bucket redis:latest 0.0.0.0:6379->6379/tcp grocery-store-cache
- If the application fails to insert products / create the database, it might be due to the server trying run the migration files before the database is done initializing. In that case, we can manually ssh into the server and run the migration files manually.
$ docker exec -it grocery-store-server bash
$ sh ./build/init_db.sh