Quick Start Guide
Prerequisites
- Python 3.8+
- MongoDB instance
- Environment variables configured
Setup
-
Clone and navigate to the recommend service:
cd /Users/ericngo/Desktop/projects/dudu/recommend -
Install dependencies:
pip install -r requirements.txt
# or using uv
uv sync -
Configure environment variables:
cp .env.example .env
# Edit .env with your configuration -
Start the server:
python server.py
The API will be available at http://localhost:5051
First API Call
-
Get a JWT token:
python get_jwt_token.py -
Test the health endpoint:
curl http://localhost:5051/health -
Create a product:
curl -X POST "http://localhost:5051/api/products/upload" \
-H "Authorization: Bearer <your-jwt-token>" \
-H "Content-Type: application/json" \
-d '[{
"customer_id": "test_user",
"name": "Test Product",
"price": 99.99
}]' -
Get recommendations:
curl -X POST "http://localhost:5051/api/recommend/recommend" \
-H "Authorization: Bearer <your-jwt-token>" \
-H "Content-Type: application/json" \
-d '{
"sequence_data": {"preferences": ["electronics"]},
"task": "product_recommendation",
"template": "personalized"
}'
Next Steps
- Read the API Overview for detailed endpoint information
- Check Authentication for security details
- Review Products API for product management
- Explore Recommendations API for recommendation features