Skip to content

kaizencycle/lab4-proof

Repository files navigation

Lab4-proof: Reflections πŸš€

A secure, open-source ledger system combining FastAPI backend with Next.js frontend for reflection tracking and GIC rewards.

Security Python FastAPI Next.js

✨ Features

  • 🏠 Civic Onboarding Portal - Complete .gic domain creation with companion-guided setup
  • πŸ” Secure Ledger System - Immutable daily records with Merkle tree integrity
  • πŸ€– AI-Powered Reflections - Intelligent companion system for personal growth
  • πŸ’° GIC Rewards - Gamified incentive system for engagement
  • πŸ”„ Auto-Merge Workflows - Automated PR management and deployment
  • πŸ›‘οΈ Public-Safe - No hardcoded secrets, environment-based configuration
  • πŸ“Š Admin Dashboard - Real-time monitoring and analytics
  • 🌐 .gic Domain System - Sovereign digital identity with integrity scoring

πŸ“‚ Project Structure

hive-paw/
β”œβ”€β”€ backend/                 # Backend API (Python/FastAPI)
β”‚   β”œβ”€β”€ api/                # API routes and main application
β”‚   β”‚   β”œβ”€β”€ main.py         # FastAPI application entry point
β”‚   β”‚   └── routers/        # API route modules
β”‚   β”œβ”€β”€ core/               # Core business logic
β”‚   β”‚   β”œβ”€β”€ models.py       # Pydantic models
β”‚   β”‚   β”œβ”€β”€ storage.py      # Data storage utilities
β”‚   β”‚   β”œβ”€β”€ hashing.py      # Cryptographic functions
β”‚   β”‚   β”œβ”€β”€ auth.py         # Authentication logic
β”‚   β”‚   └── ...
β”‚   └── utils/              # Utility functions
β”œβ”€β”€ frontend/               # Frontend (Next.js/React)
β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”œβ”€β”€ pages/             # Next.js pages
β”‚   └── ...
β”œβ”€β”€ docs/                   # Documentation
β”‚   β”œβ”€β”€ api/               # API documentation
β”‚   β”œβ”€β”€ guides/            # User guides
β”‚   └── deployment/        # Deployment guides
β”œβ”€β”€ scripts/               # Automation scripts
β”‚   β”œβ”€β”€ powershell/        # PowerShell scripts
β”‚   β”œβ”€β”€ bash/             # Bash scripts
β”‚   └── automation/       # CI/CD scripts
β”œβ”€β”€ tests/                 # Test suite
β”‚   β”œβ”€β”€ unit/             # Unit tests
β”‚   β”œβ”€β”€ integration/      # Integration tests
β”‚   └── fixtures/         # Test fixtures
β”œβ”€β”€ config/               # Configuration files
β”œβ”€β”€ data/                 # Data storage (gitignored)
└── examples/             # Example files and patches

πŸš€ Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • Git

1. Clone Repository

git clone https://github.com/yourusername/hive-paw.git
cd hive-paw

2. Backend Setup

# Install dependencies
pip install -r requirements.txt

# Configure environment
cp config/.env.example .env
# Edit .env with your configuration

# Run development server
python main.py

3. Frontend Setup

# Install dependencies
cd frontend
npm install

# Run development server
npm run dev

4. Access Application

🏠 Civic Onboarding System

The HIVE-PAW system now includes a complete civic onboarding portal for creating .gic domains:

Onboarding Flow

  1. Civic Oath - Accept terms and create identity
  2. Companion Selection - Choose JADE, EVE, ZEUS, or HERMES
  3. Domain Customization - Select template, theme, and sections
  4. Domain Sealing - Cryptographic attestation to Civic Ledger
  5. First Reflection - Genesis block creation
  6. Dashboard - Ongoing portal for reflection management

Companion System

  • JADE - The Builder (Rationality: 0.95) - Precision and clarity
  • EVE - The Reflector (Empathy: 0.95) - Deep understanding
  • ZEUS - The Arbiter (Balance: 0.88) - Fair judgment
  • HERMES - The Messenger (Communication: 0.82) - Clear expression

Integrity Scoring

The system calculates GI (Governance Integrity) scores based on:

  • M (Memory): Completeness of reflection history
  • H (Human): User engagement and participation
  • I (Integrity): Ledger compliance and attestations
  • E (Ethics): Adherence to Civic Oath principles

πŸ”§ Configuration

Environment Variables

Copy config/.env.example to .env and configure:

# Required
ADMIN_TOKEN=your_secure_admin_token
ADMIN_KEY=your_secure_admin_key
LEDGER_HMAC_KEY=your_secure_hmac_key

# Optional
DEMO_MODE=false
OPENAI_API_KEY=your_openai_key

Security Configuration

  • βœ… All secrets use environment variables
  • βœ… No hardcoded credentials
  • βœ… CORS protection enabled
  • βœ… Admin endpoints protected
  • βœ… Data sanitization implemented

πŸ“š API Documentation

Core Endpoints

Endpoint Method Description
/health GET Health check
/seed POST Create daily seed
/sweep POST Add reflection sweep
/seal POST Seal daily ledger
/verify/{date} GET Verify ledger integrity
/export/{date} GET Export daily data

Admin Endpoints

Endpoint Method Description
/admin/metrics GET System metrics
/admin/agents GET Agent status
/bonus/run POST Run bonus calculations

πŸ›‘οΈ Security

This repository is public-safe with:

  • No hardcoded secrets or API keys
  • Comprehensive .gitignore for sensitive files
  • Environment-based configuration
  • Security audit checklist in SECURITY.md

See SECURITY.md for detailed security information.

πŸ§ͺ Testing

# Run all tests
pytest

# Run specific test categories
pytest tests/unit/
pytest tests/integration/

# Run with coverage
pytest --cov=backend

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests: pytest
  5. Submit a pull request

πŸ“„ License

This project is open source. See LICENSE file for details.

πŸ†˜ Support


Made with ❀️ for the HIVE ecosystem

About

No description, website, or topics provided.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •