Skip to main content

Introduction

The Fataplus API is a unified backend solution built on the bknd framework and deployed on Cloudflare Workers. It provides a complete multi-tenant architecture for managing client projects, agricultural data, and collaborative workflows.

Base URL

All API requests should be made to:
https://bknd.fata.plus
The API is also available at the development URL: https://fataplus-bknd-backend.fenohery.workers.dev

Architecture

Runtime Environment

Runtime
Cloudflare Workers
The API runs on Cloudflare’s edge network, providing global low-latency access.
Framework
bknd 0.19.0
Built with the bknd unified backend framework for rapid API development.
Database
Cloudflare D1
SQLite-based database with session management enabled for authentication.

Key Features

  • Multi-Tenancy: Complete data isolation between clients with granular role-based permissions
  • Session-Based Authentication: Secure authentication with D1 session storage
  • Admin UI: Visual administration interface at /admin
  • MCP Protocol: Model Context Protocol support for AI integrations
  • CORS-Enabled: Configured for cross-origin requests from Fataplus domains

API Capabilities

Data Collections

The API provides access to three primary data collections:

1. Clients Collection

Manage client accounts with multi-tenant isolation.
{
  "id": "string",
  "name": "string",
  "email": "string",
  "projects": [],
  "created_at": "datetime",
  "updated_at": "datetime"
}
Permissions: Read access for admin and client roles; Write access for admin only.

2. Projects Collection

Project intake and management system.
{
  "id": "string",
  "client_id": "string",
  "title": "string",
  "description": "text",
  "status": "pending | active | completed",
  "category": "agri-tech | design | consulting",
  "requirements": {},
  "created_at": "datetime",
  "updated_at": "datetime"
}
Permissions: Read and write access for both admin and client roles.

3. Agricultural Data Collection

Agritech-specific data tracking and analytics.
{
  "id": "string",
  "project_id": "string",
  "crop_type": "string",
  "farm_size": "number",
  "location": {},
  "irrigation_system": "string",
  "yield_data": {},
  "created_at": "datetime"
}
Permissions: Read and write access for both admin and client roles.

MCP Protocol Support

The API implements the Model Context Protocol (MCP) at /api/system/mcp for AI agent integrations. Available MCP Tools:
  • system_info: Retrieve system information
  • data_entity_read_many: Read multiple entities from database collections
// MCP Initialization
POST /api/system/mcp
{
  "jsonrpc": "2.0",
  "method": "initialize",
  "id": 1
}
See the MCP endpoints documentation for detailed usage.

CORS Configuration

The API is configured with CORS support for the following origins:
  • http://localhost:3000 (development)
  • https://fata.plus
  • https://www.fata.plus
  • https://fataplus.com
  • https://www.fataplus.com
Credentials: Enabled for cookie-based authentication.
Access-Control-Allow-Origin: [allowed-origin]
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization
Access-Control-Allow-Credentials: true
The MCP endpoint (/api/system/mcp) allows all origins (*) for maximum compatibility with AI tools.

Rate Limits

Rate limiting is managed by Cloudflare Workers and varies based on your plan. Contact support for custom rate limit configurations.
The API leverages Cloudflare’s built-in DDoS protection and automatic rate limiting at the edge.

Admin Interface

Access the visual admin interface for managing collections, users, and permissions:
https://bknd.fata.plus/admin
The admin UI provides:
  • Collection management and schema inspection
  • User and permission management
  • Real-time data browsing and editing
  • API endpoint testing

Response Format

All API responses follow standard HTTP conventions:
  • 200 OK: Successful request
  • 201 Created: Resource created successfully
  • 400 Bad Request: Invalid request parameters
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Insufficient permissions
  • 404 Not Found: Resource not found
  • 500 Internal Server Error: Server error
JSON responses include appropriate error messages:
{
  "error": {
    "code": -32700,
    "message": "Parse error"
  }
}

Next Steps

Authentication

Learn how to authenticate API requests

Projects API

Manage projects and clients

MCP Integration

Integrate AI agents with MCP protocol

Multi-Tenancy

Understand tenant isolation and permissions