A Chat based Order Management API
- Node & NPM
- Docker (optional)
$ git clone <repo_link>
$ cd into directory
$ create an `.env` file and copy the content of `.env.example` to the file.
$ update the content of the new `.env` as needed.
$ make docker-build
$ make install
$ make docker-up
Or check how to easily setup SQLite DB here: click here
$ npm install
$ npm run start:dev
If you got everything right, you should be able to access the API docs here: http://localhost:3000/api/v1/docs
If you got everything right, you should be able to access the web socket here: http://localhost:3000/api/v1/chat
- Connection is ony available via SocketIo
- Create an admin and a normal user account
- Create an order, which automatically creates a chat room for communication
- Obtain the Order Id and respective user ID
# User session:
http://localhost:3000/api/v1/chat?uid=<user_id>&oid=<order_id>
# Admin session:
http://localhost:3000/api/v1/chat?uid=<admin_id>&oid=<order_id>
If you find it difficult accessing the socket chat sessions, I have provided an HTML file in the root directory named chat.html
load the html file in your browser, load it again in an incognito window to isolate sessions, then enter in your respective IDs.
$ make run-test # unit tests
$ make run-e2e-test # e2e tests
⚠️ Find other Make commands in the Makefile located in the root directory
The combination of Docker and a Makefile is highly effective for local development because it simplifies and standardizes the development environment and workflows:
-
Environment Consistency:
- Docker ensures that the development environment is the same across all developers' machines by using containerized setups.
- This avoids "it works on my machine" problems caused by variations in local environments.
-
Simplified Commands:
- A Makefile abstracts complex Docker commands into simple, easy-to-remember targets (e.g.,
make build
,make run
,make test
). - Developers don't need to memorize or type long Docker commands.
- A Makefile abstracts complex Docker commands into simple, easy-to-remember targets (e.g.,
-
Automation:
- The Makefile can automate repetitive tasks like building images, starting containers, running tests, or cleaning up resources.
-
Efficiency:
- It reduces the learning curve for new developers by providing a clear set of instructions and standardized commands.
- Tasks are streamlined, improving productivity.
-
Integration:
- Docker handles dependencies, services (like databases), and runtime environments.
- The Makefile ties these together, ensuring smooth integration during local development.
By combining Docker for environment consistency and the Makefile for automation and simplicity, the combo creates a powerful and developer-friendly setup.
- If you dont use Docker, you're missing out. Learn about docker here: Docker Docs
- Learn about Makefile here: Makefile Docs
- My LinkedIn - LinkedIn