Deployment Guide

1. Create Your Project

# Create new project
npm create cloudflare@latest my-farcaster-agent
cd my-farcaster-agent

# Get template code
git clone https://github.com/0xkoda/fagent.git
cp -r fagent/src/* src/

2. Set Up KV Storage

Create a KV namespace for your agent's memory:

# Create KV namespaces
npx wrangler kv:namespace create AGENT_KV
npx wrangler kv:namespace create AGENT_KV --preview

3. Configure Environment

Update your wrangler.toml:

# wrangler.toml
name = "farcaster-agent"
main = "src/index.js"
compatibility_date = "2023-01-01"
node_compat = true

[vars]
FARCASTER_FID = "your_fid"
FARCASTER_NEYNAR_SIGNER_UUID = "your_signer_uuid"
FARCASTER_NEYNAR_API_KEY = "your_neynar_key"
OPENROUTER_API_KEY = "your_openrouter_key"

[[kv_namespaces]]
binding = "AGENT_KV"
id = "your_kv_namespace_id"
preview_id = "your_preview_namespace_id"

4. Deploy

# Deploy to Cloudflare Workers
npx wrangler deploy