Installation
Prerequisites
- Node.js 18 or higher
- A Supabase account (free tier)
- An Anthropic API key
Step 1 — Clone the Repository
git clone https://github.com/[your-repo]/veritas-id cd veritas-id
Step 2 — Install Dependencies
npm install
Step 3 — Configure Environment Variables
Create a .env.local file in the root directory and add the following:
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key ANTHROPIC_API_KEY=your_anthropic_api_key NEXT_PUBLIC_BASE_URL=http://localhost:3000
Step 4 — Set Up the Database
Open your Supabase project. Navigate to the SQL Editor. Run the schema found in /lib/supabase.ts at the top of the file as a comment.
Step 5 — Run the Application
npm run dev
Step 6 — Deploy to Vercel (Optional)
- Push your repository to GitHub.
- Connect the repository to Vercel.
- Add all environment variables in Vercel project settings.
- Deploy.
Architecture Overview
Veritas ID is a single Next.js 14 application using the App Router. All frontend, backend logic, and API routes live within one codebase deployed on Vercel.
Stack
- Frontend: Next.js 14, React, Tailwind CSS
- Charts: Recharts
- AI: Claude API (claude-sonnet-4-20250514)
- Data: World Bank Open API v2
- Database: Supabase (PostgreSQL)
- Deployment: Vercel
Generation Flow
- User submits a natural language query
- Claude API extracts indicator, country, and year range from the query
- World Bank Open API returns verified data
- SHA256 hash is computed from data values
- Unique Veritas ID is generated:
VID-[COUNTRY]-[INDICATOR]-[HASH PREFIX] - Record stored in Supabase with full data snapshot, hash, and metadata
- QR code generated pointing to verification portal
- Chart rendered as screenshot-ready artifact
Verification Flow — Image Upload
- User uploads a chart screenshot
- Single Claude Vision API call extracts Veritas ID and data values simultaneously
- Supabase queried using extracted ID
- Extracted values compared against stored values with ±1.0 tolerance
- Result: Authentic or Tampered
Verification Flow — ID Lookup
- User enters Veritas ID manually
- Supabase queried
- Original chart retrieved and displayed
Data360 API Integration Methodology
Veritas ID uses the World Bank Open API v2 as its verified data source. No authentication required.
Base URL
https://api.worldbank.org/v2
Query Format
https://api.worldbank.org/v2/country/{countryCode}/indicator/{indicatorCode}?date={startYear}:{endYear}&format=json&per_page=100Supported Indicators
- Youth Unemployment — SL.UEM.1524.ZS
- GDP Growth — NY.GDP.MKTP.KD.ZG
- Adult Literacy Rate — SE.ADT.LITR.ZS
- Inflation Rate — FP.CPI.TOTL.ZG
- Female Labor Force Participation — SL.TLF.ACTI.FE.ZS
- CO2 Emissions per Capita — EN.ATM.CO2E.PC
- Population Growth — SP.POP.GROW
Natural Language Mapping
Claude API interprets user queries using a hybrid approach. Claude extracts intent from natural language. A deterministic mapping layer resolves the exact World Bank indicator code. Claude never directly handles API codes, preventing hallucination and ensuring consistent data retrieval.
Data Processing
- API response parsed and cleaned
- Null values filtered out
- Data sorted chronologically
- Full snapshot stored in Supabase at time of generation
Security and Data Handling Protocols
API Key Security
- All API keys stored as server-side environment variables only
- Never exposed to the client
- All Claude API and Supabase service role calls made server-side only
Data Integrity
- Every chart generates a SHA256 hash computed from the data values at time of generation
- Hash stored in Supabase and cannot be modified after storage
- Verification recomputes hash from stored values and compares
Tamper Detection
- Claude Vision extracts data values from uploaded chart images
- Values compared against stored record with ±1.0 tolerance for visual estimation
- Discrepancies flagged and displayed year by year
Data Privacy
- No user accounts or personal data collected
- No cookies or tracking
- Verification is public and anonymous
- Chart records are append-only