Skip to content

Technology Stack

Modern, scalable infrastructure for carbon credit verification


Architecture Overview

Secret Trees uses a dual-platform architecture with blockchain integration for transparency and verification.

Platform Architecture

V1 Platform (Production - Stable):

  • URL: app.secrettrees.io
  • Platform: lovable.dev (AI-assisted development)
  • Repository: fknfairyfloss/hemp-grow-co2-hub
  • Purpose: Stable MVP for investors and users
  • Status: Production-ready with full features

V2 Platform (Development - Enhanced):

  • URL: secrettrees.io (homepage)
  • Platform: Custom development (Hetzner + Coolify)
  • Repository: ctinn/secret-trees-v2
  • Purpose: Enhanced features and custom development
  • Status: Active development
mermaid
graph TB
    A[User Browser] --> B[V1: app.secrettrees.io]
    A --> C[V2: secrettrees.io]
    B --> D[lovable.dev Platform]
    C --> E[Hetzner/Coolify]
    D --> F[Supabase V1]
    E --> G[Supabase V2]
    F --> H[PostgreSQL]
    G --> H
    B --> I[Blockchain Layer]
    C --> I
    I --> J[Polygon Network]
    I --> K[MRV Devices]

Frontend Stack

V1 Platform (lovable.dev)

Framework: React 18.3.1 + TypeScript + Vite 5.4.19

Development Platform: lovable.dev

  • AI-assisted development
  • GitHub integration (fknfairyfloss/hemp-grow-co2-hub)
  • Automatic deployments
  • Preview environments
  • Built-in CI/CD

UI Library: shadcn-ui + Tailwind CSS

  • Modern, accessible components
  • Customizable design system
  • Built on Radix UI primitives
  • Excellent TypeScript support

State Management: @tanstack/react-query 5.83.0

  • Server state management
  • Automatic caching
  • Real-time updates
  • Optimistic updates

Features:

  • Complete MVP functionality
  • User authentication (Google OAuth)
  • Community management
  • Contract builder
  • Verifier portal
  • Dashboard
  • Admin panel

V2 Platform (Custom Development)

Framework: React + TypeScript + Vite

Development: Custom outside of lovable.dev

  • Manual development workflow
  • GitHub integration (ctinn/secret-trees-v2)
  • Self-hosted deployment
  • Full control over architecture

Purpose:

  • Enhanced features
  • Custom integrations
  • Advanced functionality
  • Independent from lovable.dev constraints

Backend Stack

Dual Supabase Setup

V1 Database (Production):

  • Project ID: hdmrjvngtxaigtiaqujw
  • Purpose: Stable production data
  • Users: Existing users and early bird funders
  • Status: Production-ready with 70+ migrations

V2 Database (Development):

  • Project ID: vqvwdwdqfgsoxoauchad
  • Purpose: Development and enhanced features
  • Users: New features and testing
  • Status: Active development

Supabase Features

Database: PostgreSQL with Row Level Security (RLS)

  • Real-time subscriptions
  • Built-in authentication
  • RESTful API
  • GraphQL support
  • Edge functions

Authentication: Supabase Auth

  • Google OAuth integration
  • Email/password authentication
  • Magic link support
  • JWT tokens
  • Role-based access control

Database Schema: 14+ production tables

Key Tables:

  • profiles - User accounts
  • communities - Hemp cultivation projects
  • ricardian_contracts - Pre-purchase agreements
  • carbon_credits - CCT token tracking
  • subscriptions - T2 monthly subscriptions
  • mrvdevices - IoT sensor data
  • verifications - Third-party audits

Blockchain Layer

Polygon Network

Why Polygon:

  • Low transaction costs (< €0.01)
  • EVM-compatible (Ethereum tools work)
  • Fast confirmation (2-3 seconds)
  • Environmentally friendly (Proof of Stake)

Smart Contracts

CCT Token: ERC-1155 (Semi-Fungible)

Features:

  • 1 CCT = 1 tonne CO₂ sequestered
  • Batch minting (gas efficient)
  • Metadata for verification
  • Transfer restrictions (compliance)

