Skip to Content
DocsTutorialsBootstrap

Tutorial 0: Bootstrap Your First Project

Get started with VibeX in under 5 minutes.

This tutorial walks you through setting up a complete VibeX project from scratch.


Quick Start

The fastest way to get started is to clone the quick-start example:

# Clone the VibeX repository git clone https://github.com/tiwater/vibex.git cd vibex/examples/quick-start # Install dependencies pnpm install # Set up your environment cp env.example .env # Edit .env with your API key # Run the example pnpm start

Manual Setup

If you prefer to set up a project from scratch:

1. Create a New Project

mkdir my-vibex-project cd my-vibex-project pnpm init

2. Install Dependencies

# Install VibeX and dotenv for environment variables pnpm add vibex dotenv # Install TypeScript development dependencies pnpm add -D typescript tsx @types/node

3. Configure TypeScript

Create tsconfig.json:

{ "compilerOptions": { "target": "ES2022", "module": "ESNext", "moduleResolution": "bundler", "esModuleInterop": true, "strict": true, "skipLibCheck": true, "outDir": "dist" }, "include": ["src/**/*"] }

4. Set Up Environment Variables

Create a .env file with your API key:

# Choose your LLM provider # OpenAI OPENAI_API_KEY=sk-your-openai-key # Or Anthropic ANTHROPIC_API_KEY=your-anthropic-key # Or DeepSeek DEEPSEEK_API_KEY=your-deepseek-key

5. Create Your First Script

Create src/index.ts:

import "dotenv/config"; import { XAgent } from "vibex"; async function main() { console.log("🚀 Starting VibeX...\n"); // Create a new workspace const xAgent = await XAgent.start("My first VibeX project"); const space = xAgent.getSpace(); console.log(`✨ Created Space: ${space.spaceId}`); console.log(`📋 Goal: ${space.goal}\n`); // Chat with XAgent console.log("🤖 XAgent: "); const stream = await xAgent.streamText({ messages: [ { role: "user", content: "Hello! What can you help me with?" } ], metadata: { mode: "agent", requestedAgent: "X" }, }); for await (const chunk of stream.textStream) { process.stdout.write(chunk); } console.log("\n"); // Save the workspace await space.persistState(); console.log(`💾 Workspace saved! Space ID: ${space.spaceId}`); } main().catch(console.error);

6. Add Scripts to package.json

Update your package.json:

{ "name": "my-vibex-project", "type": "module", "scripts": { "start": "tsx src/index.ts", "dev": "tsx watch src/index.ts" } }

7. Run Your Project

pnpm start

You should see:

🚀 Starting VibeX... ✨ Created Space: space_abc123xyz 📋 Goal: My first VibeX project 🤖 XAgent: Hello! I'm XAgent, your AI assistant... 💾 Workspace saved! Space ID: space_abc123xyz

Project Structure

Your complete project should look like this:

my-vibex-project/ ├── src/ │ └── index.ts # Your main application ├── .env # API keys (don't commit this!) ├── .gitignore # Git ignore file ├── package.json # Project configuration └── tsconfig.json # TypeScript configuration

Create a .gitignore file:

node_modules/ dist/ .env *.log

LLM Provider Options

VibeX supports multiple LLM providers. Configure your preferred provider in .env:

ProviderEnvironment VariableModels
OpenAIOPENAI_API_KEYgpt-4o, gpt-4o-mini, gpt-4-turbo
AnthropicANTHROPIC_API_KEYclaude-3-5-sonnet, claude-3-opus
DeepSeekDEEPSEEK_API_KEYdeepseek-chat, deepseek-coder
GoogleGOOGLE_GENERATIVE_AI_API_KEYgemini-1.5-pro, gemini-1.5-flash

Troubleshooting

“API key not found” error?

  • Make sure your .env file exists and contains the correct key
  • Ensure dotenv/config is imported at the top of your file
  • Check that the environment variable name matches your provider

TypeScript errors?

  • Run pnpm add -D @types/node if you’re missing Node.js types
  • Make sure your tsconfig.json has "moduleResolution": "bundler"

“Cannot find module ‘vibex’” error?

  • Run pnpm install to ensure dependencies are installed
  • Check that vibex is listed in your package.json dependencies

Next Steps

Now that you have a working project:

  1. Experiment: Try different prompts and see how XAgent responds
  2. Learn: Continue to Tutorial 1: Your First Agent
  3. Explore: Check out the example projects 

Ready to dive deeper? Continue to Tutorial 1: Your First Agent! 🚀