Warung-API is a backend system designed to manage and synchronize product data for an online convenience store. It handles the entire product lifecycle, including creation, management, and checkout, along with features like file uploading and auditing changes in the database.
Key Features:
- Product Management: Add, update, and delete products.
- Product Search: Search products by name, category.
- Product Details: View detailed information about products.
- File Uploading: Support for uploading products with Excel files (sample file available in the directory with file name :
ProductsData_100_Categories.xlsx
). - Audit Logs: Record update and delete operations in the database.
- Checkout: Handle the purchase of products, including adding to the cart, checking out, and processing the payment.
- REST API: Provides a RESTful API for interacting with the system.
This update includes the Checkout functionality, which typically involves adding products to a cart, checking out, and possibly processing payment. Let me know if you need further changes or clarifications!
System Components:
- Nest.js Framework for backend development.
- TypeORM for database interaction with PostgreSQL.
- PostgreSQL for storing product data and audit logs.
- Docker for containerization and deployment.
products
(stores product details)
audit_logs
(stores records of updates and deletions)
checkouts
(stores checkout details)
Requirement | Version |
---|---|
NodeJS | >= 20.15 |
PostgreSQL | >= 15 |
-
Clone Repository
$ git clone https://github.com/programmerShinobi/warung-api
-
Go to Project Folder
$ cd warung-api
-
Create a
.env
file, then copy the contents from the.env.example
file to the new.env
file. -
Create Uploads Directory
$ mkdir uploads
-
Install Dependencies
$ yarn install
-
Set up PostgreSQL Database and Run Migrations
$ yarn run migration:run
-
Run the Web Server:
-
For Development:
$ yarn start
-
Watch Mode:
$ yarn start:dev
-
For Production Mode:
$ yarn build $ yarn start:prod
-
You can explore the API documentation using Swagger at:
- URL:
http://127.0.0.1:3000/api
Or you can access in the directory with filename : warung-api.postman_collection.json
- GET /v1/product - List all products with search and pagination.
- GET /v1/product/:id - Get details of a specific product.
- POST /v1/product - Create a new product.
- PATCH /v1/product/:id - Update an existing product.
- DELETE /v1/product/:id - Delete a product.
- POST /v1/product/upload - Upload product with excel file.
- POST /v1/checkout - Create checkout products.
- PATCH /v1/checkout/:id/confirm - Confirm checkout products.
- GET /v1/checkout/:userId - Get checkouts by user ID.
To run the application using Docker:
-
Build the Docker image:
$ sh build.sh
-
Access the application via
http://localhost:3000
.
- Faqih Pratama Muhti
This version focuses on managing a product catalog, including search, upload, and logging features. Let me know if you need further modifications or additional features!