Skip to main content

Quick Start Guide

Prerequisites

  • Python 3.8+
  • MongoDB instance
  • Environment variables configured

Setup

  1. Clone and navigate to the recommend service:

    cd /Users/ericngo/Desktop/projects/dudu/recommend
  2. Install dependencies:

    pip install -r requirements.txt
    # or using uv
    uv sync
  3. Configure environment variables:

    cp .env.example .env
    # Edit .env with your configuration
  4. Start the server:

    python server.py

The API will be available at http://localhost:5051

First API Call

  1. Get a JWT token:

    python get_jwt_token.py
  2. Test the health endpoint:

    curl http://localhost:5051/health
  3. 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
    }]'
  4. 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