Documentation

Everything you need to integrate Dark Factory into your workflow

Quick Start

1. Get your API Key

Sign up for a free account and generate an API key from your dashboard.

Create free account

2. Make your first request

cURL
curl -X POST https://darkfactory.ai/api/dark-factory/generate \
  -H "Authorization: Bearer df_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Create a REST API for managing blog posts"}'

3. Check the result

Response
{
  "taskId": "df_task_abc123",
  "status": "completed",
  "artifacts": [
    { "type": "api", "path": "app/api/posts/route.ts" },
    { "type": "model", "path": "prisma/schema.prisma" },
    { "type": "types", "path": "lib/types/post.ts" },
    { "type": "test", "path": "__tests__/posts.test.ts" }
  ],
  "generationTime": 12.4
}

API Reference

POST/api/dark-factory/generate

Submit a code generation request

Request Body

{
  "prompt": "string (required)",
  "projectId": "string (optional)",
  "options": {
    "targetFramework": "nextjs | react | node",
    "includeTests": true,
    "autoValidate": true
  }
}
GET/api/dark-factory/tasks/:taskId

Get task status and generated artifacts

POST/api/dark-factory/deploy/:taskId

Deploy generated artifacts to target environment

Code Generation Pipeline

Intent Parsing

Natural language → structured specification

Schema Generation

Spec → database models and types

Code Generation

API routes, components, tests

Validation

Type checking, linting, tests

Deployment

Preview or production deploy

Deployment

Dark Factory can deploy generated code directly to preview or production environments. Each deployment creates an isolated preview URL for testing before promotion.

Deploy to Preview
curl -X POST https://darkfactory.ai/api/dark-factory/deploy/df_task_abc123 \
  -H "Authorization: Bearer df_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"environment": "preview"}'

Need Help?

Can't find what you're looking for? Reach out to our team.