Guide
Build with AI tools
Give Lovable, Bolt, v0, Cursor or Claude everything they need to use your CodeFreeAPI backend.
Copy for AI
On your project's page, Copy for AI puts a description of your API on the clipboard: the base URL, how to send the API key, every entity with its fields and access rules, user accounts, filters and custom endpoints. Paste it into Lovable, Bolt, v0, Cursor or Claude before asking it to build, and it writes code against your real API instead of inventing one.
The API key isn't in it
The text tells the tool to read the key from an environment variable such asVITE_CODEFREEAPI_KEY. In frontend code use a publishable key.llms.txt
With Public API docs switched on (Project Settings), the same description is served at https://YOUR_PROJECT.codefreeapi.com/api/v1/llms.txt, so tools that read a URL can fetch it themselves.
MCP server
The @codefreeapi/mcp server lets Claude, Cursor, Windsurf and other MCP clients build the backend for you: create projects (also from templates), entities, fields and access rules, add records, and make API keys. Examples and questions: MCP server overview.
- In Settings → Access tokens, create a token (it starts with
cfa_pat_). - Add the server to your tool:
{
"mcpServers": {
"codefreeapi": {
"command": "npx",
"args": ["-y", "@codefreeapi/mcp"],
"env": { "CODEFREEAPI_TOKEN": "cfa_pat_..." }
}
}
}claude mcp add codefreeapi -e CODEFREEAPI_TOKEN=cfa_pat_... -- npx -y @codefreeapi/mcp| Tool | What it does |
|---|---|
describe_project | Base URL, auth, entities, rules and examples: everything to write app code |
create_project | Empty or from a template; returns its first API key once |
create_entity, add_field | Build the schema |
set_access_rules | Public / signed-in / owner only / admins / off, per method |
list_records … delete_record | Data, with filters and search |
create_api_key | A key for the app, shown once |
The token can do what you can do in the dashboard except change your account, create more tokens or use admin rights. Delete it in Settings any time.
TypeScript client
TypeScript client on the project page downloads codefreeapi-client.ts: an interface for every entity and a small client with no dependencies (it uses fetch). Drop it into your app; AI tools pick up the types too.
import { createClient } from './codefreeapi-client';
const api = createClient({ apiKey: import.meta.env.VITE_CODEFREEAPI_KEY });
await api.auth.login(email, password); // keeps and refreshes the session
const { data } = await api.tasks.list({ sort: '-createdAt', where: { done: false } });
await api.tasks.create({ title: 'Ship it' }); // typed: missing required fields don't compileDownload it again after you add or change fields.
Prompts that work
- "Here is my backend: [paste]. Build a React todo app on it. Users sign up and only see their own tasks."
- "Create a CodeFreeAPI backend for a recipe app: recipes with title, minutes and a photo, ingredients that belong to a recipe; only signed-in users can add recipes, everyone can read. Then wire my app to it." (with the MCP server)
- Ask the tool to read the API key from an environment variable and never to put a secret key in frontend code.