Installation
Get up and running with The Prompting Company TypeScript SDK in your Next.js or Node.js project.Prerequisites
Before installing the SDK, ensure you have:- Node.js version 18.0 or higher
- npm, yarn, or pnpm package manager
- A Next.js project (recommended) or Node.js application
Install the SDK
Choose your preferred package manager:- npm
- yarn
- pnpm
Environment Setup
Create a.env.local file in your project root and add your configuration:
The SDK automatically reads the
TPC_API_KEY environment variable, so you don’t need to pass it explicitly in your code configuration.Getting Your API Key
You’ll need to create an organization-scoped API key from The Prompting Company dashboard:- Open your organization: Sign in to The Prompting Company and select the organization workspace for your integration.
- Go to API Keys Settings: Visit
https://app.promptingco.com/{orgSlug}/settings/api-keys, replacing{orgSlug}with your organization slug. - Create New Key: Click “New API key”, name the key, and grant the minimum scopes your integration needs.
- Copy the Key: Save the generated API key securely. It will only be shown once.
Finding Your Organization and Product Slugs
Your organization slug is part of the organization URL:https://app.promptingco.com/{orgSlug}. Product slugs are available from the
product URL after opening a product in that organization.
TypeScript Configuration
If you’re using TypeScript, the SDK includes built-in type definitions. No additional configuration is required, but you can enhance your experience by adding these compiler options to yourtsconfig.json:
Verify Installation
Create a simple test file to verify your installation:Next.js Configuration
For Next.js applications, you may want to configure the SDK in a utility file:Troubleshooting
Common Issues
Module not found error:- Ensure you’ve installed the package correctly
- Restart your development server after installation
- Verify your
.env.localfile is in the project root - Check that variable names match exactly
- Restart your development server after changing environment variables
- Make sure you’re using TypeScript 4.5 or higher
- Verify your
tsconfig.jsonincludes the necessary compiler options
Next Steps
Now that you have the SDK installed, let’s build your first integration:Quick Start Guide
Build your first integration and start accessing your documentation data.