Ricardian Contracts: Legal + Machine-Readable

Features:

  • Blockchain-stored legal agreements
  • Milestone-based payments
  • Automatic escrow release
  • Dispute resolution mechanism

T2 Premium NFT: ERC-721 (Phase 2, 2027+)

Features:

  • Governance voting
  • Platform benefits
  • Fee discounts
  • Community participation

MRV (Monitoring, Reporting, Verification)

IoT Sensor Network

Hardware: Custom MRV devices (€1,195 per cottage)

Sensors:

  • CO₂ concentration monitors
  • Temperature sensors
  • Humidity sensors
  • GPS location tracking
  • Tamper detection

Data Collection:

  • Real-time measurements (every 15 minutes)
  • Blockchain hash storage
  • Encrypted transmission
  • Redundant backups

Verification Process

Three-Tier Verification:

  1. AI Verification (Automated)

    • Sensor data analysis
    • Anomaly detection
    • Pattern recognition
    • 80% cost reduction vs manual
  2. Remote Verification (Human)

    • Expert review of data
    • Photo/video verification
    • Document review
    • Score adjustment (±20 points)
  3. On-Site Verification (Physical)

    • Physical inspection
    • Sample collection
    • Third-party audit
    • Final certification

Infrastructure

V1 Platform (lovable.dev)

Hosting: lovable.dev managed hosting

Features:

  • GitHub integration (fknfairyfloss/hemp-grow-co2-hub)
  • Automatic deployments on push
  • Preview environments
  • Built-in CI/CD
  • Managed infrastructure

URL: app.secrettrees.io

Purpose: Stable MVP for investors and users

Why lovable.dev:

  • AI-assisted development
  • Fast iteration
  • Managed hosting
  • GitHub synchronization
  • No infrastructure management

V2 Platform (Hetzner + Coolify)

Hosting: Self-hosted on Hetzner Cloud

Server: CPX11 (2 vCPU, 4GB RAM, €4.15/month)

Deployment: Coolify (self-hosted)

  • Docker containers
  • Traefik reverse proxy
  • Let's Encrypt SSL
  • Manual deployment workflow
  • Full control

URLs:

  • secrettrees.io - Main homepage (HTTPS)
  • staging.secrettrees.io - Development environment

Purpose: Custom development outside lovable.dev

Why Self-Hosted:

  • Full control over architecture
  • Custom integrations
  • Cost savings (70-85% vs Vercel/Netlify)
  • Independent from lovable.dev

Documentation Site

Hosting: Hetzner Cloud (same server as V2)

URL: docs-staging.secrettrees.io

Technology: VitePress (static site generator)

Deployment: Docker + nginx


Development Tools

Version Control

Git + GitHub

V1 Repository:

  • Name: fknfairyfloss/hemp-grow-co2-hub
  • Status: Production-ready (70+ migrations)
  • Platform: lovable.dev integration
  • Purpose: Stable MVP

V2 Repository:

  • Name: ctinn/secret-trees-v2
  • Status: Active development
  • Platform: Custom development
  • Purpose: Enhanced features

Development Workflow

V1 (lovable.dev):

  1. Develop in lovable.dev interface
  2. AI-assisted code generation
  3. Automatic GitHub sync
  4. Automatic deployment
  5. Preview and test

V2 (Custom):

  1. Local development
  2. Manual code writing
  3. Git commit and push
  4. Manual deployment (rsync + docker)
  5. Test on staging

Build Tools

Vite: Fast build tool

  • Hot module replacement (HMR)
  • TypeScript support
  • CSS preprocessing
  • Asset optimization
  • Production builds

Docker: Containerization (V2 only)

  • Multi-stage builds
  • Stage 1: Node.js build (npm ci + npm run build)
  • Stage 2: nginx serve (production-ready)

Code Quality

TypeScript: Type safety

ESLint: Code linting

Prettier: Code formatting

Zod: Runtime validation


Security

Application Security

