Technology Stack
Purpose
This document defines the approved technology choices for the Farmer1st platform.
Current State
Frontend Technologies
| Layer |
Technology |
Purpose |
| Farmer App |
React (PWA) |
Progressive Web App for farmers |
| Farmer App Hosting |
Cloudflare Pages |
Global CDN, edge deployment |
| Stakeholder Portals |
TBD (likely React) |
Web portals for stakeholders |
Backend Technologies
| Layer |
Technology |
Purpose |
| Language |
Python |
Core backend services |
| Web Framework |
TBD |
FastAPI / Django / Flask |
| Authentication |
SuperTokens (self-hosted) |
User authentication and sessions |
| Workflow Engine |
Temporal |
Complex workflow orchestration |
| Feature Flags |
Unleash (self-hosted) |
Feature toggles, gradual rollouts |
Data Layer
| Component |
Technology |
Purpose |
| Primary Database |
PostgreSQL |
Relational data, transactions |
| Cache |
Redis |
Caching, sessions, rate limiting |
| Message Queue |
Kafka (AWS MSK) |
Async messaging, event streaming |
Infrastructure
| Component |
Technology |
Purpose |
| Cloud Provider |
AWS |
Primary infrastructure |
| Container Orchestration |
EKS Fargate (→ EC2) |
Kubernetes workloads |
| Edge/CDN |
Cloudflare |
Pages, JWT validation, Tunnel |
| Backend Connectivity |
Cloudflare Tunnel |
Secure private connection to AWS |
Confirmed Stack Summary
┌─────────────────────────────────────────────────────────────┐
│ TECHNOLOGY STACK │
├─────────────────────────────────────────────────────────────┤
│ │
│ FRONTEND │ BACKEND │ DATA │
│ ───────────────────────────────────────────────────────── │
│ React (PWA) │ Python │ PostgreSQL │
│ Cloudflare Pages │ SuperTokens │ Redis │
│ │ Temporal │ Kafka (MSK) │
│ │ │ │
│ INFRASTRUCTURE │ SECURITY │ PENDING │
│ ───────────────────────────────────────────────────────── │
│ AWS EKS Fargate │ Cloudflare JWT │ Python framework │
│ Cloudflare Tunnel │ validation │ Feature flags │
│ Cloudflare Pages │ SuperTokens auth │ Observability │
│ │ │ │
└─────────────────────────────────────────────────────────────┘
Decisions and Rationale
Confirmed Decisions
| Decision |
Rationale |
| React PWA |
Industry standard, excellent PWA support, large talent pool |
| Python backend |
Strong data processing, ML/AI ecosystem for agricultural insights |
| Cloudflare Pages |
Global CDN, excellent performance, integrated with Cloudflare ecosystem |
| Cloudflare Tunnel |
Zero Trust security, no public endpoints, simplified networking |
| AWS EKS Fargate |
Managed Kubernetes, serverless containers, scales to zero |
| PostgreSQL |
ACID compliance, relational integrity, proven at scale |
| Redis |
Sub-millisecond caching, versatile, industry standard |
| Kafka (MSK) |
Durable messaging, event replay, high throughput |
| Temporal |
Complex workflow orchestration, durable execution |
| SuperTokens |
Self-hosted auth, no per-user pricing, full control |
Pending Decisions
| Decision |
Options |
Considerations |
| Python Framework |
FastAPI, Django, Flask |
Performance, ORM, admin needs |
| ~~Feature Flags~~ |
~~Unleash, LaunchDarkly~~ |
✅ Decided: Unleash |
| Observability |
CloudWatch, Datadog, Grafana |
Cost, features, integration |
| CI/CD |
GitHub Actions, GitLab CI, ArgoCD |
Team preference, GitOps |
Feature Flags: Unleash
Decision
Unleash (self-hosted) is the chosen feature flag system.
Rationale
- Cost alignment: Like SuperTokens, self-hosting avoids per-user pricing at millions of farmers
- Consistency: Follows same pattern as auth (self-hosted for cost control)
- Sufficient features: Core feature flagging, gradual rollouts, A/B testing covered
- Control: Can customize and extend as needed
- No vendor lock-in: Open source, portable
Trade-offs Accepted
- More operational responsibility than LaunchDarkly
- Less polished UI
- Basic experimentation (sufficient for current needs)
Use Cases
- Gradual feature rollouts to farmer segments
- A/B testing new PWA features
- Kill switches for problematic features
- Regional feature availability
- Stakeholder-specific portal features
Constraints
- Initial bundle size: Target < 200KB gzipped
- Time to Interactive: Target < 3s on 3G
- Must work on devices with 1GB RAM
Compatibility Requirements
- Android WebView: Chrome 60+ (Android 5.0+)
- iOS Safari: iOS 11.3+ (limited PWA features)
Open Questions
Last Updated: 2025-12-25