WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

DamianGiambazi/ai-hcs-verifiable-decisions

Repository files navigation

AI+HCS Verifiable Decisions MVP

🎯 The world's first practical AI+blockchain decision verification system using Claude AI and Hedera Hashgraph Consensus Service (HCS).

🌟 Project Overview

This application creates verifiable trails of AI decisions by:

  1. Processing user queries through Claude AI with structured responses
  2. Logging decisions to Hedera Consensus Service for immutable verification
  3. Providing cryptographic proofs of AI response integrity
  4. Offering a professional dashboard for real-time decision tracking and analytics

✨ Current Features (Phase 1: AI Foundation - COMPLETE)

πŸ” Authentication System

  • βœ… JWT-based authentication with secure session management
  • βœ… User registration and login with password validation
  • βœ… Protected API routes with middleware authentication
  • βœ… Secure logout with token cleanup

πŸ€– AI Integration

  • βœ… Claude AI integration for intelligent decision processing
  • βœ… Structured AI responses with metadata tracking
  • βœ… Decision hashing using SHA-256 for verification
  • βœ… Performance monitoring with processing time tracking
  • βœ… Token usage tracking for cost management

πŸ’Ύ Database Architecture

  • βœ… PostgreSQL database with Prisma ORM
  • βœ… User management with profile data
  • βœ… Decision storage with complete audit trail
  • βœ… Session management for JWT tokens
  • βœ… Audit logging for security events

🌐 Professional Dashboard

  • βœ… Responsive design with TailwindCSS
  • βœ… Real-time statistics showing decision metrics
  • βœ… AI query interface for live decision processing
  • βœ… Decision history with detailed tracking
  • βœ… System health monitoring with service status
  • βœ… Phase development tracking for project status

πŸš€ Quick Start

Prerequisites

  • Node.js v18.20.4 (managed via NVM)
  • PostgreSQL database (Neon recommended)
  • Anthropic API key for Claude AI
  • Git for Windows with Bash support

πŸ”§ Installation

  1. Clone and navigate to the project: οΏ½ash git clone <repository-url> cd ai-hcs-verifiable-decisions

  2. Install dependencies: οΏ½ash npm install

  3. Configure environment variables: `οΏ½ash

    Copy the template and fill in your actual values

    cp .env.example .env.local `

    Required environment variables: `env

    Database Configuration

    DATABASE_URL="postgresql://username:password@host:5432/database?sslmode=require"

    AI Service Configuration

    ANTHROPIC_API_KEY="sk-ant-your-api-key"

    Authentication Configuration

    NEXTAUTH_SECRET="your-secure-random-string-32-chars+" NEXTAUTH_URL="http://localhost:3000" `

  4. Set up the database: οΏ½ash npx prisma generate npx prisma db push

  5. Start the development server: οΏ½ash npm run dev

  6. Visit the application: Open http://localhost:3000 in your browser

πŸ—οΈ Project Structure

ai-hcs-verifiable-decisions/ β”œβ”€β”€ src/ β”‚ β”œβ”€β”€ app/ # Next.js App Router pages β”‚ β”‚ β”œβ”€β”€ api/ # API routes β”‚ β”‚ β”‚ β”œβ”€β”€ auth/ # Authentication endpoints β”‚ β”‚ β”‚ β”œβ”€β”€ ai/ # AI processing endpoints β”‚ β”‚ β”‚ β”œβ”€β”€ decisions/ # Decision management β”‚ β”‚ β”‚ └── dashboard/ # Dashboard data β”‚ β”‚ β”œβ”€β”€ dashboard/ # Dashboard page β”‚ β”‚ β”œβ”€β”€ login/ # Login page β”‚ β”‚ β”œβ”€β”€ register/ # Registration page β”‚ β”‚ └── page.tsx # Home page β”‚ β”œβ”€β”€ lib/ # Core utilities β”‚ β”‚ β”œβ”€β”€ auth.ts # Authentication logic β”‚ β”‚ β”œβ”€β”€ claude.ts # AI integration β”‚ β”‚ β”œβ”€β”€ prisma.ts # Database client β”‚ β”‚ └── api-utils.ts # API helpers β”‚ └── types/ # TypeScript definitions β”œβ”€β”€ prisma/ β”‚ └── schema.prisma # Database schema β”œβ”€β”€ package.json # Dependencies and scripts β”œβ”€β”€ tailwind.config.ts # Styling configuration β”œβ”€β”€ tsconfig.json # TypeScript configuration └── README.md # This file

