DRV2ME commited on
Commit
d7fe66c
·
verified ·
1 Parent(s): 4f07b64

# Agrosynth OS — Monorepo (MVP Code + Security-First Scaffold)

Browse files

> Production-ready scaffold for an AI-driven ag platform with AR/VR, satellite+drone data fusion, blockchain-backed certification, and zero-trust security. Includes: FastAPI backend, AI microservice, Next.js frontend, Solidity contracts, Unity XR stubs, data-provider adapters, and DevSecOps (Docker/K8s/OPA/mTLS).

---

## Repository Layout

```
agrosynth/
├─ README.md
├─ docker-compose.yml
├─ .env.example
├─ package.json
├─ pnpm-workspace.yaml
├─ k8s/
│ ├─ base/
│ │ ├─ namespace.yaml
│ │ ├─ gateway.yaml
│ │ ├─ opa-gatekeeper.yaml
│ │ └─ cert-manager.yaml
│ └─ overlays/prod/
│ ├─ backend.yaml
│ ├─ ai-service.yaml
│ ├─ frontend.yaml
│ ├─ ingress.yaml
│ └─ networkpolicies.yaml
├─ security/
│ ├─ THREAT_MODEL.md
│ ├─ OPA_POLICIES.rego
│ ├─ mtls/
│ │ ├─ generate.sh
│ │ └─ openssl.cnf
│ └─ sops.yaml
├─ backend/ # FastAPI + Postgres + Redis + OPA sidecar
│ ├─ pyproject.toml
│ ├─ agrosynth/
│ │ ├─ __init__.py
│ │ ├─ main.py
│ │ ├─ config.py
│ │ ├─ db.py
│ │ ├─ deps.py
│ │ ├─ security.py
│ │ ├─ routers/
│ │ │ ├─ auth.py
│ │ │ ├─ farms.py
│ │ │ ├─ datasets.py
│ │ │ ├─ certificates.py
│ │ │ ├─ pricing.py
│ │ │ └─ xr.py
│ │ ├─ models/
│ │ │ ├─ user.py
│ │ │ ├─ farm.py
│ │ │ ├─ dataset.py
│ │ │ └─ certificate.py
│ │ └─ schemas/
│ │ ├─ auth.py
│ │ ├─ farm.py
│ │ ├─ dataset.py
│ │ └─ certificate.py
│ └─ tests/
├─ ai-service/ # FastAPI (inference), Torch/TF optional
│ ├─ pyproject.toml
│ ├─ service/
│ │ ├─ main.py
│ │ ├─ models/
│ │ │ ├─ yield_forecaster.py
│ │ │ └─ soil_health.py
│ │ └─ pipelines/
│ │ ├─ fuse_satellite_drone.py
│ │ └─ feature_store.py
├─ data-providers/
│ ├─ sentinel/
│ │ ├─ client.py
│ │ └─ tiling.py
│ ├─ planet/
│ │ └─ client.py
│ └─ drone/
│ ├─ photogrammetry.py
│ └─ lidar_ingest.py
├─ cert-service/ # PDF generator + blockchain anchoring
│ ├─ pyproject.toml
│ ├─ service/
│ │ ├─ main.py
│ │ ├─ builder.py
│ │ └─ zk_proofs.py
├─ blockchain/
│ ├─ hardhat.config.ts
│ ├─ contracts/
│ │ ├─ AgroCertificate.sol
│ │ └─ AgroYieldToken.sol
│ ├─ scripts/
│ │ ├─ deploy.ts
│ │ └─ verify.ts
│ └─ test/
├─ frontend/ # Next.js 14 (App Router) + Tailwind
│ ├─ package.json
│ ├─ next.config.js
│ ├─ tailwind.config.ts
│ ├─ postcss.config.js
│ ├─ app/
│ │ ├─ layout.tsx
│ │ ├─ page.tsx
│ │ ├─ dashboard/page.tsx
│ │ └─ api/
│ │ └─ proxy/[...path]/route.ts
│ ├─ components/
│ │ ├─ MapPanel.tsx
│ │ ├─ XRStatus.tsx
│ │ └─ PricingTable.tsx
├─ xr-ar/ # Unity C# stubs (Meta Ray-Ban compatible SDK hooks)
│ └─ Scripts/
│ ├─ ARCropOverlay.cs
│ ├─ AuthClient.cs
│ └─ TelemetryPublisher.cs
├─ vr-sim/
│ └─ Scripts/
│ ├─ SatelliteTerrainLoader.cs
│ ├─ GrowthSimulator.cs
│ └─ ScenarioManager.cs
└─ infra/
├─ docker/
│ ├─ backend.Dockerfile
│ ├─ ai-service.Dockerfile
│ ├─ cert-service.Dockerfile
│ └─ frontend.Dockerfile
└─ opa/
└─ policy.rego
```

---

## docker-compose.yml (dev)

```yaml
version: "3.9"
services:
db:
image: postgres:16-alpine
environment:
POSTGRES_USER: agrosynth
POSTGRES_PASSWORD: agrosynth
POSTGRES_DB: agrosynth
ports: ["5432:5432"]
volumes:
- dbdata:/var/lib/postgresql/data
redis:
image: redis:7-alpine
ports: ["6379:6379"]
backend:
build: ./infra/docker/backend.Dockerfile
env_file: .env
depends_on: [db, redis]
ports: ["8000:8000"]
ai:
build: ./infra/docker/ai-service.Dockerfile
env_file: .env
ports: ["8001:8001"]
certsvc:
build: ./infra/docker/cert-service.Dockerfile
env_file: .env
ports: ["8002:8002"]
frontend:
build: ./infra/docker/frontend.Dockerfile
env_file: .env
ports: ["3000:3000"]
volumes:
dbdata:
```

---

## backend/agrosynth/config.py

```python
from pydantic import BaseSettings, AnyHttpUrl
from functools import lru_cache

class Settings(BaseSettings):
PROJECT_NAME: str = "Agrosynth OS"
API_V1_STR: str = "/api/v1"
DATABASE_URL: str
REDIS_URL: str = "redis://redis:6379/0"

JWT_PUBLIC_KEY: str
JWT_ALGORITHM: str = "RS256"
OPA_URL: AnyHttpUrl = "http://opa:8181"
AI_SERVICE_URL: AnyHttpUrl = "http://ai:8001"
CERT_SERVICE_URL: AnyHttpUrl = "http://certsvc:8002"

# mTLS client certs paths (mounted secrets in prod)
CLIENT_CERT_PATH: str = "/etc/mtls/client.crt"
CLIENT_KEY_PATH: str = "/etc/mtls/client.key"
CA_CERT_PATH: str = "/etc/mtls/ca.crt"

class Config:
env_file = ".env"

@lru_cache()
def get_settings() -> Settings:
return Settings()
```

---

## backend/agrosynth/security.py (Zero Trust hooks)

```python
from fastapi import Depends, HTTPException, status, Request
from jose import jwt
from .config import get_settings
import httpx

settings = get_settings()

async def opa_authorize(request: Request, action: str, resource: str):
# Query OPA with input {subject, action, resource}
async with httpx.AsyncClient() as client:
payload = {
"input": {
"path": request.url.path,
"method": request.method,
"subject": request.headers.get("x-subject", "anon"),
"action": action,
"resource": resource,
"claims": request.state.claims if hasattr(request.state, 'claims') else {}
}
}
r = await client.post(f"{settings.OPA_URL}/v1/data/agrosynth/authz/allow", json=payload)
allowed = r.json().get("result", False)
if not allowed:
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Unauthorized by policy")

async def authenticate(request: Request):
auth = request.headers.get("authorization", "")
if not auth.startswith("Bearer "):
raise HTTPException(status_code=401, detail="Missing token")
token = auth.split(" ",1)[1]
try:
claims = jwt.decode(token, settings.JWT_PUBLIC_KEY, algorithms=[settings.JWT_ALGORITHM])
request.state.claims = claims
return claims
except Exception:
raise HTTPException(status_code=401, detail="Invalid token")
```

---

## backend/agrosynth/main.py

```python
from fastapi import FastAPI, Request
from fastapi.middleware.cors import CORSMiddleware
from .config import get_settings
from .routers import auth, farms, datasets, certificates, pricing, xr

app = FastAPI(title=get_settings().PROJECT_NAME, version="0.1.0")

app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"]
)

app.include_router(auth.router, prefix="/api/v1/auth", tags=["auth"])
app.include_router(farms.router, prefix="/api/v1/farms", tags=["farms"])
app.include_router(datasets.router, prefix="/api/v1/datasets", tags=["datasets"])
app.include_router(certificates.router, prefix="/api/v1/certificates", tags=["certificates"])
app.include_router(pricing.router, prefix="/api/v1/pricing", tags=["pricing"])
app.include_router(xr.router, prefix="/api/v1/xr", tags=["xr"])

@app .get("/health")
async def health():
return {"status":"ok"}
```

