E-Commerce Api for handling basic actions from business and customers perspective
Tech stack
- Postgres with typeorm and manual migrations
- Dockarized
- Local LLM - Ollama with mistral
- Install docker desktop
- Install node (project build with v22.8.0)
- Run following commands
npm install
make build
make up
make migration-create name=any-name-of-table
The LLM container doesn't pull any model by default, running below command you can pull model of your choice
curl -X POST \
-H "Content-Type: application/json" \
-d '{"name":"mistral"}' \
http://localhost:11434/api/pull
- Users
- GET
/users/all- Returns all app users - GET
/users?username=alice- Returns specific users - POST
/usersbody{"username":"bob", "name":"Bob La","email":"bob@gmail.com", "password": "test-password"}- Adds new user - POST
/users/updatebody{"username":"alice1", "name":"alice","email":"alice@gmail.com","password":"this-is-password"}- Updates user with provided username - DELETE
/users/1- Deletes user with id 1
- GET
- Jokes
- GET
/jokes- Returns joke using the local LLM (uses LLM mistral default)
- GET
Run below curl to get user
curl -i -X GET -H 'Content-Type: application/json' http://localhost:3000/users\?username=alice
Run below curl to insert user
curl -i -X POST -H 'Content-Type: application/json' -d '{"username":"bob", "name":"Bob La","email":"bob@gmail.com", "password": "test-password"}' http://localhost:3000/users
Run below curl to delete user by id
curl -i -X DELETE -H 'Content-Type: application/json' http://localhost:3000/users/4
Run below curl to get a joke from LLM
curl -i -X GET -H 'Content-Type: application/json' http://localhost:3000/jokes