Manual Setup
Set up Hydra AI manually without using the CLI
Manual Setup Guide
While the CLI provides the easiest way to get started with Hydra AI, you can also set up everything manually. This guide walks you through the process step by step.
Prerequisites
- Node.js (v16+ recommended)
- NPM or Yarn or PNPM
- A Hydra AI account and API key
Installation
Install the Hydra AI package in your project:
Step 1: Environment Setup
- Create a
.env
file in your project root:
How to use the CLI to get your API key? →
- If you're using TypeScript, ensure your
tsconfig.json
includes:
Step 2: Create Hydra Client
Create a hydra-client.ts
file in your project:
Step 3: Component Integration
Create your main chat or interaction component:
Type Safety
To ensure type safety, we recommend using Zod schemas for your components. Here's how to set up your types:
See the Zod guide for more information on using Zod with Hydra AI.
Error Handling
Implement error boundaries for Hydra AI components:
Troubleshooting
Common issues you might encounter:
-
API Key Issues
Solution: Double-check your
.env
file and ensure the API key is correctly set. -
Component Registration Errors
Solution: Ensure you're not registering the same component multiple times.
-
Type Errors
Solution: Verify your component props match the registered prop types.
This manual setup gives you more control over the integration process and might be preferred for complex applications or when you need custom configuration options.