npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sftech/ai-orchestrator-db

v0.0.16

Published

A powerful TypeScript library for managing and persisting AI agent, prompt, and prompt history data in the context of the AI Orchestrator ecosystem. Built with Clean Architecture principles and designed for seamless integration with NestJS projects.

Readme

AI Orchestrator DB

A powerful TypeScript library for managing and persisting AI agent, prompt, and prompt history data in the context of the AI Orchestrator ecosystem. Built with Clean Architecture principles and designed for seamless integration with NestJS projects.


Table of Contents


Overview

ai-orchestrator-db provides a robust, modular, and extensible database layer for AI Orchestrator applications. It supports CRUD operations for agents, prompts, and prompt histories, and exposes RESTful controllers for easy API integration. The library is structured for testability, scalability, and maintainability.

Installation

Install via npm (from your monorepo root):

npm install @sftech/ai-orchestrator-db

Or, if using yarn:

yarn add @sftech/ai-orchestrator-db

Setup & Integration

Import the module into your NestJS application:

import { AiOrchestratorDbModule } from '@sftech/ai-orchestrator-db';

@Module({
  imports: [
    AiOrchestratorDbModule.register({
      // Provide your DB configuration and options here
    }),
  ],
})
export class AppModule {}

Core Concepts

  • Domain Layer: Contains core models (Agent, Prompt, PromptHistory) and interfaces for repositories and use cases.
  • Application Layer: Implements business logic via bundles and use cases (e.g., AgentCrudBundle, PromptCrudBundle).
  • Infrastructure Layer: Handles database entities, mappers, and repository implementations.
  • Presentation Layer: Exposes REST controllers, DTOs for request/response, presenters for formatting, and converters for mapping between DTOs and domain models.

Main Bundles & Controllers

  • AgentCrudBundle, PromptCrudBundle, PromptHistoryCrudBundle: Provide programmatic access to CRUD operations.
  • AgentCrudController, PromptCrudController, PromptHistoryCrudController: Expose REST endpoints for each entity.

Usage Examples

Agent CRUD

Create an Agent (programmatically):

import { IAgentCrudBundle } from '@sftech/ai-orchestrator-db';

@Injectable()
constructor(private agentCrudBundle: IAgentCrudBundle) {}

async createAgent() {
  const agent = await this.agentCrudBundle.createAgent({
    name: 'My Agent',
    description: 'Performs advanced tasks',
    // ...other properties
  });
  return agent;
}

REST API Example:

  • POST /agent with body matching AgentCreateRequestDto
  • GET /agent/:id
  • PUT /agent/:id
  • DELETE /agent/:id

Prompt CRUD

Create a Prompt:

await this.promptCrudBundle.createPrompt({
  agentId: '...',
  content: 'What is the weather today?',
  // ...other properties
});

REST API Example:

  • POST /prompt with body matching PromptCreateRequestDto

Prompt History CRUD

Add to Prompt History:

await this.promptHistoryCrudBundle.createPromptHistory({
  agentId: '...',
  promptId: '...',
  response: 'It is sunny.',
  // ...other properties
});

REST API Example:

  • POST /prompt-history with body matching PromptHistoryCreateRequestDto

DTOs, Presenters & Converters

  • DTOs: Define the shape of data for requests and responses (see src/presentation/dtos/).
  • Presenters: Format domain models for API responses (see src/presentation/presenters/).
  • Converters: Map between DTOs and domain models (see src/presentation/converters/).

Extending the Library

  • Add new entities by following the Clean Architecture structure: define models and interfaces in domain/, implement use cases in application/, create DB entities/mappers/repositories in infrastructure/, and expose via controllers/DTOs in presentation/.
  • You can override or extend existing bundles and controllers by providing your own implementations in your application module.

License

© 2025 SFTech. All rights reserved.