🎯 Development Phases

βœ… Phase 1: AI Foundation (COMPLETE)

  • Status: πŸŽ‰ COMPLETE
  • Features: Authentication, AI integration, database, dashboard
  • Timeline: Week 1-2
  • Validation: All endpoints tested, TypeScript compilation clean

🚧 Phase 2: Hedera Blockchain Integration (NEXT)

  • Status: πŸš€ READY TO START
  • Features: HCS message submission, verification, Mirror Node integration
  • Timeline: Week 3-4
  • Prerequisites: Hedera testnet account, HCS topic creation

πŸ“‹ Phase 3: Enhanced Dashboard (FUTURE)

  • Status: πŸ“… PLANNED
  • Features: Advanced analytics, real-time verification, reporting
  • Timeline: Week 5-6
  • Dependencies: Phase 2 completion

πŸ”§ Development Workflow

Windows Development Environment

This project follows the Master Node.js Development Protocol v6.0 with Windows-specific optimizations:

  • File Creation: Git Bash for UTF-8 clean configuration files
  • Operations: PowerShell for npm commands and testing
  • Testing: PowerShell API testing workflows
  • Environment: NVM for Node.js version management

API Testing

Comprehensive PowerShell testing scripts are available for validating all endpoints:

`powershell

Test authentication flow

Invoke-RestMethod -Uri "http://localhost:3000/api/auth/login" -Method Post -Body ( | ConvertTo-Json) -ContentType "application/json"

Test AI processing

Invoke-RestMethod -Uri "http://localhost:3000/api/ai/query" -Method Post -Body ( | ConvertTo-Json) -ContentType "application/json" -Headers @{Authorization="Bearer "} `

πŸ“Š Technical Specifications

Technology Stack

  • Frontend: Next.js 15.3.5 with App Router, TypeScript, TailwindCSS
  • Backend: Next.js API Routes with JWT authentication
  • Database: PostgreSQL with Prisma ORM
  • AI Service: Anthropic Claude API
  • Blockchain: Hedera Hashgraph (Phase 2)
  • Deployment: Vercel-ready (Phase 3)

Database Schema

  • Users: Authentication and profile management
  • UserSessions: JWT token tracking
  • AiDecisions: AI query and response storage with hashes
  • AuditLogs: Security and activity tracking

Security Features

  • JWT Authentication: Secure session management
  • Password Hashing: bcryptjs with salt rounds
  • API Protection: Middleware-based route protection
  • Audit Logging: Comprehensive activity tracking
  • Input Validation: Request validation and sanitization

πŸ§ͺ Testing

Manual Testing Checklist

  • User registration with email validation
  • Login with correct credentials
  • Dashboard loads with statistics
  • AI query processes and returns response
  • Decision history displays correctly
  • Logout clears session

API Endpoint Testing

All API endpoints have been validated using PowerShell testing scripts:

  • βœ… POST /api/auth/register - User registration
  • βœ… POST /api/auth/login - User authentication
  • βœ… GET /api/auth/verify - Token validation
  • βœ… POST /api/ai/query - AI decision processing
  • βœ… GET /api/decisions - Decision history
  • βœ… GET /api/dashboard/overview - Dashboard statistics

πŸš€ Deployment

Environment Requirements

  • Node.js v18.20.4+
  • PostgreSQL database
  • Anthropic API access
  • Environment variables configured

Production Checklist

  • Environment variables secured
  • Database migrations applied
  • TypeScript compilation clean
  • Build process successful
  • Security headers configured
  • Performance optimization applied

🀝 Contributing

This project follows strict development protocols for reliability:

  1. Phase-based development with clear checkpoints
  2. Windows-compatible workflows using Git Bash + PowerShell
  3. TypeScript-first development with strict compilation
  4. Comprehensive testing before any deployment
  5. Detailed documentation for reproducibility

πŸ“ License

This project is part of an AI+blockchain research initiative demonstrating practical applications of verifiable AI decision systems.


🎯 Phase 1 Status: COMPLETE βœ…
πŸš€ Next: Phase 2 - Hedera Blockchain Integration

Built with the Master Node.js Development Protocol v6.0 for maximum reliability and Windows compatibility.

About

AI+HCS Verifiable Decisions MVP - The world's first practical AI+blockchain decision verification system

Resources

Stars

Watchers

Forks

Packages

No packages published