KitAI

Customization

Configure database providers and storage.

Database providers

KitAI supports PostgreSQL connections via:

  • Neon (DB_PROVIDER=neon)
  • Supabase (DB_PROVIDER=supabase)
  • Standard PostgreSQL (DB_PROVIDER=postgres)

Use the same DATABASE_URL variable and set the provider:

DATABASE_URL=postgresql://user:password@host:5432/database
DB_PROVIDER=neon
DB_POOL_SIZE=1

Neon

  • Use the Neon connection string from the Neon dashboard.
  • Recommended for serverless and edge-friendly usage.

Supabase

  • Use the Supabase pooling connection string.
  • Set DB_PROVIDER=supabase.

PostgreSQL

  • Use any standard PostgreSQL connection string.
  • Set DB_PROVIDER=postgres.

Storage (Cloudflare R2)

KitAI includes a presigned upload endpoint for Cloudflare R2.

Required variables:

R2_ACCOUNT_ID=your_account_id
R2_ACCESS_KEY_ID=your_access_key
R2_SECRET_ACCESS_KEY=your_secret_key
R2_BUCKET=your_bucket_name
R2_PUBLIC_URL=https://your-public-domain

Presigned upload

Use POST /api/storage/presign to get an upload URL:

const res = await fetch('/api/storage/presign', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    fileName: 'avatar.png',
    contentType: 'image/png',
  }),
});

const data = await res.json();

Response:

{
  "success": true,
  "data": {
    "key": "uploads/<user-id>/<timestamp>-avatar.png",
    "uploadUrl": "https://...",
    "publicUrl": "https://..."
  }
}

On this page