System architecture
Fataplus is built on a modern, edge-first architecture using Cloudflare’s infrastructure for global performance and scalability.Architecture overview
The platform consists of three main layers:Tech stack
Frontend layer
The frontend is built with modern web technologies optimized for performance:- Astro 5.15+ - Static site generator with partial hydration
- React - Interactive UI components with client-side hydration
- Tailwind CSS - Utility-first CSS framework
- Cloudflare Pages - Global CDN deployment with edge rendering
Astro’s partial hydration strategy ensures only interactive components load JavaScript, keeping the CRM fast and lightweight.
Backend layer
The backend runs entirely on Cloudflare’s edge network:- bknd 0.19.0 - Full-stack framework for Cloudflare Workers
- Cloudflare Workers - Serverless edge compute platform
- Cloudflare D1 - Distributed SQL database at the edge
- Hono - Ultrafast web framework (used internally by bknd)
- TypeScript - Type-safe development
AI integration
Intelligent features powered by Claude AI:- Claude Code API - For code analysis and generation
- Custom AI models - Trained on AgriTech domain knowledge
- Cloudflare Workers AI - Edge inference for low-latency responses
Design system
- Figma API - Real-time design file synchronization
- Cloudflare R2 - Object storage for design assets
- Design tokens - Shared styling system across tenants
Multi-tenant architecture
Fataplus uses a subdomain-based multi-tenant model for client isolation:Tenant isolation
Each tenant (client project) gets:- Dedicated subdomain:
[tenant-name].fata.plus - Isolated data: Database-level tenant separation
- Custom branding: Tenant-specific design system
- Access control: OAuth2-based authentication per tenant
Domain structure
The platform uses multiple domains for different purposes:Primary domains
| Domain | Purpose | Infrastructure |
|---|---|---|
fata.plus | Marketing website + CRM | Cloudflare Pages |
bknd.fata.plus | Backend API | Cloudflare Workers |
*.fata.plus | Tenant subdomains | Cloudflare Pages (dynamic routing) |
Routing configuration
URL structure
Data architecture
Database schema
The platform uses Cloudflare D1 (SQLite at the edge) with the following structure:The bknd framework automatically manages migrations and provides a visual admin interface at
/admin for database management.Data storage
- D1 Database: Structured data (clients, projects, users)
- R2 Bucket: Media and design assets
- KV Store: Session management and caching
- Durable Objects: Real-time collaboration features
API architecture
The backend API is built with the bknd framework running on Cloudflare Workers:Core configuration
API endpoints
The bknd framework provides automatic CRUD endpoints:MCP (Model Context Protocol)
The backend implements MCP for AI agent integration:Security architecture
Authentication and authorization
- OAuth2 - Standard authentication protocol
- Cloudflare Access - Zero Trust network access
- Session management - Secure, httpOnly cookies
- Row-level security - Tenant isolation at database level
Data protection
- CORS policies - Restricted to authorized domains
- WAF (Web Application Firewall) - Automatic threat protection
- DDoS mitigation - Cloudflare network protection
- SSL/TLS - End-to-end encryption
Performance optimization
Edge computing
- Global distribution - Cloudflare’s 300+ data centers
- Edge caching - Static assets cached globally
- Smart routing - Requests routed to nearest edge location
- Zero cold starts - Workers runtime always warm
Frontend optimization
- Partial hydration - Only interactive components load JS
- Image optimization - Cloudflare Images for automatic optimization
- Code splitting - Astro automatically splits bundles
- Prefetching - Critical resources preloaded
Metrics
- Core Web Vitals - >90 Lighthouse score
- TTFB - <200ms (Time to First Byte)
- FCP - <1s (First Contentful Paint)
- TTI - <3s (Time to Interactive)
Deployment architecture
The platform uses Cloudflare’s infrastructure for deployment:Frontend deployment
Backend deployment
Environment configuration
Monitoring and observability
Analytics
- Cloudflare Analytics - Traffic and performance metrics
- Web Vitals - Real user monitoring
- Custom events - Business metric tracking
Logging
Error tracking
- Worker exceptions - Automatic error logging
- Client-side errors - JavaScript error tracking
- API monitoring - Endpoint health checks
Scalability
The architecture is designed to scale automatically:- Horizontal scaling - Workers auto-scale to demand
- Database scaling - D1 replicates data globally
- Asset delivery - R2 scales storage infinitely
- No infrastructure management - Fully serverless
Cloudflare Workers can handle millions of requests per second with no configuration changes. The platform automatically scales based on traffic.
Development workflow
Local development
Type safety
Testing
Next steps
API Reference
Explore API endpoints
Deployment Guide
Deploy to Cloudflare
Multi-Tenant
Multi-tenant architecture
Security
Review security best practices