Use our npm package for easy integration with Node.js applications. The package provides a simple client for accessing your structured prompts.
Install the SuperPrompts package using npm or yarn:
npm install superpromptsyarn add superpromptsImport the package and create a client with your API key:
import { createPromptClient } from 'superprompts';
const client = createPromptClient('<API_KEY>');
// Get a prompt (all sections combined)
const systemPromptContent = await client.prompt('<PROMPT_ID>');
console.log(systemPromptContent);
// Returns all 7 sections combined in optimal orderCreates a new SuperPrompts client instance.
apiKey (string) - Your project API keyA client instance with methods to access your prompts
Retrieves a prompt by its ID. Returns the combined content of all 7 sections, ready to send to any AI provider.
promptId (string) - The ID of the prompt to retrievePromise<string> - The combined prompt content
import express from 'express';
import { createPromptClient } from 'superprompts';
const app = express();
const client = createPromptClient(process.env.SUPERPROMPTS_API_KEY);
app.get('/chat', async (req, res) => {
  try {
    // Get structured prompt (all sections combined)
    const systemPrompt = await client.prompt('customer-support-bot');
    // Use systemPrompt with your AI model
    res.json({ prompt: systemPrompt });
  } catch (error) {
    res.status(500).json({ error: 'Failed to fetch prompt' });
  }
});
app.listen(3000);import { createPromptClient } from 'superprompts';
import { NextResponse } from 'next/server';
const client = createPromptClient(process.env.SUPERPROMPTS_API_KEY!);
export async function GET() {
  try {
    const systemPrompt = await client.prompt('my-prompt');
    return NextResponse.json({ prompt: systemPrompt });
  } catch (error) {
    return NextResponse.json(
      { error: 'Failed to fetch prompt' },
      { status: 500 }
    );
  }
}import { createPromptClient } from 'superprompts';
import OpenAI from 'openai';
const promptClient = createPromptClient(process.env.SUPERPROMPTS_API_KEY);
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
async function chat(userMessage: string) {
  // Get structured prompt
  const systemPrompt = await promptClient.prompt('assistant');
  
  const completion = await openai.chat.completions.create({
    model: 'gpt-4',
    messages: [
      { role: 'system', content: systemPrompt },
      { role: 'user', content: userMessage }
    ]
  });
  
  return completion.choices[0].message.content;
}