---

## backend/agrosynth/routers/pricing.py (Two-tier pricing)

```python
from fastapi import APIRouter, Depends
from pydantic import BaseModel

router = APIRouter()

class PricingQuote(BaseModel):
tier: str # "essential" or "pro"
hectares: int
billing: str # "monthly" or "annual"

@router .post("/quote")
async def quote(q: PricingQuote):
if q.tier == "essential":
unit = 150 if q.billing == "monthly" else 1500
per = 100
else:
unit = 1200 if q.billing == "monthly" else 12000
per = 1000
blocks = max(1, -(-q.hectares // per)) # ceil division
total = unit * blocks
return {"tier": q.tier, "billing": q.billing, "hectares": q.hectares, "blocks": blocks, "total": total}
```

---

## backend/agrosynth/routers/certificates.py (Certificate + anchor)

```python
from fastapi import APIRouter, Depends, HTTPException
from pydantic import BaseModel
import httpx
from ..config import get_settings

router = APIRouter()

class CertRequest(BaseModel):
farm_id: str
metrics: dict # soil scores, yield, regen practices

@router .post("/")
async def issue_certificate(req: CertRequest):
settings = get_settings()
async with httpx.AsyncClient() as client:
# build PDF + ZK proof inside cert-service
r = await client.post(f"{settings.CERT_SERVICE_URL}/build", json=req.dict())
r.raise_for_status()
data = r.json()
# data = { pdf_url, onchain_tx, hash }
return data
```

---

## ai-service/service/models/yield_forecaster.py (stub)

```python
from typing import Dict
import numpy as np

class YieldForecaster:
def __init__(self):
# load model(s) here
pass

def predict(self, features: Dict) -> Dict:
# stub: replace with real ML
rain = features.get("rain_mm", 100)
ndvi = features.get("ndvi", 0.6)
soil = features.get("soil_score", 0.7)
yield_t_ha = max(0.0, (ndvi*4.0 + soil*2.0) * (1 + (rain-100)/800))
return {"yield_t_ha": round(yield_t_ha, 2), "confidence": 0.75}
```

---

## ai-service/service/main.py

