Skip to content

SafiGuard is a parametric micro-insurance platform built on Stellar/Soroban that provides automated crop and weather insurance for underserved markets across Africa. Smart contracts trigger instant payouts when oracle-verified weather conditions breach policy thresholds — no claims process, no paperwork, no delays.

License

Notifications You must be signed in to change notification settings

Tetech-Labs/SafiGuard

Repository files navigation

🛡️ SafiGuard — Parametric Micro-Insurance on Stellar

Automated crop & weather insurance for underserved markets, powered by Soroban smart contracts and oracle data.

Stellar Soroban License PRs Welcome

"Safi" means clean/pure in Swahili — SafiGuard delivers clean, transparent, trustless insurance to the people who need it most.


🌍 The Problem

1.7 billion people in Africa and Latin America have zero insurance coverage. Traditional insurance fails them because:

  • Claims processing takes weeks or months
  • Paperwork and bureaucracy exclude rural populations
  • Premiums are too high for micro-coverage
  • Fraud and denial rates destroy trust

Meanwhile, a single bad rainy season can push an entire farming community into poverty.

💡 The Solution

SafiGuard is a parametric micro-insurance platform where:

  1. Farmers purchase weather insurance policies by paying small premiums in USDC/XLM
  2. Oracle feeds deliver real-time weather data (rainfall, temperature, drought indices)
  3. Smart contracts automatically trigger payouts when weather conditions breach policy thresholds
  4. No claims process — if rainfall drops below 40mm in your region, you get paid. Automatically.

How It Works

Farmer buys policy ──► Premium enters Risk Pool ──► Oracle reports weather data
                                                            │
                                                            ▼
                                                    Threshold breached?
                                                     │            │
                                                    YES           NO
                                                     │            │
                                                     ▼            ▼
                                              Auto-payout    Policy expires
                                              to farmer      safely

🏗️ Tech Stack

Layer Technology
Frontend React 18, TypeScript, TailwindCSS
State Management Zustand + React Query
Smart Contracts Soroban SDK (Rust)
Backend API Node.js, Express, TypeScript
Database PostgreSQL + Redis (caching)
Oracle Layer Custom oracle bridge + Chainlink (future)
Blockchain SDK stellar-sdk, soroban-client
Weather Data Open-Meteo API, NASA POWER, CHIRPS
Payments USDC on Stellar, native XLM
Notifications SMS (Africa's Talking), Email, Push
Testing Vitest, Playwright, Rust test suite
CI/CD GitHub Actions

📁 Project Structure

safiguard/
├── src/
│   ├── components/          # React UI components
│   │   ├── wallet/          # Wallet connection & management
│   │   ├── dashboard/       # User dashboard views
│   │   ├── policies/        # Policy browsing, purchase, management
│   │   ├── claims/          # Claim status & payout tracking
│   │   ├── pools/           # Risk pool management & staking
│   │   ├── oracle/          # Oracle data feeds & status
│   │   ├── analytics/       # Charts, risk metrics, portfolio
│   │   ├── settings/        # User preferences
│   │   └── common/          # Shared UI primitives
│   ├── hooks/               # Custom React hooks
│   ├── utils/               # Helper functions
│   ├── services/            # API & blockchain service layer
│   ├── types/               # TypeScript type definitions
│   ├── styles/              # Global styles & theme
│   ├── contexts/            # React context providers
│   ├── pages/               # Route-level page components
│   ├── contracts/           # Soroban smart contracts (Rust)
│   │   ├── weather-policy/  # Parametric weather insurance contract
│   │   ├── risk-pool/       # Pooled capital & risk management
│   │   ├── oracle-consumer/ # Oracle data bridge contract
│   │   ├── payout-engine/   # Automated payout settlement
│   │   └── governance/      # DAO governance for pool params
│   ├── api/                 # Backend API server
│   │   ├── routes/          # API route handlers
│   │   ├── middleware/       # Auth, rate limiting, logging
│   │   ├── models/          # Database models
│   │   └── services/        # Business logic & oracle feeds
│   └── tests/               # Test suites
├── scripts/                 # Deployment & utility scripts
├── docs/                    # Documentation
└── .github/                 # GitHub config & CI/CD

🚀 Getting Started

Prerequisites

  • Node.js >= 18
  • Rust & Cargo (for Soroban contracts)
  • Stellar CLI (stellar)
  • PostgreSQL 15+
  • Redis 7+

Installation

# Clone the repo
git clone https://github.com/Tetech-Labs/safiguard.git
cd safiguard

# Install dependencies
npm install

# Set up environment
cp .env.example .env

# Start development server
npm run dev

# Run tests
npm test

Soroban Contracts

# Build all contracts
cd src/contracts
cargo build --release --target wasm32-unknown-unknown

# Run contract tests
cargo test

# Deploy to testnet
stellar contract deploy \
  --wasm target/wasm32-unknown-unknown/release/weather_policy.wasm \
  --network testnet

🌱 Insurance Verticals (Roadmap)

Phase Vertical Oracle Source Target Market
v1 Crop / Rainfall Open-Meteo, CHIRPS West & East Africa
v2 Drought Index NASA POWER, NDVI satellite Sub-Saharan Africa
v3 Flight Delay FlightAware API Pan-African travelers
v4 Livestock Mortality Temperature + NDVI Pastoral communities
v5 Flood / Excess Rainfall Open-Meteo, river gauges Coastal West Africa
v6 Health Event Triggers WHO data feeds Community health pools

🤝 Contributing

We welcome contributors at every level! This project is part of the Stellar Community Fund ecosystem.

How to Contribute

  1. Browse open Issues and find one that interests you
  2. Comment on the issue to get assigned
  3. Fork the repo and create a branch: git checkout -b feat/your-feature
  4. Make your changes and write tests
  5. Submit a Pull Request

Issue Labels

Label Description
good first issue Great for newcomers
enhancement New feature or improvement
soroban Smart contract work (Rust)
frontend React/TypeScript UI
backend Node.js API & services
oracle Oracle data feeds & integration
actuarial Risk modeling & premium calculation
testing Test coverage
documentation Docs, guides, API specs
mobile Mobile responsiveness & SMS
accessibility A11y & internationalization

See CONTRIBUTING.md for full guidelines.


📜 License

MIT License — see LICENSE for details.


🔗 Resources


Built with ❤️ for the 1.7 billion uninsured — powered by Stellar 🌟

About

SafiGuard is a parametric micro-insurance platform built on Stellar/Soroban that provides automated crop and weather insurance for underserved markets across Africa. Smart contracts trigger instant payouts when oracle-verified weather conditions breach policy thresholds — no claims process, no paperwork, no delays.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published