BlueForge Docs

client.projects.create

Create a new platform project via the SDK.

Signature

class Client {
  projects: {
    create(input: CreateProjectInput): Promise<Project>
  }
}

interface CreateProjectInput {
  name: string
  plan?: 'free' | 'starter' | 'pro' | 'team'
  region?: 'eu' | 'sea' | 'us'
}

interface Project {
  id: string
  name: string
  slug: string
  status: 'provisioning' | 'ready' | 'error'
  plan: string
  created_at: string
}

Throws

ErrorCondition
ValidationError
name
missing or empty
RateLimitError
>100 req/min
AuthError
Invalid or expired API key
ConflictError
Project name already exists

Examples

Basic:

import { Client } from "@blueforge/client"
const client = new Client({ apiKey: process.env.BF_API_KEY! })
const project = await client.projects.create({ name: "my-project" })
console.log(project.id) // "prj_xxxxx"

With plan + region + error handling:

import { Client, RateLimitError, ValidationError } from "@blueforge/client"
try {
  const project = await client.projects.create({
    name: "my-project",
    plan: "pro",
    region: "eu",
  })
} catch (e) {
  if (e instanceof ValidationError) throw new Error(`bad input: ${e.message}`)
  if (e instanceof RateLimitError) await sleep(e.retryAfter * 1000)
  throw e
}

Poll until ready:

const project = await client.projects.create({ name: "my-project" })
while (project.status === 'provisioning') {
  await sleep(2000)
  project = await client.projects.get(project.id)
}
console.log(`Project ready: ${project.id}`)

Pitfalls

  • Credentials not returned — unlike the REST API, the SDK create response does NOT include connection strings. Use
    client.projects.get(id)
    for status.
  • Async provisioning — the
    status
    field will be
    provisioning
    initially. Poll
    client.projects.get(id)
    until
    ready
    .
  • Rate limits apply — 100 req/min per API key. The SDK auto-retries on 429 with exponential backoff when configured.

See also

{auto-injected}

Tested against

{auto-injected}