Overview
This quickstart will guide you through building a simple AI-powered application using FF. You’ll create an Effect.ts program that:- Uses the AI SDK wrapper to generate text with typed callbacks
- Implements a tool with Effect.ts patterns
- Logs structured output with Effect’s logging
Prerequisites
Before starting, ensure you have:- Node.js 18+ or Bun 1.0+ installed
- An OpenAI API key (or another AI SDK-compatible provider)
This guide uses OpenAI, but FF works with any AI SDK provider (Anthropic, Google, etc.)
Step 1: Install Dependencies
1
Create a new project
2
Install FF and dependencies
3
Set up TypeScript
tsconfig.json:Step 2: Create Your First Effect Program
Create a file calledindex.ts:
index.ts
Step 3: Add Environment Variables
Create a.env file:
.env
index.ts to load environment variables:
Step 4: Run Your Application
Understanding the Code
Let’s break down what makes this FF code special:Effect.ts Integration
Typed Callbacks
- Access to Effect services and context
- Structured error handling
- Type-safe composition with other Effects
- Automatic fiber management
Tool Definition
- Database queries with Effect services
- Error handling with typed errors
- Logging and telemetry
- Access to your application context
Next Steps
Add Database Operations
Combine FF’s AI wrappers with Drizzle ORM:Manage Conversations
Add persistent conversation history with ff-ai:Build HTTP Services
Create HTTP endpoints that serve AI responses:Learn More
Explore the full capabilities of each package:ff-effect
AI SDK, Drizzle, Inngest, and oRPC wrappers
ff-ai
Conversation management and persistence
ff-serv
HTTP services, logging, and caching
Common Patterns
Error Handling
Service Integration
Concurrent Operations
Get Help
Need assistance?- Explore the package documentation for detailed guides
- Report issues on GitHub
- Explore Effect.ts documentation for core concepts