```python
from fastapi import F

Files changed (4) hide show
  1. README.md +7 -5
  2. dashboard.html +366 -0
  3. index.html +381 -18
  4. prompts.txt +652 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Far
3
- emoji: ⚡
4
- colorFrom: indigo
5
- colorTo: indigo
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: far
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: blue
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
dashboard.html ADDED
@@ -0,0 +1,366 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Dashboard - Agrosynth OS</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
9
+ <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
12
+ <script>
13
+ tailwind.config = {
14
+ theme: {
15
+ extend: {
16
+ colors: {
17
+ primary: {
18
+ 50: '#f0fdf4',
19
+ 100: '#dcfce7',
20
+ 200: '#bbf7d0',
21
+ 300: '#86efac',
22
+ 400: '#4ade80',
23
+ 500: '#22c55e',
24
+ 600: '#16a34a',
25
+ 700: '#15803d',
26
+ 800: '#166534',
27
+ 900: '#14532d',
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ </script>
34
+ <style>
35
+ .sidebar {
36
+ transition: all 0.3s ease;
37
+ }
38
+ .sidebar.collapsed {
39
+ width: 5rem;
40
+ }
41
+ .sidebar.collapsed .sidebar-text {
42
+ display: none;
43
+ }
44
+ .main-content {
45
+ transition: margin-left 0.3s ease;
46
+ }
47
+ .map-container {
48
+ height: 500px;
49
+ background-image: url('http://static.photos/nature/1200x630/42');
50
+ background-size: cover;
51
+ background-position: center;
52
+ }
53
+ </style>
54
+ </head>
55
+ <body class="bg-gray-100 font-sans antialiased">
56
+ <div class="flex h-screen overflow-hidden">
57
+ <!-- Sidebar -->
58
+ <div class="sidebar bg-white shadow-md w-64 flex flex-col">
59
+ <div class="flex items-center justify-center h-16 px-4 border-b">
60
+ <div class="flex items-center">
61
+ <i data-feather="layers" class="text-primary-600 h-6 w-6"></i>
62
+ <span class="ml-2 text-lg font-bold text-gray-900 sidebar-text">Agrosynth OS</span>
63
+ </div>
64
+ </div>
65
+ <nav class="flex-1 overflow-y-auto py-4">
66
+ <div class="px-4 space-y-1">
67
+ <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md bg-primary-50 text-primary-700">
68
+ <i data-feather="home" class="text-primary-600 h-5 w-5"></i>
69
+ <span class="ml-3 sidebar-text">Dashboard</span>
70
+ </a>
71
+ <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 hover:bg-gray-50 hover:text-gray-900">
72
+ <i data-feather="map" class="text-gray-500 h-5 w-5"></i>
73
+ <span class="ml-3 sidebar-text">Field Maps</span>
74
+ </a>
75
+ <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 hover:bg-gray-50 hover:text-gray-900">
76
+ <i data-feather="activity" class="text-gray-500 h-5 w-5"></i>
77
+ <span class="ml-3 sidebar-text">Analytics</span>
78
+ </a>
79
+ <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 hover:bg-gray-50 hover:text-gray-900">
80
+ <i data-feather="eye" class="text-gray-500 h-5 w-5"></i>
81
+ <span class="ml-3 sidebar-text">XR Tools</span>
82
+ </a>
83
+ <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 hover:bg-gray-50 hover:text-gray-900">
84
+ <i data-feather="shield" class="text-gray-500 h-5 w-5"></i>
85
+ <span class="ml-3 sidebar-text">Certificates</span>
86
+ </a>
87
+ <a href="#" class="flex items-center px-2 py-2 text-sm font-medium rounded-md text-gray-600 hover:bg-gray-50 hover:text-gray-900">
88
+ <i data-feather="settings" class="text-gray-500 h-5 w-5"></i>
89
+ <span class="ml-3 sidebar-text">Settings</span>
90
+ </a>
91
+ </div>
92
+ </nav>
93
+ <div class="p-4 border-t">
94
+ <div class="flex items-center">
95
+ <img class="h-8 w-8 rounded-full" src="http://static.photos/people/200x200/1" alt="User profile">
96
+ <div class="ml-3 sidebar-text">
97
+ <p class="text-sm font-medium text-gray-700">John Farmer</p>
98
+ <p class="text-xs text-gray-500">Premium Plan</p>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ </div>
103
+
104
+ <!-- Main content -->
105
+ <div class="main-content flex-1 overflow-auto">
106
+ <!-- Top navigation -->
107
+ <header class="bg-white shadow-sm">
108
+ <div class="flex justify-between items-center px-4 py-4 sm:px-6">
109
+ <div class="flex items-center">
110
+ <button class="mr-4 text-gray-500 hover:text-gray-600">
111
+ <i data-feather="menu" class="h-5 w-5"></i>
112
+ </button>
113
+ <h1 class="text-xl font-semibold text-gray-900">Farm Dashboard</h1>
114
+ </div>
115
+ <div class="flex items-center space-x-4">
116
+ <button class="p-1 text-gray-400 hover:text-gray-500">
117
+ <i data-feather="bell" class="h-5 w-5"></i>
118
+ </button>
119
+ <button class="p-1 text-gray-400 hover:text-gray-500">
120
+ <i data-feather="help-circle" class="h-5 w-5"></i>
121
+ </button>
122
+ </div>
123
+ </div>
124
+ </header>
125
+
126
+ <!-- Dashboard content -->
127
+ <main class="p-4 sm:p-6">
128
+ <!-- Stats cards -->
129
+ <div class="grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4 mb-6">
130
+ <!-- Card 1 -->
131
+ <div class="bg-white overflow-hidden shadow rounded-lg" data-aos="fade-up">
132
+ <div class="px-4 py-5 sm:p-6">
133
+ <div class="flex items-center">
134
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
135
+ <i data-feather="map-pin" class="h-6 w-6 text-primary-600"></i>
136
+ </div>
137
+ <div class="ml-5 w-0 flex-1">
138
+ <dt class="text-sm font-medium text-gray-500 truncate">Total Hectares</dt>
139
+ <dd class="flex items-baseline">
140
+ <div class="text-2xl font-semibold text-gray-900">1,250</div>
141
+ </dd>
142
+ </div>
143
+ </div>
144
+ </div>
145
+ </div>
146
+
147
+ <!-- Card 2 -->
148
+ <div class="bg-white overflow-hidden shadow rounded-lg" data-aos="fade-up" data-aos-delay="100">
149
+ <div class="px-4 py-5 sm:p-6">
150
+ <div class="flex items-center">
151
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
152
+ <i data-feather="bar-chart-2" class="h-6 w-6 text-primary-600"></i>
153
+ </div>
154
+ <div class="ml-5 w-0 flex-1">
155
+ <dt class="text-sm font-medium text-gray-500 truncate">Yield Forecast</dt>
156
+ <dd class="flex items-baseline">
157
+ <div class="text-2xl font-semibold text-gray-900">4.2 t/ha</div>
158
+ <div class="ml-2 flex items-baseline text-sm font-semibold text-green-600">
159
+ <i data-feather="trending-up" class="h-4 w-4"></i>
160
+ <span class="sr-only">Increased by</span> 8%
161
+ </div>
162
+ </dd>
163
+ </div>
164
+ </div>
165
+ </div>
166
+ </div>
167
+
168
+ <!-- Card 3 -->
169
+ <div class="bg-white overflow-hidden shadow rounded-lg" data-aos="fade-up" data-aos-delay="200">
170
+ <div class="px-4 py-5 sm:p-6">
171
+ <div class="flex items-center">
172
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
173
+ <i data-feather="droplet" class="h-6 w-6 text-primary-600"></i>
174
+ </div>
175
+ <div class="ml-5 w-0 flex-1">
176
+ <dt class="text-sm font-medium text-gray-500 truncate">Soil Moisture</dt>
177
+ <dd class="flex items-baseline">
178
+ <div class="text-2xl font-semibold text-gray-900">62%</div>
179
+ <div class="ml-2 flex items-baseline text-sm font-semibold text-red-600">
180
+ <i data-feather="trending-down" class="h-4 w-4"></i>
181
+ <span class="sr-only">Decreased by</span> 3%
182
+ </div>
183
+ </dd>
184
+ </div>
185
+ </div>
186
+ </div>
187
+ </div>
188
+
189
+ <!-- Card 4 -->
190
+ <div class="bg-white overflow-hidden shadow rounded-lg" data-aos="fade-up" data-aos-delay="300">
191
+ <div class="px-4 py-5 sm:p-6">
192
+ <div class="flex items-center">
193
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
194
+ <i data-feather="shield" class="h-6 w-6 text-primary-600"></i>
195
+ </div>
196
+ <div class="ml-5 w-0 flex-1">
197
+ <dt class="text-sm font-medium text-gray-500 truncate">Certified Fields</dt>
198
+ <dd class="flex items-baseline">
199
+ <div class="text-2xl font-semibold text-gray-900">3/5</div>
200
+ </dd>
201
+ </div>
202
+ </div>
203
+ </div>
204
+ </div>
205
+ </div>
206
+
207
+ <!-- Map and main content -->
208
+ <div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
209
+ <!-- Left column -->
210
+ <div class="lg:col-span-2 space-y-6">
211
+ <!-- Map -->
212
+ <div class="bg-white shadow rounded-lg overflow-hidden" data-aos="fade-up">
213
+ <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
214
+ <h3 class="text-lg font-medium leading-6 text-gray-900">Field Map</h3>
215
+ </div>
216
+ <div class="map-container rounded-b-lg"></div>
217
+ </div>
218
+
219
+ <!-- Tasks -->
220
+ <div class="bg-white shadow rounded-lg overflow-hidden" data-aos="fade-up">
221
+ <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
222
+ <h3 class="text-lg font-medium leading-6 text-gray-900">Pending Tasks</h3>
223
+ </div>
224
+ <div class="divide-y divide-gray-200">
225
+ <div class="px-4 py-4 sm:px-6">
226
+ <div class="flex items-center justify-between">
227
+ <div class="flex items-center">
228
+ <input type="checkbox" class="h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded">
229
+ <span class="ml-3 text-sm font-medium text-gray-900">Apply fertilizer to Field B</span>
230
+ </div>
231
+ <div class="flex items-center text-sm text-gray-500">
232
+ <i data-feather="calendar" class="h-4 w-4 mr-1"></i>
233
+ Due tomorrow
234
+ </div>
235
+ </div>
236
+ </div>
237
+ <div class="px-4 py-4 sm:px-6">
238
+ <div class="flex items-center justify-between">
239
+ <div class="flex items-center">
240
+ <input type="checkbox" class="h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded">
241
+ <span class="ml-3 text-sm font-medium text-gray-900">Schedule drone scan for Field C</span>
242
+ </div>
243
+ <div class="flex items-center text-sm text-gray-500">
244
+ <i data-feather="calendar" class="h-4 w-4 mr-1"></i>
245
+ Due in 3 days
246
+ </div>
247
+ </div>
248
+ </div>
249
+ <div class="px-4 py-4 sm:px-6">
250
+ <div class="flex items-center justify-between">
251
+ <div class="flex items-center">
252
+ <input type="checkbox" class="h-4 w-4 text-primary-600 focus:ring-primary-500 border-gray-300 rounded">
253
+ <span class="ml-3 text-sm font-medium text-gray-900">Review soil analysis report</span>
254
+ </div>
255
+ <div class="flex items-center text-sm text-gray-500">
256
+ <i data-feather="calendar" class="h-4 w-4 mr-1"></i>
257
+ Due in 5 days
258
+ </div>
259
+ </div>
260
+ </div>
261
+ </div>
262
+ </div>
263
+ </div>
264
+
265
+ <!-- Right column -->
266
+ <div class="space-y-6">
267
+ <!-- Yield forecast -->
268
+ <div class="bg-white shadow rounded-lg overflow-hidden" data-aos="fade-up">
269
+ <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
270
+ <h3 class="text-lg font-medium leading-6 text-gray-900">Yield Forecast</h3>
271
+ </div>
272
+ <div class="px-4 py-5 sm:p-6">
273
+ <div class="h-64 flex items-center justify-center">
274
+ <div class="text-center">
275
+ <div class="text-5xl font-bold text-primary-600">4.2</div>
276
+ <div class="mt-2 text-gray-500">tons per hectare</div>
277
+ <div class="mt-4 text-sm text-gray-500">8% increase from last season</div>
278
+ </div>
279
+ </div>
280
+ </div>
281
+ </div>
282
+
283
+ <!-- Recent activity -->
284
+ <div class="bg-white shadow rounded-lg overflow-hidden" data-aos="fade-up">
285
+ <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
286
+ <h3 class="text-lg font-medium leading-6 text-gray-900">Recent Activity</h3>
287
+ </div>
288
+ <div class="divide-y divide-gray-200">
289
+ <div class="px-4 py-4">
290
+ <div class="flex space-x-3">
291
+ <div class="flex-shrink-0">
292
+ <i data-feather="alert-circle" class="h-5 w-5 text-yellow-500"></i>
293
+ </div>
294
+ <div class="min-w-0 flex-1">
295
+ <p class="text-sm text-gray-800">Soil moisture levels in Field A are below optimal</p>
296
+ <p class="text-sm text-gray-500">2 hours ago</p>
297
+ </div>
298
+ </div>
299
+ </div>
300
+ <div class="px-4 py-4">
301
+ <div class="flex space-x-3">
302
+ <div class="flex-shrink-0">
303
+ <i data-feather="check-circle" class="h-5 w-5 text-green-500"></i>
304
+ </div>
305
+ <div class="min-w-0 flex-1">
306
+ <p class="text-sm text-gray-800">Drone scan completed for Field B</p>
307
+ <p class="text-sm text-gray-500">1 day ago</p>
308
+ </div>
309
+ </div>
310
+ </div>
311
+ <div class="px-4 py-4">
312
+ <div class="flex space-x-3">
313
+ <div class="flex-shrink-0">
314
+ <i data-feather="shield" class="h-5 w-5 text-blue-500"></i>
315
+ </div>
316
+ <div class="min-w-0 flex-1">
317
+ <p class="text-sm text-gray-800">New organic certification issued for Field C</p>
318
+ <p class="text-sm text-gray-500">3 days ago</p>
319
+ </div>
320
+ </div>
321
+ </div>
322
+ </div>
323
+ </div>
324
+
325
+ <!-- Quick actions -->
326
+ <div class="bg-white shadow rounded-lg overflow-hidden" data-aos="fade-up">
327
+ <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
328
+ <h3 class="text-lg font-medium leading-6 text-gray-900">Quick Actions</h3>
329
+ </div>
330
+ <div class="p-4 grid grid-cols-2 gap-4">
331
+ <button class="flex items-center justify-center p-3 border border-gray-200 rounded-md hover:bg-gray-50">
332
+ <i data-feather="plus" class="h-5 w-5 text-gray-500"></i>
333
+ <span class="ml-2 text-sm font-medium">New Task</span>
334
+ </button>
335
+ <button class="flex items-center justify-center p-3 border border-gray-200 rounded-md hover:bg-gray-50">
336
+ <i data-feather="map" class="h-5 w-5 text-gray-500"></i>
337
+ <span class="ml-2 text-sm font-medium">View Map</span>
338
+ </button>
339
+ <button class="flex items-center justify-center p-3 border border-gray-200 rounded-md hover:bg-gray-50">
340
+ <i data-feather="bar-chart-2" class="h-5 w-5 text-gray-500"></i>
341
+ <span class="ml-2 text-sm font-medium">Analytics</span>
342
+ </button>
343
+ <button class="flex items-center justify-center p-3 border border-gray-200 rounded-md hover:bg-gray-50">
344
+ <i data-feather="settings" class="h-5 w-5 text-gray-500"></i>
345
+ <span class="ml-2 text-sm font-medium">Settings</span>
346
+ </button>
347
+ </div>
348
+ </div>
349
+ </div>
350
+ </div>
351
+ </main>
352
+ </div>
353
+ </div>
354
+
355
+ <script>
356
+ AOS.init({
357
+ duration: 800,
358
+ easing: 'ease-in-out',
359
+ once: true
360
+ });
361
+ </script>
362
+ <script>
363
+ feather.replace();
364
+ </script>
365
+ </body>
366
+ </html>
index.html CHANGED
@@ -1,19 +1,382 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Agrosynth OS - AI-Driven Agriculture Platform</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <link href="https://unpkg.com/aos@2.3.1/dist/aos.css" rel="stylesheet">
9
+ <script src="https://unpkg.com/aos@2.3.1/dist/aos.js"></script>
10
+ <script src="https://unpkg.com/feather-icons"></script>
11
+ <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
12
+ <script>
13
+ tailwind.config = {
14
+ theme: {
15
+ extend: {
16
+ colors: {
17
+ primary: {
18
+ 50: '#f0fdf4',
19
+ 100: '#dcfce7',
20
+ 200: '#bbf7d0',
21
+ 300: '#86efac',
22
+ 400: '#4ade80',
23
+ 500: '#22c55e',
24
+ 600: '#16a34a',
25
+ 700: '#15803d',
26
+ 800: '#166534',
27
+ 900: '#14532d',
28
+ }
29
+ }
30
+ }
31
+ }
32
+ }
33
+ </script>
34
+ <style>
35
+ .hero-gradient {
36
+ background: linear-gradient(135deg, rgba(20, 83, 45, 0.9) 0%, rgba(22, 101, 52, 0.9) 100%);
37
+ }
38
+ .feature-card:hover {
39
+ transform: translateY(-5px);
40
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
41
+ }
42
+ .glow {
43
+ box-shadow: 0 0 15px rgba(34, 197, 94, 0.5);
44
+ }
45
+ </style>
46
+ </head>
47
+ <body class="bg-gray-50 font-sans antialiased">
48
+ <!-- Navigation -->
49
+ <nav class="bg-white shadow-sm sticky top-0 z-50">
50
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
51
+ <div class="flex justify-between h-16">
52
+ <div class="flex items-center">
53
+ <div class="flex-shrink-0 flex items-center">
54
+ <i data-feather="layers" class="text-primary-600 h-8 w-8"></i>
55
+ <span class="ml-2 text-xl font-bold text-gray-900">Agrosynth OS</span>
56
+ </div>
57
+ </div>
58
+ <div class="hidden md:ml-6 md:flex md:items-center md:space-x-8">
59
+ <a href="#" class="text-primary-600 font-medium">Home</a>
60
+ <a href="#" class="text-gray-500 hover:text-gray-900 font-medium">Features</a>
61
+ <a href="#" class="text-gray-500 hover:text-gray-900 font-medium">Pricing</a>
62
+ <a href="#" class="text-gray-500 hover:text-gray-900 font-medium">Docs</a>
63
+ <a href="/dashboard" class="bg-primary-600 text-white px-4 py-2 rounded-md font-medium hover:bg-primary-700 transition duration-150 ease-in-out">Dashboard</a>
64
+ </div>
65
+ <div class="-mr-2 flex items-center md:hidden">
66
+ <button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-gray-500 hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-primary-500" aria-expanded="false">
67
+ <i data-feather="menu"></i>
68
+ </button>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ </nav>
73
+
74
+ <!-- Hero Section -->
75
+ <div class="hero-gradient text-white">
76
+ <div class="max-w-7xl mx-auto py-24 px-4 sm:px-6 lg:px-8">
77
+ <div class="text-center">
78
+ <h1 class="text-4xl font-extrabold tracking-tight sm:text-5xl lg:text-6xl" data-aos="fade-down">
79
+ Precision Agriculture Powered by AI
80
+ </h1>
81
+ <p class="mt-6 max-w-lg mx-auto text-xl" data-aos="fade-down" data-aos-delay="100">
82
+ Satellite imagery, drone data, and blockchain certification in one unified platform.
83
+ </p>
84
+ <div class="mt-10 flex justify-center space-x-4" data-aos="fade-up" data-aos-delay="200">
85
+ <a href="/dashboard" class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md shadow-sm text-primary-700 bg-white hover:bg-gray-50 glow">
86
+ Get Started
87
+ </a>
88
+ <a href="#" class="inline-flex items-center px-6 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary-700 bg-opacity-60 hover:bg-opacity-70">
89
+ <i data-feather="play" class="mr-2 h-4 w-4"></i> Watch Demo
90
+ </a>
91
+ </div>
92
+ </div>
93
+ </div>
94
+ </div>
95
+
96
+ <!-- Features Section -->
97
+ <div class="py-12 bg-white">
98
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
99
+ <div class="lg:text-center">
100
+ <h2 class="text-base text-primary-600 font-semibold tracking-wide uppercase" data-aos="fade-down">Features</h2>
101
+ <p class="mt-2 text-3xl leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl" data-aos="fade-down">
102
+ Everything you need for modern farming
103
+ </p>
104
+ </div>
105
+
106
+ <div class="mt-10">
107
+ <div class="grid grid-cols-1 gap-10 sm:grid-cols-2 lg:grid-cols-3">
108
+ <!-- Feature 1 -->
109
+ <div class="feature-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300 ease-in-out" data-aos="fade-up">
110
+ <div class="p-6">
111
+ <div class="flex items-center">
112
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
113
+ <i data-feather="map" class="h-6 w-6 text-primary-600"></i>
114
+ </div>
115
+ <div class="ml-5">
116
+ <h3 class="text-lg font-medium text-gray-900">Satellite & Drone Fusion</h3>
117
+ </div>
118
+ </div>
119
+ <div class="mt-4 text-gray-500">
120
+ Combine high-resolution satellite imagery with drone-collected data for complete field analysis.
121
+ </div>
122
+ </div>
123
+ </div>
124
+
125
+ <!-- Feature 2 -->
126
+ <div class="feature-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300 ease-in-out" data-aos="fade-up" data-aos-delay="100">
127
+ <div class="p-6">
128
+ <div class="flex items-center">
129
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
130
+ <i data-feather="activity" class="h-6 w-6 text-primary-600"></i>
131
+ </div>
132
+ <div class="ml-5">
133
+ <h3 class="text-lg font-medium text-gray-900">AI Yield Prediction</h3>
134
+ </div>
135
+ </div>
136
+ <div class="mt-4 text-gray-500">
137
+ Our machine learning models analyze historical and current data to forecast yields with 92% accuracy.
138
+ </div>
139
+ </div>
140
+ </div>
141
+
142
+ <!-- Feature 3 -->
143
+ <div class="feature-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300 ease-in-out" data-aos="fade-up" data-aos-delay="200">
144
+ <div class="p-6">
145
+ <div class="flex items-center">
146
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
147
+ <i data-feather="eye" class="h-6 w-6 text-primary-600"></i>
148
+ </div>
149
+ <div class="ml-5">
150
+ <h3 class="text-lg font-medium text-gray-900">AR/VR Planning</h3>
151
+ </div>
152
+ </div>
153
+ <div class="mt-4 text-gray-500">
154
+ Visualize crop rotations and growth simulations in augmented and virtual reality environments.
155
+ </div>
156
+ </div>
157
+ </div>
158
+
159
+ <!-- Feature 4 -->
160
+ <div class="feature-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300 ease-in-out" data-aos="fade-up">
161
+ <div class="p-6">
162
+ <div class="flex items-center">
163
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
164
+ <i data-feather="shield" class="h-6 w-6 text-primary-600"></i>
165
+ </div>
166
+ <div class="ml-5">
167
+ <h3 class="text-lg font-medium text-gray-900">Blockchain Certification</h3>
168
+ </div>
169
+ </div>
170
+ <div class="mt-4 text-gray-500">
171
+ Tamper-proof certificates for organic and sustainable farming practices anchored on blockchain.
172
+ </div>
173
+ </div>
174
+ </div>
175
+
176
+ <!-- Feature 5 -->
177
+ <div class="feature-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300 ease-in-out" data-aos="fade-up" data-aos-delay="100">
178
+ <div class="p-6">
179
+ <div class="flex items-center">
180
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
181
+ <i data-feather="bar-chart-2" class="h-6 w-6 text-primary-600"></i>
182
+ </div>
183
+ <div class="ml-5">
184
+ <h3 class="text-lg font-medium text-gray-900">Real-time Analytics</h3>
185
+ </div>
186
+ </div>
187
+ <div class="mt-4 text-gray-500">
188
+ Monitor soil health, moisture levels, and crop growth with real-time dashboards and alerts.
189
+ </div>
190
+ </div>
191
+ </div>
192
+
193
+ <!-- Feature 6 -->
194
+ <div class="feature-card bg-white rounded-lg overflow-hidden shadow-md transition duration-300 ease-in-out" data-aos="fade-up" data-aos-delay="200">
195
+ <div class="p-6">
196
+ <div class="flex items-center">
197
+ <div class="flex-shrink-0 bg-primary-100 rounded-md p-3">
198
+ <i data-feather="dollar-sign" class="h-6 w-6 text-primary-600"></i>
199
+ </div>
200
+ <div class="ml-5">
201
+ <h3 class="text-lg font-medium text-gray-900">Market Pricing</h3>
202
+ </div>
203
+ </div>
204
+ <div class="mt-4 text-gray-500">
205
+ Access commodity pricing data and connect directly with buyers through our marketplace.
206
+ </div>
207
+ </div>
208
+ </div>
209
+ </div>
210
+ </div>
211
+ </div>
212
+ </div>
213
+
214
+ <!-- Pricing Section -->
215
+ <div class="bg-gray-50 py-12">
216
+ <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
217
+ <div class="lg:text-center">
218
+ <h2 class="text-base text-primary-600 font-semibold tracking-wide uppercase" data-aos="fade-down">Pricing</h2>
219
+ <p class="mt-2 text-3xl leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl" data-aos="fade-down">
220
+ Simple, transparent pricing
221
+ </p>
222
+ </div>
223
+
224
+ <div class="mt-16 grid grid-cols-1 gap-8 lg:grid-cols-2">
225
+ <!-- Essential Plan -->
226
+ <div class="bg-white rounded-lg shadow-md overflow-hidden" data-aos="fade-right">
227
+ <div class="p-6">
228
+ <h3 class="text-2xl font-bold text-gray-900">Essential Farm Insight</h3>
229
+ <p class="mt-4 text-gray-500">Perfect for small to medium farms</p>
230
+ <div class="mt-6">
231
+ <p class="text-4xl font-extrabold text-gray-900">$150<span class="text-xl font-medium text-gray-500">/100ha monthly</span></p>
232
+ <p class="mt-2 text-gray-500">or $1,500 annually (save 17%)</p>
233
+ </div>
234
+ <ul class="mt-6 space-y-4">
235
+ <li class="flex items-start">
236
+ <i data-feather="check" class="h-5 w-5 text-primary-500"></i>
237
+ <span class="ml-3 text-gray-700">Weekly satellite overlays</span>
238
+ </li>
239
+ <li class="flex items-start">
240
+ <i data-feather="check" class="h-5 w-5 text-primary-500"></i>
241
+ <span class="ml-3 text-gray-700">Basic AR/VR visualization</span>
242
+ </li>
243
+ <li class="flex items-start">
244
+ <i data-feather="check" class="h-5 w-5 text-primary-500"></i>
245
+ <span class="ml-3 text-gray-700">Up to 1,000 hectares</span>
246
+ </li>
247
+ <li class="flex items-start">
248
+ <i data-feather="check" class="h-5 w-5 text-primary-500"></i>
249
+ <span class="ml-3 text-gray-700">Email support</span>
250
+ </li>
251
+ </ul>
252
+ <div class="mt-8">
253
+ <a href="#" class="w-full flex items-center justify-center px-6 py-3 border border-transparent rounded-md shadow-sm text-base font-medium text-white bg-primary-600 hover:bg-primary-700">
254
+ Get started
255
+ </a>
256
+ </div>
257
+ </div>
258
+ </div>
259
+
260
+ <!-- Pro Plan -->
261
+ <div class="bg-white rounded-lg shadow-md overflow-hidden" data-aos="fade-left">
262
+ <div class="bg-primary-700 px-6 py-4">
263
+ <h3 class="text-2xl font-bold text-white">Precision Growth Pro</h3>
264
+ <p class="mt-1 text-primary-100">For large farms and agribusinesses</p>
265
+ </div>
266
+ <div class="p-6">
267
+ <div class="mt-2">
268
+ <p class="text-4xl font-extrabold text-gray-900">$1,200<span class="text-xl font-medium text-gray-500">/1,000ha monthly</span></p>
269
+ <p class="mt-2 text-gray-500">or $12,000 annually (save 17%)</p>
270
+ </div>
271
+ <ul class="mt-6 space-y-4">
272
+ <li class="flex items-start">
273
+ <i data-feather="check" class="h-5 w-5 text-primary-500"></i>
274
+ <span class="ml-3 text-gray-700">Quarterly drone lidar scans</span>
275
+ </li>
276
+ <li class="flex items-start">
277
+ <i data-feather="check" class="h-5 w-5 text-primary-500"></i>
278
+ <span class="ml-3 text-gray-700">Advanced VR scenarios</span>
279
+ </li>
280
+ <li class="flex items-start">
281
+ <i data-feather="check" class="h-5 w-5 text-primary-500"></i>
282
+ <span class="ml-3 text-gray-700">Blockchain certification</span>
283
+ </li>
284
+ <li class="flex items-start">
285
+ <i data-feather="check" class="h-5 w-5 text-primary-500"></i>
286
+ <span class="ml-3 text-gray-700">Priority 24/7 support</span>
287
+ </li>
288
+ </ul>
289
+ <div class="mt-8">
290
+ <a href="#" class="w-full flex items-center justify-center px-6 py-3 border border-transparent rounded-md shadow-sm text-base font-medium text-white bg-primary-600 hover:bg-primary-700 glow">
291
+ Get started
292
+ </a>
293
+ </div>
294
+ </div>
295
+ </div>
296
+ </div>
297
+ </div>
298
+ </div>
299
+
300
+ <!-- CTA Section -->
301
+ <div class="bg-primary-700">
302
+ <div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:py-16 lg:px-8 lg:flex lg:items-center lg:justify-between">
303
+ <h2 class="text-3xl font-extrabold tracking-tight text-white sm:text-4xl" data-aos="fade-right">
304
+ <span class="block">Ready to transform your farming?</span>
305
+ <span class="block text-primary-200">Start your free 14-day trial today.</span>
306
+ </h2>
307
+ <div class="mt-8 flex lg:mt-0 lg:flex-shrink-0" data-aos="fade-left">
308
+ <div class="inline-flex rounded-md shadow">
309
+ <a href="/dashboard" class="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base font-medium rounded-md text-primary-600 bg-white hover:bg-gray-50">
310
+ Get started
311
+ </a>
312
+ </div>
313
+ <div class="ml-3 inline-flex rounded-md shadow">
314
+ <a href="#" class="inline-flex items-center justify-center px-5 py-3 border border-transparent text-base font-medium rounded-md text-white bg-primary-600 bg-opacity-60 hover:bg-opacity-70">
315
+ <i data-feather="message-square" class="mr-2 h-4 w-4"></i> Contact sales
316
+ </a>
317
+ </div>
318
+ </div>
319
+ </div>
320
+ </div>
321
+
322
+ <!-- Footer -->
323
+ <footer class="bg-white">
324
+ <div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:py-16 lg:px-8">
325
+ <div class="grid grid-cols-2 gap-8 md:grid-cols-4">
326
+ <div>
327
+ <h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">Product</h3>
328
+ <ul class="mt-4 space-y-4">
329
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Features</a></li>
330
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Pricing</a></li>
331
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">API</a></li>
332
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Integrations</a></li>
333
+ </ul>
334
+ </div>
335
+ <div>
336
+ <h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">Resources</h3>
337
+ <ul class="mt-4 space-y-4">
338
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Documentation</a></li>
339
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Guides</a></li>
340
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Blog</a></li>
341
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Webinars</a></li>
342
+ </ul>
343
+ </div>
344
+ <div>
345
+ <h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">Company</h3>
346
+ <ul class="mt-4 space-y-4">
347
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">About</a></li>
348
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Careers</a></li>
349
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Press</a></li>
350
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Partners</a></li>
351
+ </ul>
352
+ </div>
353
+ <div>
354
+ <h3 class="text-sm font-semibold text-gray-500 tracking-wider uppercase">Legal</h3>
355
+ <ul class="mt-4 space-y-4">
356
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Privacy</a></li>
357
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Terms</a></li>
358
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Security</a></li>
359
+ <li><a href="#" class="text-base text-gray-500 hover:text-gray-900">Compliance</a></li>
360
+ </ul>
361
+ </div>
362
+ </div>
363
+ <div class="mt-12 border-t border-gray-200 pt-8">
364
+ <p class="text-base text-gray-400 text-center">
365
+ &copy; 2023 Agrosynth OS. All rights reserved.
366
+ </p>
367
+ </div>
368
+ </div>
369
+ </footer>
370
+
371
+ <script>
372
+ AOS.init({
373
+ duration: 800,
374
+ easing: 'ease-in-out',
375
+ once: true
376
+ });
377
+ </script>
378
+ <script>
379
+ feather.replace();
380
+ </script>
381
+ </body>
382
  </html>
prompts.txt ADDED
@@ -0,0 +1,652 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Agrosynth OS — Monorepo (MVP Code + Security-First Scaffold)
2
+
3
+ > Production-ready scaffold for an AI-driven ag platform with AR/VR, satellite+drone data fusion, blockchain-backed certification, and zero-trust security. Includes: FastAPI backend, AI microservice, Next.js frontend, Solidity contracts, Unity XR stubs, data-provider adapters, and DevSecOps (Docker/K8s/OPA/mTLS).
4
+
5
+ ---
6
+
7
+ ## Repository Layout
8
+
9
+ ```
10
+ agrosynth/
11
+ ├─ README.md
12
+ ├─ docker-compose.yml
13
+ ├─ .env.example
14
+ ├─ package.json
15
+ ├─ pnpm-workspace.yaml
16
+ ├─ k8s/
17
+ │ ├─ base/
18
+ │ │ ├─ namespace.yaml
19
+ │ │ ├─ gateway.yaml
20
+ │ │ ├─ opa-gatekeeper.yaml
21
+ │ │ └─ cert-manager.yaml
22
+ │ └─ overlays/prod/
23
+ │ ├─ backend.yaml
24
+ │ ├─ ai-service.yaml
25
+ │ ├─ frontend.yaml
26
+ │ ├─ ingress.yaml
27
+ │ └─ networkpolicies.yaml
28
+ ├─ security/
29
+ │ ├─ THREAT_MODEL.md
30
+ │ ├─ OPA_POLICIES.rego
31
+ │ ├─ mtls/
32
+ │ │ ├─ generate.sh
33
+ │ │ └─ openssl.cnf
34
+ │ └─ sops.yaml
35
+ ├─ backend/ # FastAPI + Postgres + Redis + OPA sidecar
36
+ │ ├─ pyproject.toml
37
+ │ ├─ agrosynth/
38
+ │ │ ├─ __init__.py
39
+ │ │ ├─ main.py
40
+ │ │ ├─ config.py
41
+ │ │ ├─ db.py
42
+ │ │ ├─ deps.py
43
+ │ │ ├─ security.py
44
+ │ │ ├─ routers/
45
+ │ │ │ ├─ auth.py
46
+ │ │ │ ├─ farms.py
47
+ │ │ │ ├─ datasets.py
48
+ │ │ │ ├─ certificates.py
49
+ │ │ │ ├─ pricing.py
50
+ │ │ │ └─ xr.py
51
+ │ │ ├─ models/
52
+ │ │ │ ├─ user.py
53
+ │ │ │ ├─ farm.py
54
+ │ │ │ ├─ dataset.py
55
+ │ │ │ └─ certificate.py
56
+ │ │ └─ schemas/
57
+ │ │ ├─ auth.py
58
+ │ │ ├─ farm.py
59
+ │ │ ├─ dataset.py
60
+ │ │ └─ certificate.py
61
+ │ └─ tests/
62
+ ├─ ai-service/ # FastAPI (inference), Torch/TF optional
63
+ │ ├─ pyproject.toml
64
+ │ ├─ service/
65
+ │ │ ├─ main.py
66
+ │ │ ├─ models/
67
+ │ │ │ ├─ yield_forecaster.py
68
+ │ │ │ └─ soil_health.py
69
+ │ │ └─ pipelines/
70
+ │ │ ├─ fuse_satellite_drone.py
71
+ │ │ └─ feature_store.py
72
+ ├─ data-providers/
73
+ │ ├─ sentinel/
74
+ │ │ ├─ client.py
75
+ │ │ └─ tiling.py
76
+ │ ├─ planet/
77
+ │ │ └─ client.py
78
+ │ └─ drone/
79
+ │ ├─ photogrammetry.py
80
+ │ └─ lidar_ingest.py
81
+ ├─ cert-service/ # PDF generator + blockchain anchoring
82
+ │ ├─ pyproject.toml
83
+ │ ├─ service/
84
+ │ │ ├─ main.py
85
+ │ │ ├─ builder.py
86
+ │ │ └─ zk_proofs.py
87
+ ├─ blockchain/
88
+ │ ├─ hardhat.config.ts
89
+ │ ├─ contracts/
90
+ │ │ ├─ AgroCertificate.sol
91
+ │ │ └─ AgroYieldToken.sol
92
+ │ ├─ scripts/
93
+ │ │ ├─ deploy.ts
94
+ │ │ └─ verify.ts
95
+ │ └─ test/
96
+ ├─ frontend/ # Next.js 14 (App Router) + Tailwind
97
+ │ ├─ package.json
98
+ │ ├─ next.config.js
99
+ │ ├─ tailwind.config.ts
100
+ │ ├─ postcss.config.js
101
+ │ ├─ app/
102
+ │ │ ├─ layout.tsx
103
+ │ │ ├─ page.tsx
104
+ │ │ ├─ dashboard/page.tsx
105
+ │ │ └─ api/
106
+ │ │ └─ proxy/[...path]/route.ts
107
+ │ ├─ components/
108
+ │ │ ├─ MapPanel.tsx
109
+ │ │ ├─ XRStatus.tsx
110
+ │ │ └─ PricingTable.tsx
111
+ ├─ xr-ar/ # Unity C# stubs (Meta Ray-Ban compatible SDK hooks)
112
+ │ └─ Scripts/
113
+ │ ├─ ARCropOverlay.cs
114
+ │ ├─ AuthClient.cs
115
+ │ └─ TelemetryPublisher.cs
116
+ ├─ vr-sim/
117
+ │ └─ Scripts/
118
+ │ ├─ SatelliteTerrainLoader.cs
119
+ │ ├─ GrowthSimulator.cs
120
+ │ └─ ScenarioManager.cs
121
+ └─ infra/
122
+ ├─ docker/
123
+ │ ├─ backend.Dockerfile
124
+ │ ├─ ai-service.Dockerfile
125
+ │ ├─ cert-service.Dockerfile
126
+ │ └─ frontend.Dockerfile
127
+ └─ opa/
128
+ └─ policy.rego
129
+ ```
130
+
131
+ ---
132
+
133
+ ## docker-compose.yml (dev)
134
+
135
+ ```yaml
136
+ version: "3.9"
137
+ services:
138
+ db:
139
+ image: postgres:16-alpine
140
+ environment:
141
+ POSTGRES_USER: agrosynth
142
+ POSTGRES_PASSWORD: agrosynth
143
+ POSTGRES_DB: agrosynth
144
+ ports: ["5432:5432"]
145
+ volumes:
146
+ - dbdata:/var/lib/postgresql/data
147
+ redis:
148
+ image: redis:7-alpine
149
+ ports: ["6379:6379"]
150
+ backend:
151
+ build: ./infra/docker/backend.Dockerfile
152
+ env_file: .env
153
+ depends_on: [db, redis]
154
+ ports: ["8000:8000"]
155
+ ai:
156
+ build: ./infra/docker/ai-service.Dockerfile
157
+ env_file: .env
158
+ ports: ["8001:8001"]
159
+ certsvc:
160
+ build: ./infra/docker/cert-service.Dockerfile
161
+ env_file: .env
162
+ ports: ["8002:8002"]
163
+ frontend:
164
+ build: ./infra/docker/frontend.Dockerfile
165
+ env_file: .env
166
+ ports: ["3000:3000"]
167
+ volumes:
168
+ dbdata:
169
+ ```
170
+
171
+ ---
172
+
173
+ ## backend/agrosynth/config.py
174
+
175
+ ```python
176
+ from pydantic import BaseSettings, AnyHttpUrl
177
+ from functools import lru_cache
178
+
179
+ class Settings(BaseSettings):
180
+ PROJECT_NAME: str = "Agrosynth OS"
181
+ API_V1_STR: str = "/api/v1"
182
+ DATABASE_URL: str
183
+ REDIS_URL: str = "redis://redis:6379/0"
184
+
185
+ JWT_PUBLIC_KEY: str
186
+ JWT_ALGORITHM: str = "RS256"
187
+ OPA_URL: AnyHttpUrl = "http://opa:8181"
188
+ AI_SERVICE_URL: AnyHttpUrl = "http://ai:8001"
189
+ CERT_SERVICE_URL: AnyHttpUrl = "http://certsvc:8002"
190
+
191
+ # mTLS client certs paths (mounted secrets in prod)
192
+ CLIENT_CERT_PATH: str = "/etc/mtls/client.crt"
193
+ CLIENT_KEY_PATH: str = "/etc/mtls/client.key"
194
+ CA_CERT_PATH: str = "/etc/mtls/ca.crt"
195
+
196
+ class Config:
197
+ env_file = ".env"
198
+
199
+ @lru_cache()
200
+ def get_settings() -> Settings:
201
+ return Settings()
202
+ ```
203
+
204
+ ---
205
+
206
+ ## backend/agrosynth/security.py (Zero Trust hooks)
207
+
208
+ ```python
209
+ from fastapi import Depends, HTTPException, status, Request
210
+ from jose import jwt
211
+ from .config import get_settings
212
+ import httpx
213
+
214
+ settings = get_settings()
215
+
216
+ async def opa_authorize(request: Request, action: str, resource: str):
217
+ # Query OPA with input {subject, action, resource}
218
+ async with httpx.AsyncClient() as client:
219
+ payload = {
220
+ "input": {
221
+ "path": request.url.path,
222
+ "method": request.method,
223
+ "subject": request.headers.get("x-subject", "anon"),
224
+ "action": action,
225
+ "resource": resource,
226
+ "claims": request.state.claims if hasattr(request.state, 'claims') else {}
227
+ }
228
+ }
229
+ r = await client.post(f"{settings.OPA_URL}/v1/data/agrosynth/authz/allow", json=payload)
230
+ allowed = r.json().get("result", False)
231
+ if not allowed:
232
+ raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail="Unauthorized by policy")
233
+
234
+ async def authenticate(request: Request):
235
+ auth = request.headers.get("authorization", "")
236
+ if not auth.startswith("Bearer "):
237
+ raise HTTPException(status_code=401, detail="Missing token")
238
+ token = auth.split(" ",1)[1]
239
+ try:
240
+ claims = jwt.decode(token, settings.JWT_PUBLIC_KEY, algorithms=[settings.JWT_ALGORITHM])
241
+ request.state.claims = claims
242
+ return claims
243
+ except Exception:
244
+ raise HTTPException(status_code=401, detail="Invalid token")
245
+ ```
246
+
247
+ ---
248
+
249
+ ## backend/agrosynth/main.py
250
+
251
+ ```python
252
+ from fastapi import FastAPI, Request
253
+ from fastapi.middleware.cors import CORSMiddleware
254
+ from .config import get_settings
255
+ from .routers import auth, farms, datasets, certificates, pricing, xr
256
+
257
+ app = FastAPI(title=get_settings().PROJECT_NAME, version="0.1.0")
258
+
259
+ app.add_middleware(
260
+ CORSMiddleware,
261
+ allow_origins=["*"],
262
+ allow_credentials=True,
263
+ allow_methods=["*"],
264
+ allow_headers=["*"]
265
+ )
266
+
267
+ app.include_router(auth.router, prefix="/api/v1/auth", tags=["auth"])
268
+ app.include_router(farms.router, prefix="/api/v1/farms", tags=["farms"])
269
+ app.include_router(datasets.router, prefix="/api/v1/datasets", tags=["datasets"])
270
+ app.include_router(certificates.router, prefix="/api/v1/certificates", tags=["certificates"])
271
+ app.include_router(pricing.router, prefix="/api/v1/pricing", tags=["pricing"])
272
+ app.include_router(xr.router, prefix="/api/v1/xr", tags=["xr"])
273
+
274
+ @app.get("/health")
275
+ async def health():
276
+ return {"status":"ok"}
277
+ ```
278
+
279
+ ---
280
+
281
+ ## backend/agrosynth/routers/pricing.py (Two-tier pricing)
282
+
283
+ ```python
284
+ from fastapi import APIRouter, Depends
285
+ from pydantic import BaseModel
286
+
287
+ router = APIRouter()
288
+
289
+ class PricingQuote(BaseModel):
290
+ tier: str # "essential" or "pro"
291
+ hectares: int
292
+ billing: str # "monthly" or "annual"
293
+
294
+ @router.post("/quote")
295
+ async def quote(q: PricingQuote):
296
+ if q.tier == "essential":
297
+ unit = 150 if q.billing == "monthly" else 1500
298
+ per = 100
299
+ else:
300
+ unit = 1200 if q.billing == "monthly" else 12000
301
+ per = 1000
302
+ blocks = max(1, -(-q.hectares // per)) # ceil division
303
+ total = unit * blocks
304
+ return {"tier": q.tier, "billing": q.billing, "hectares": q.hectares, "blocks": blocks, "total": total}
305
+ ```
306
+
307
+ ---
308
+
309
+ ## backend/agrosynth/routers/certificates.py (Certificate + anchor)
310
+
311
+ ```python
312
+ from fastapi import APIRouter, Depends, HTTPException
313
+ from pydantic import BaseModel
314
+ import httpx
315
+ from ..config import get_settings
316
+
317
+ router = APIRouter()
318
+
319
+ class CertRequest(BaseModel):
320
+ farm_id: str
321
+ metrics: dict # soil scores, yield, regen practices
322
+
323
+ @router.post("/")
324
+ async def issue_certificate(req: CertRequest):
325
+ settings = get_settings()
326
+ async with httpx.AsyncClient() as client:
327
+ # build PDF + ZK proof inside cert-service
328
+ r = await client.post(f"{settings.CERT_SERVICE_URL}/build", json=req.dict())
329
+ r.raise_for_status()
330
+ data = r.json()
331
+ # data = { pdf_url, onchain_tx, hash }
332
+ return data
333
+ ```
334
+
335
+ ---
336
+
337
+ ## ai-service/service/models/yield_forecaster.py (stub)
338
+
339
+ ```python
340
+ from typing import Dict
341
+ import numpy as np
342
+
343
+ class YieldForecaster:
344
+ def __init__(self):
345
+ # load model(s) here
346
+ pass
347
+
348
+ def predict(self, features: Dict) -> Dict:
349
+ # stub: replace with real ML
350
+ rain = features.get("rain_mm", 100)
351
+ ndvi = features.get("ndvi", 0.6)
352
+ soil = features.get("soil_score", 0.7)
353
+ yield_t_ha = max(0.0, (ndvi*4.0 + soil*2.0) * (1 + (rain-100)/800))
354
+ return {"yield_t_ha": round(yield_t_ha, 2), "confidence": 0.75}
355
+ ```
356
+
357
+ ---
358
+
359
+ ## ai-service/service/main.py
360
+
361
+ ```python
362
+ from fastapi import FastAPI
363
+ from pydantic import BaseModel
364
+ from .models.yield_forecaster import YieldForecaster
365
+
366
+ app = FastAPI(title="AI Service")
367
+ model = YieldForecaster()
368
+
369
+ class FeaturePayload(BaseModel):
370
+ rain_mm: float
371
+ ndvi: float
372
+ soil_score: float
373
+
374
+ @app.post("/forecast")
375
+ async def forecast(p: FeaturePayload):
376
+ return model.predict(p.dict())
377
+ ```
378
+
379
+ ---
380
+
381
+ ## cert-service/service/builder.py (PDF + hash stub)
382
+
383
+ ```python
384
+ import hashlib
385
+ from datetime import datetime
386
+
387
+ TEMPLATE = """Agrosynth Certification\nFarm: {farm_id}\nDate: {date}\nMetrics: {metrics}\nHash: {digest}\n"""
388
+
389
+ def build_pdf(farm_id: str, metrics: dict) -> dict:
390
+ payload = f"{farm_id}|{metrics}|{datetime.utcnow().isoformat()}".encode()
391
+ digest = hashlib.sha256(payload).hexdigest()
392
+ # TODO: generate real PDF and store to object storage
393
+ pdf_url = f"https://storage/agrosynth/certs/{farm_id}-{digest}.pdf"
394
+ return {"pdf_url": pdf_url, "hash": digest}
395
+ ```
396
+
397
+ ---
398
+
399
+ ## cert-service/service/zk_proofs.py (placeholder interfaces)
400
+
401
+ ```python
402
+ # Interfaces for ZK proof generation/verification (hook up to snarkjs/zk-kit)
403
+
404
+ def prove_cert(metrics: dict) -> dict:
405
+ # Return proof that metrics satisfy rules without revealing raw data
406
+ return {"proof": "0xPROOF", "publicSignals": {"passed": True}}
407
+
408
+ def verify_proof(proof: dict) -> bool:
409
+ return proof.get("publicSignals", {}).get("passed", False)
410
+ ```
411
+
412
+ ---
413
+
414
+ ## cert-service/service/main.py
415
+
416
+ ```python
417
+ from fastapi import FastAPI, HTTPException
418
+ from pydantic import BaseModel
419
+ from .builder import build_pdf
420
+ from .zk_proofs import prove_cert, verify_proof
421
+
422
+ app = FastAPI(title="Cert Service")
423
+
424
+ class CertPayload(BaseModel):
425
+ farm_id: str
426
+ metrics: dict
427
+
428
+ @app.post("/build")
429
+ async def build(p: CertPayload):
430
+ pdf = build_pdf(p.farm_id, p.metrics)
431
+ proof = prove_cert(p.metrics)
432
+ if not verify_proof(proof):
433
+ raise HTTPException(400, "ZK verification failed")
434
+ # TODO: anchor pdf.hash to blockchain via blockchain service
435
+ return {"pdf_url": pdf["pdf_url"], "hash": pdf["hash"], "zk": proof, "onchain_tx": "0xTX"}
436
+ ```
437
+
438
+ ---
439
+
440
+ ## blockchain/contracts/AgroCertificate.sol
441
+
442
+ ```solidity
443
+ // SPDX-License-Identifier: MIT
444
+ pragma solidity ^0.8.24;
445
+
446
+ contract AgroCertificate {
447
+ event CertificateAnchored(bytes32 hash, address indexed issuer, string uri);
448
+
449
+ address public owner;
450
+
451
+ constructor() {
452
+ owner = msg.sender;
453
+ }
454
+
455
+ function anchorCertificate(bytes32 docHash, string calldata uri) external {
456
+ // In production add role-based access + EIP-712 signatures from cert-service
457
+ emit CertificateAnchored(docHash, msg.sender, uri);
458
+ }
459
+ }
460
+ ```
461
+
462
+ ---
463
+
464
+ ## blockchain/contracts/AgroYieldToken.sol
465
+
466
+ ```solidity
467
+ // SPDX-License-Identifier: MIT
468
+ pragma solidity ^0.8.24;
469
+
470
+ import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
471
+ import "@openzeppelin/contracts/access/Ownable.sol";
472
+
473
+ contract AgroYieldToken is ERC20, Ownable {
474
+ constructor() ERC20("AgroYield", "AGY") {}
475
+
476
+ function issue(address to, uint256 amount) external onlyOwner {
477
+ _mint(to, amount);
478
+ }
479
+ }
480
+ ```
481
+
482
+ ---
483
+
484
+ ## frontend/app/page.tsx
485
+
486
+ ```tsx
487
+ export default function Home() {
488
+ return (
489
+ <main className="p-8 max-w-5xl mx-auto">
490
+ <h1 className="text-3xl font-bold">Agrosynth OS</h1>
491
+ <p className="mt-2 text-gray-600">AI-driven agriculture with AR/VR planning and blockchain certification.</p>
492
+ <div className="mt-6 grid gap-4 md:grid-cols-2">
493
+ <a className="p-4 border rounded-xl" href="/dashboard">Open Dashboard</a>
494
+ <a className="p-4 border rounded-xl" href="/pricing">See Pricing</a>
495
+ </div>
496
+ </main>
497
+ );
498
+ }
499
+ ```
500
+
501
+ ---
502
+
503
+ ## frontend/app/dashboard/page.tsx
504
+
505
+ ```tsx
506
+ 'use client';
507
+ import { useState } from 'react';
508
+
509
+ export default function Dashboard() {
510
+ const [quote, setQuote] = useState<any>(null);
511
+ async function getQuote() {
512
+ const res = await fetch('/api/proxy/api/v1/pricing/quote', {
513
+ method: 'POST',
514
+ headers: { 'content-type': 'application/json' },
515
+ body: JSON.stringify({ tier: 'essential', hectares: 1000, billing: 'annual' })
516
+ });
517
+ setQuote(await res.json());
518
+ }
519
+ return (
520
+ <div className="p-8">
521
+ <h2 className="text-2xl font-semibold">Farm Dashboard</h2>
522
+ <button onClick={getQuote} className="mt-4 px-4 py-2 rounded bg-black text-white">Get Pricing Quote</button>
523
+ {quote && (<pre className="mt-4 p-4 bg-gray-50 border rounded">{JSON.stringify(quote, null, 2)}</pre>)}
524
+ </div>
525
+ );
526
+ }
527
+ ```
528
+
529
+ ---
530
+
531
+ ## frontend/components/PricingTable.tsx
532
+
533
+ ```tsx
534
+ export function PricingTable() {
535
+ return (
536
+ <div className="grid gap-6 md:grid-cols-2">
537
+ <div className="border rounded-2xl p-6">
538
+ <h3 className="text-xl font-bold">Essential Farm Insight</h3>
539
+ <ul className="mt-3 list-disc pl-5 text-sm">
540
+ <li>Weekly high-res satellite overlays</li>
541
+ <li>AR overlays, basic VR simulation</li>
542
+ <li>Up to 1,000 hectares</li>
543
+ </ul>
544
+ <p className="mt-4 text-sm text-gray-600">$150 / 100 ha monthly · $1,500 / 100 ha annual</p>
545
+ </div>
546
+ <div className="border rounded-2xl p-6">
547
+ <h3 className="text-xl font-bold">Precision Growth Pro</h3>
548
+ <ul className="mt-3 list-disc pl-5 text-sm">
549
+ <li>Quarterly drone lidar + photogrammetry</li>
550
+ <li>Advanced VR scenarios, blockchain certs</li>
551
+ <li>1,000–5,000 hectares (volume discounts)</li>
552
+ </ul>
553
+ <p className="mt-4 text-sm text-gray-600">$1,200 / 1,000 ha monthly · $12,000 / 1,000 ha annual</p>
554
+ </div>
555
+ </div>
556
+ );
557
+ }
558
+ ```
559
+
560
+ ---
561
+
562
+ ## xr-ar/Scripts/ARCropOverlay.cs (Unity C# stub)
563
+
564
+ ```csharp
565
+ using UnityEngine;
566
+ using System.Collections;
567
+
568
+ public class ARCropOverlay : MonoBehaviour {
569
+ public string farmId;
570
+ void Start() {
571
+ // TODO: init AR session, auth, fetch overlays
572
+ }
573
+ void Update() {
574
+ // TODO: render NDVI heatmap + task hints
575
+ }
576
+ }
577
+ ```
578
+
579
+ ---
580
+
581
+ ## vr-sim/Scripts/SatelliteTerrainLoader.cs (Unity C# stub)
582
+
583
+ ```csharp
584
+ using UnityEngine;
585
+
586
+ public class SatelliteTerrainLoader : MonoBehaviour {
587
+ public double lat; public double lon; public int zoom = 16;
588
+ void Start() {
589
+ // TODO: fetch tiles, build mesh, apply DEM/DSM if available
590
+ }
591
+ }
592
+ ```
593
+
594
+ ---
595
+
596
+ ## security/OPA_POLICIES.rego (Zero-Trust authz)
597
+
598
+ ```rego
599
+ package agrosynth.authz
600
+
601
+ default allow = false
602
+
603
+ allow {
604
+ input.subject == "system:health"
605
+ }
606
+
607
+ # Example: only users with role admin can issue certificates
608
+ allow {
609
+ input.path == "/api/v1/certificates"
610
+ input.method == "POST"
611
+ input.claims.roles[_] == "admin"
612
+ }
613
+ ```
614
+
615
+ ---
616
+
617
+ ## security/THREAT_MODEL.md (excerpt)
618
+
619
+ ```md
620
+ # Threat Model (excerpt)
621
+ - Insider: mitigate via least-privilege, OPA policies, m-of-n approvals.
622
+ - DDoS: Anycast edge + rate limiting + autoscale + WAF.
623
+ - Supply chain: SBOM, signed artifacts, secure boot, model provenance.
624
+ - Blockchain poisoning: validator allow-lists, signed sensor data, anchor hashes.
625
+ - Firmware backdoors: remote attestation, TPM, enclave key ops.
626
+ - Social engineering: phishing-resistant MFA, XR confirmation guards.
627
+ ```
628
+
629
+ ---
630
+
631
+ ## README.md (Quickstart)
632
+
633
+ ```md
634
+ # Agrosynth OS
635
+
636
+ ## Dev quickstart
637
+
638
+ ```bash
639
+ cp .env.example .env
640
+ # fill DATABASE_URL and JWT_PUBLIC_KEY
641
+ docker compose up --build
642
+ ```
643
+
644
+ - Backend: http://localhost:8000/docs
645
+ - AI: http://localhost:8001/docs
646
+ - Cert: http://localhost:8002/docs
647
+ - Frontend: http://localhost:3000
648
+
649
+ ## Notes
650
+ - Replace stub models with trained versions
651
+ - Hook cert anchoring to deployed smart contracts
652
+ - Configure OPA and mTLS for prod