Skip to content

shelajev/catalog-service-node-with-ai

 
 

Repository files navigation

Catalog Service - Node using AI

This is a Node.js-based application that leverages AI for generating and recommending products in a catalog system. The application seamlessly integrates with LangChain for AI processing, using Docker Model Runner as the execution framework

This repo is a demo project that demonstrates all of Docker's services in a single project.

This application uses Model Runner in Docker Desktop as the OpenAI compatible backend for AI used for product generation.

Check out AgentService.js to see how it configures the connection to the Model runner.

class AgentService {
  constructor() {
    const openAiApiUrl =
      process.env.OPENAI_API_URL ||
      "http://localhost:12434/engines/llama.cpp/v1";
    const openAiApiKey = process.env.OPENAI_API_KEY || "not-needed";
    const openAiModel = process.env.OPENAI_MODEL || "ai/qwen2.5:7B-Q4_K_M";

    this.model = new ChatOpenAI({
      openAIApiKey: openAiApiKey,
      configuration: {
        baseURL: openAiApiUrl,
      },
      modelName: openAiModel,
      temperature: 0.7,
    });
  }
...

Getting Started

  • Docker Desktop with Model Runner enabled
  • Enable host-side TCP support ( default port: 12434)
image

This project is currently configured to run all dependent services in containers and the AI model and the app natively on the machine (using Node installed on the machine).

To start the app, follow these steps:

  1. Ensure you have Node 22+ installed on your machine.

  2. Start all of the application dependencies

    docker compose up
  3. Install the app dependencies and start the main app with the following command:

    npm install --omit=optional
    npm run dev
  4. Once everything is up and running, you can open the demo client at http://localhost:5173.

Running tests

This project contains a few unit tests and integration tests to demonstrate Testcontainer usage. To run them, follow these steps (assuming you're using VS Code):

  1. Download and install the Jest extension.

  2. Open the "Testing" tab in the left-hand navigation (looks like a flask).

  3. Press play for the test you'd like to run.

The *.integration.spec.js tests will use Testcontainers to launch Kafka, Postgres & LocalStack.

Running tests via the command line

Or you can run the tests using the command line:

# Run all tests
$ npm test

# Run only unit tests
$ npm run unit-test

# Run only the integration tests
$ npm run integration-test

Additional utilities

Once the development environment is up and running, the following URLs can be leveraged:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 92.0%
  • CSS 5.6%
  • Shell 1.2%
  • Other 1.2%