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 API key from The Prompting Company dashboard:- Go to API Keys Settings: Visit The Prompting Company API Keys Page
- Create New Key: Click “Create New API Key”
- Copy the Key: Save the generated API key securely (it will only be shown once)
Finding Your Organization and Product Slugs
Both your organization slug and product slug can be found on the API Keys Settings page. The current organization slug and product slugs are displayed there for easy reference when setting up your SDK configuration.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.