Authentication:

  • JWT tokens (Supabase Auth)
  • Secure cookie storage
  • HTTPS only
  • CSRF protection

Database Security:

  • Row Level Security (RLS)
  • Encrypted connections
  • Prepared statements
  • Input validation

API Security:

  • Rate limiting
  • API key authentication
  • CORS configuration
  • Request validation

Blockchain Security

Smart Contract Security:

  • Audited contracts
  • Multi-signature wallets
  • Time-locked operations
  • Emergency pause mechanism

MRV Security:

  • Encrypted data transmission
  • Blockchain hash verification
  • Tamper detection
  • Redundant backups

Performance

Frontend Performance

Optimization:

  • Code splitting (lazy loading)
  • Asset compression (gzip)
  • Image optimization
  • CDN delivery (future)

Metrics:

  • First Load: < 500ms
  • Time to Interactive: < 2s
  • Lighthouse Score: 90+

Backend Performance

Database:

  • Indexed queries
  • Connection pooling
  • Query optimization
  • Caching strategy

API:

  • Response caching
  • Batch operations
  • Pagination
  • Real-time subscriptions

Scalability

V1 Platform (lovable.dev)

Managed Scaling:

  • lovable.dev handles infrastructure
  • Automatic scaling based on traffic
  • No manual intervention needed
  • Supabase managed database scaling

V2 Platform (Self-Hosted)

Horizontal Scaling:

  • Multiple container instances
  • Load balancing (Traefik)
  • CDN distribution (future)

Vertical Scaling:

  • CPX11 → CPX21 (4 vCPU, 8GB RAM)
  • CPX21 → CPX31 (8 vCPU, 16GB RAM)
  • Easy upgrade path

Backend Scaling:

  • Supabase managed scaling
  • Database read replicas
  • Edge functions

Blockchain:

  • Polygon network (high throughput)
  • Batch operations (gas efficient)
  • Layer 2 scaling

Monitoring & Analytics

Application Monitoring

Planned:

  • Error tracking (Sentry)
  • Performance monitoring
  • User analytics (privacy-focused)
  • Uptime monitoring

Blockchain Monitoring

Current:

  • Etherscan API integration
  • Transaction tracking
  • Gas price monitoring
  • Smart contract events

Future Enhancements

Short-term (3-6 months)

  • [ ] CDN integration (CloudFlare)
  • [ ] Advanced analytics dashboard
  • [ ] Mobile app (React Native)
  • [ ] Multi-language support (Ukrainian, Spanish, German)

Long-term (6-12 months)

  • [ ] AI-powered verification (computer vision)
  • [ ] Satellite imagery integration
  • [ ] Carbon credit marketplace
  • [ ] Cross-chain bridge (Ethereum, BSC)

Open Source

Community Contributions

Planned:

  • Open source MRV device firmware
  • Public API documentation
  • Developer SDK
  • Community plugins

Why Open Source:

  • Transparency
  • Community trust
  • Innovation
  • Ecosystem growth

Technical Support

For Developers

Documentation: docs-staging.secrettrees.io

GitHub Repositories:

Contact: ilvers.sermols@secrettrees.io

For Integrators

API Access: Available for corporate partners

Webhook Support: Real-time notifications

Custom Integration: Contact us for enterprise solutions


Platform Evolution

Why Two Platforms?

V1 (lovable.dev):

  • ✅ Fast MVP development
  • ✅ AI-assisted coding
  • ✅ Stable for investors
  • ✅ Managed infrastructure
  • ⚠️ Limited customization

V2 (Custom):

  • ✅ Full control
  • ✅ Custom features
  • ✅ Cost optimization
  • ✅ Independent development
  • ⚠️ More maintenance

Migration Strategy

Current: Dual platform approach

  • V1: Stable MVP for users
  • V2: Enhanced features development

Future: Gradual migration

  • Prove V2 features
  • Migrate users incrementally
  • Maintain V1 as backup
  • Full V2 migration when ready

Built with modern technology for a sustainable future.

Transform Hemp into Carbon Credits