Skip to main content

Welcome to FF

FF is a collection of Effect.ts utilities that bring typed, composable patterns to AI development, database operations, and HTTP services. Built on top of Effect.ts, FF provides compile-time safety and functional patterns for modern TypeScript applications.

Core Philosophy

FF embraces Effect.ts as a foundation for building reliable, type-safe applications. Each package in the FF ecosystem provides:
  • Type Safety: Compile-time guarantees for database transactions, AI callbacks, and HTTP handlers
  • Composability: Build complex workflows from small, testable Effect primitives
  • Error Handling: Structured error types that integrate with Effect’s error channel
  • Service Integration: Seamless integration with popular libraries like Drizzle ORM, AI SDK, Inngest, and oRPC

The FF Ecosystem

Key Features

AI SDK Integration

Wrap AI SDK’s generateText, streamText, and tool with Effect.ts patterns. Use typed callbacks that return Effects instead of Promises:
import { generateText } from 'ff-effect/for/ai';

const result = yield* generateText({
  model: openai('gpt-4'),
  prompt: 'Hello!',
  onFinish: (event) => Effect.log(`Generated: ${event.text}`),
});

Compile-Time Transaction Safety

Drizzle transactions with Effect.ts enforce transaction boundaries at compile time:
import { createDrizzle } from 'ff-effect/for/drizzle';

const { db, tx, withTransaction } = createDrizzle(createClient);

// tx() only works inside withTransaction - enforced at compile time
const program = withTransaction(
  tx((client) => client.insert(users).values({ name: 'Alice' }))
);

Conversation Management

Manage AI conversations with automatic message persistence and usage tracking:
import { createTurnHandler } from 'ff-ai';

const handler = yield* createTurnHandler({
  identifier: { resourceId: 'user-123', threadId: 'conv-456' },
});

const history = yield* handler.getHistory({ windowSize: 10 });
yield* handler.saveUserMessage(userMessage);

HTTP Server Utilities

Build HTTP servers with structured logging and Effect.ts error handling:
import { basicHandler, createFetchHandler } from 'ff-serv';

const handler = basicHandler('/api/hello', (request) =>
  Effect.gen(function* () {
    yield* Effect.log('Handling request');
    return new Response('Hello!');
  })
);

Why Effect.ts?

Effect.ts provides a powerful foundation for building reliable TypeScript applications:
  • Type-Safe Effects: Model side effects explicitly in the type system
  • Composable Services: Build applications from small, testable services
  • Structured Concurrency: Safe concurrent programming with fibers
  • Error Management: First-class support for typed errors
  • Resource Safety: Automatic cleanup with scopes
FF builds on these primitives to provide domain-specific utilities for AI, databases, and HTTP services.

Who is FF For?

FF is designed for TypeScript developers who:
  • Want compile-time safety for database transactions and AI operations
  • Prefer functional programming patterns with Effect.ts
  • Need structured error handling and logging in production systems
  • Build AI-powered applications with conversation management
  • Work with Drizzle ORM, AI SDK, Inngest, or oRPC

Get Started

Ready to build with FF? Check out our installation guide or jump straight to the quickstart to see FF in action.

Quickstart

Get up and running with FF in less than 5 minutes