Every product on Earth gets a beautiful, AI-generated, cryptographically unforgeable QR code — and when anyone scans it with their phone, the blockchain instantly proves it's real.
PRODUCT → QRON Cryptographic Art → Phone Scan → Blockchain Verified → Storymode → $QRON Reward
📖 Read the full Vision → · 🏗️ System Architecture →
AuthiChain.com (Protocol) · QRON.space (Interface) · StrainChain.io (Cannabis Vertical)
A modern, full-stack product authentication platform built with Next.js 14, Supabase, and OpenAI GPT-4 Vision API. AuthiChain combines AI-powered product classification with blockchain technology to create an unbreakable chain of authenticity for your products.
- AI-Powered Product Classification: Automatically classify products using GPT-4 Vision API with 98% accuracy
- Blockchain Registration: Immutable product records with unique TrueMark™ IDs and transaction hashes
- Public Verification: Anyone can verify product authenticity using TrueMark™ IDs
- TrueMark™ Technology: Proprietary microscopic pattern verification system
- Analytics Dashboard: Track products, registrations, and verification scans
- Dark Mode: Built-in dark/light theme toggle with next-themes
- Modern, clean interface with purple/green gradient theme
- Fully mobile-responsive design
- Smooth animations with Framer Motion
- Professional UI components with Radix UI and Tailwind CSS
- Row Level Security (RLS) policies with Supabase
- Secure authentication with Supabase Auth
- Protected API routes
- Image upload to Supabase Storage with access control
- Frontend: Next.js 14 (App Router), React 18, TypeScript
- Backend: Next.js API Routes
- Database: Supabase (PostgreSQL)
- File Storage: Supabase Storage
- Authentication: Supabase Auth
- AI: OpenAI GPT-4 Vision API
- Styling: Tailwind CSS, Radix UI
- State Management: React Hooks
- Deployment: Vercel (recommended)
AuthiChain/
├── app/ # Next.js 14 App Router
│ ├── api/ # API Routes
│ │ ├── classify/ # POST - AI classification
│ │ ├── register/ # POST - Blockchain registration
│ │ ├── verify/[id]/ # GET - Product verification
│ │ ├── products/ # GET/POST - Products CRUD
│ │ └── auth/callback/ # Auth callback
│ ├── dashboard/ # Dashboard page
│ ├── upload/ # Upload page
│ ├── products/[id]/ # Product detail page
│ ├── verify/ # Public verification page
│ ├── login/ # Login page
│ ├── signup/ # Signup page
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Landing page
│ └── globals.css # Global styles
├── components/ # React components
│ ├── ui/ # UI components (shadcn)
│ ├── theme-provider.tsx # Theme context
│ └── theme-toggle.tsx # Dark mode toggle
├── lib/ # Utilities
│ ├── supabase/ # Supabase clients
│ │ ├── client.ts # Browser client
│ │ ├── server.ts # Server client
│ │ ├── middleware.ts # Auth middleware
│ │ └── types.ts # Database types
│ └── utils.ts # Helper functions
├── hooks/ # Custom hooks
│ └── use-toast.ts # Toast notifications
├── supabase/ # Supabase configuration
│ └── schema.sql # Database schema
├── middleware.ts # Next.js middleware
├── next.config.js # Next.js config
├── tailwind.config.ts # Tailwind config
└── tsconfig.json # TypeScript config
- Node.js 18+ and npm/yarn
- Supabase account (supabase.com)
- OpenAI API key (platform.openai.com)
git clone https://github.com/yourusername/AuthiChain.git
cd AuthiChainnpm install
# If Git Bash on Windows has local proxy vars set, unset them first:
unset HTTP_PROXY HTTPS_PROXY http_proxy https_proxy- Create a new project at supabase.com
- Go to the SQL Editor and run the schema from
supabase/schema.sql - Enable Email authentication in Authentication > Providers
- Get your project URL and anon key from Settings > API
Create a .env.local file in the root directory:
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
DATABASE_URL=your-postgres-connection-string
# OpenAI
OPENAI_API_KEY=your-openai-api-key
# QRON verification proxy target
# Set this to the active backend you control, for example:
# VERIFY_API_URL=https://qron.space/api/verify
VERIFY_API_URL=
# Optional analytics forward target
ANALYTICS_API_URL=
# Optional local QR fallback (requires public/jsQR.js vendored file)
NEXT_PUBLIC_ENABLE_QR_FALLBACK=falsenpm run devBefore deploying, run:
npm run validate
npm run check:dbnpm run check:db verifies that the live Postgres schema includes the AI AutoFlow columns the frontend and API now depend on.
Open http://localhost:3000 in your browser.
- Hero section with product features
- Statistics and social proof
- How it works section
- Call-to-action
- Product image upload
- AI-powered classification with GPT-4 Vision
- Manual product details entry
- Image storage in Supabase
- Product information display
- Blockchain registration button
- TrueMark™ scanner simulator
- Registration status and blockchain data
- Product statistics
- Products grid with filtering
- Quick access to upload and product details
- User profile and logout
- Public product verification (no auth required)
- Live QR scanning (native
BarcodeDetector) - Graceful no-decoder fallback mode when browser QR APIs are unavailable
- Optional local jsQR fallback when
NEXT_PUBLIC_ENABLE_QR_FALLBACK=trueand/public/jsQR.jsis provided - TrueMark™/QR/token verification proxied through AuthiChain verify API
- Authenticity results with confidence score
- Share Verified flow (Web Share API with clipboard fallback)
- Live activity log link (
/activity)
/login- User login/signup- User registration- Email/password authentication with Supabase
Classify product image using GPT-4 Vision
Request Body:
{
"imageUrl": "data:image/jpeg;base64,..."
}Response:
{
"name": "iPhone 15 Pro",
"category": "Electronics",
"brand": "Apple",
"description": "Latest flagship smartphone",
"confidence": 0.95
}Register product on blockchain
Request Body:
{
"productId": "uuid"
}Response:
{
"success": true,
"product": { ... },
"message": "Product successfully registered on blockchain"
}Proxy verification endpoint for the QRON demo.
Request Body:
{
"raw": "https://qron.space/verify?id=PROD-12345"
}Behavior:
- URL input ->
{ "qrCode": raw } PROD-*/identifier input ->{ "productIdentifier": normalized }- Numeric input ->
{ "tokenId": number } - Fallback ->
{ "qrCode": raw }
Response fields consumed by UI:
authentictrust_scoreconfidenceqron_idactions
Logs client-side analytics events and appends them to local JSONL storage (.data/activity-events.jsonl). Optionally forwards to ANALYTICS_API_URL.
Returns a JSON list of the last 100 events sorted by latest first. The /activity page polls this endpoint every 3 seconds for live updates.
Verify product authenticity by TrueMark™ ID
Response (Authentic):
{
"success": true,
"result": "authentic",
"product": { ... },
"confidence": 0.98,
"message": "Product verified as authentic"
}Get all products for authenticated user
Response:
{
"products": [ ... ]
}Create new product
Request Body:
{
"name": "Product Name",
"description": "Description",
"category": "Electronics",
"brand": "Brand Name",
"imageUrl": "https://..."
}CREATE TABLE products (
id UUID PRIMARY KEY,
user_id UUID REFERENCES auth.users(id),
name TEXT NOT NULL,
description TEXT,
category TEXT,
brand TEXT,
image_url TEXT,
truemark_id TEXT UNIQUE,
truemark_data JSONB,
blockchain_tx_hash TEXT,
is_registered BOOLEAN DEFAULT FALSE,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW()
);CREATE TABLE scans (
id UUID PRIMARY KEY,
product_id UUID REFERENCES products(id),
scan_result TEXT NOT NULL,
confidence DECIMAL(5,2),
location TEXT,
ip_address TEXT,
user_agent TEXT,
created_at TIMESTAMP DEFAULT NOW()
);- Push your code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
npm run build
npm start| Variable | Description | Required |
|---|---|---|
NEXT_PUBLIC_SUPABASE_URL |
Supabase project URL | Yes |
NEXT_PUBLIC_SUPABASE_ANON_KEY |
Supabase anonymous key | Yes |
SUPABASE_SERVICE_ROLE_KEY |
Supabase service role key | Yes |
OPENAI_API_KEY |
OpenAI API key for GPT-4 Vision | Yes |
The AI classification feature uses OpenAI's GPT-4 Vision API to analyze product images and automatically extract:
- Product name
- Category (Electronics, Fashion, Luxury, etc.)
- Brand identification
- Product description
- Confidence score
When a product is registered:
- A unique TrueMark™ ID is generated
- A blockchain transaction hash is created
- Microscopic pattern data is generated
- Product is marked as registered in the database
- Public verification becomes available
TrueMark™ is a proprietary authentication system that:
- Generates unique microscopic patterns for each product
- Stores pattern data securely on the blockchain
- Allows instant verification through pattern matching
- Provides confidence scores for authenticity
- Row Level Security (RLS): All database tables have RLS policies
- Authentication: Supabase Auth with email/password
- API Protection: Server-side authentication checks
- Storage Policies: Restricted file upload and access
- Type Safety: Full TypeScript coverage
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - see LICENSE file for details
For support, email support@authichain.com or open an issue on GitHub.
Made with ❤️ by the AuthiChain Team
- Page loads over HTTPS (
/verify). - Camera starts successfully from the QR scanner card.
- QR detection triggers verification request automatically when BarcodeDetector is supported.
- Verification calls AuthiChain verify endpoint through
/api/verifyand rendersauthentic,trust_score,confidence,qron_id, andactions. - Share Verified works (native Web Share API when available, clipboard fallback otherwise).
-
/api/activityreturns JSON including the latest analytics events.
To enable fallback scanning without npm installs:
- Vendor a browser-ready
jsQRbuild intopublic/jsQR.js. - Set
NEXT_PUBLIC_ENABLE_QR_FALLBACK=true. - Restart the app.
If BarcodeDetector is unavailable and jsQR is missing, the UI will explain that manual entry is still available.