E5D8 GitHub - henryperkins/tarot
[go: up one dir, main page]

Skip to content

henryperkins/tarot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Tableu

Tableu is a sophisticated AI-powered tarot reading application that bridges traditional cartomancy with modern generative AI. Unlike simple database-lookup tarot apps, it uses advanced Large Language Models to synthesize complex card relationships, positional meanings, and user context into cohesive, human-like narratives.

๐Ÿ”ฎ Designed to feel like sitting with a practiced reader, not a generic card widget.

โœจ Features

  • Multiple Spread Types: One-Card Insight, Three-Card Story, Five-Card Clarity, Decision/Two-Path, Relationship Snapshot, and Celtic Cross (10-card)
  • AI-Generated Narratives: Context-aware readings powered by Azure OpenAI GPT-5.1 with Claude fallback
  • Knowledge Graph Analysis: Advanced pattern detection including elemental dignities, suit progressions, and archetypal triads
  • Text-to-Speech: Listen to readings with Azure GPT-4o-mini TTS
  • Personal Journal: Save and reflect on readings (cloud sync for authenticated users, localStorage for anonymous)
  • Shareable Readings: Generate links to share readings with others
  • Ritual Experience: Authentic tarot feel with knocks, deck cutting, and card reveal animations
  • Accessibility: WCAG-compliant with keyboard navigation, ARIA labels, and reduced-motion support
  • PWA Support: Installable progressive web app with offline capabilities

๐Ÿ›  Tech Stack

Layer Technology
Frontend React 18, Vite, Tailwind CSS
Backend Cloudflare Workers (serverless)
AI Azure OpenAI (GPT-5.1, GPT-4o-mini TTS), Anthropic Claude
Database Cloudflare D1 (SQLite)
Caching/Rate Limiting Cloudflare KV
Storage Cloudflare R2

๐Ÿ“ Project Structure

โ”œโ”€โ”€ src/                    # React frontend
โ”‚   โ”œโ”€โ”€ components/         # UI components (Card, ReadingGrid, etc.)
โ”‚   โ”œโ”€โ”€ contexts/           # React contexts (Auth, Preferences, Reading)
โ”‚   โ”œโ”€โ”€ data/               # Card data and spread definitions
โ”‚   โ”œโ”€โ”€ hooks/              # Custom React hooks
โ”‚   โ”œโ”€โ”€ lib/                # Frontend utilities (audio, deck, formatting)
โ”‚   โ”œโ”€โ”€ pages/              # Route pages
โ”‚   โ”œโ”€โ”€ styles/             # CSS files (Tailwind + custom)
โ”‚   โ”œโ”€โ”€ worker/             # Cloudflare Worker entry point
โ”‚   โ””โ”€โ”€ TarotReading.jsx    # Main orchestration component
โ”œโ”€โ”€ functions/              # Cloudflare Pages Functions (API)
โ”‚   โ”œโ”€โ”€ api/                # API endpoints
โ”‚   โ””โ”€โ”€ lib/                # Backend logic and narrative generation
โ”œโ”€โ”€ public/                 # Static assets (images, sounds, icons)
โ”œโ”€โ”€ tests/                  # Test files (*.test.mjs)
โ”œโ”€โ”€ scripts/                # Utility scripts (evaluation, training)
โ”œโ”€โ”€ docs/                   # Documentation
โ””โ”€โ”€ migrations/             # Database migrations (D1)

๐Ÿš€ Getting Started

Prerequisites

  • Node.js 18.0.0 or later
  • npm (included with Node.js)
  • Cloudflare account (for deployment)

Installation

# Clone the repository
git clone https://github.com/henryperkins/tarot.git
cd tarot

# Install dependencies
npm install

Environment Setup

  1. A0BA

    Create .dev.vars and fill in the required secrets:

    # Azure OpenAI (required for AI-generated readings)
    AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
    AZURE_OPENAI_API_KEY=your-api-key
    AZURE_OPENAI_GPT5_MODEL=gpt-5.1
    
    # Azure TTS (optional, for voice readings)
    AZURE_OPENAI_TTS_ENDPOINT=https://your-resource.openai.azure.com
    AZURE_OPENAI_TTS_API_KEY=your-tts-api-key
    AZURE_OPENAI_GPT_AUDIO_MINI_DEPLOYMENT=gpt-4o-mini-tts
    
    # Anthropic (optional, for Claude fallback)
    AZURE_ANTHROPIC_ENDPOINT=https://<resource>.services.ai.azure.com/anthropic
    AZURE_ANTHROPIC_API_KEY=your-azure-foundry-key  # optional; can fall back to AZURE_OPENAI_API_KEY
    AZURE_ANTHROPIC_MODEL=claude-opus-4-5
    
    # Vision research mode (optional)
    VISION_PROOF_SECRET=your-secret-key
  2. Verify your configuration:

    npm run config:check

โš ๏ธ Never commit .dev.vars to version control. It's already in .gitignore.

๐Ÿ’ป Development

Quick Start

npm run dev

This starts both the Vite dev server and Wrangler Workers dev server. Access the app at http://localhost:5173 (or 5174 if 5173 is in use). Vite proxies /api requests to Workers on 8787.

Available Scripts

Command Description
npm run dev Start full-stack development server
npm run dev:frontend Start Vite dev server only (no API)
npm run dev:wrangler Start Wrangler Workers dev server
npm run build Build for production
npm run preview Preview production build
npm test Run tests
npm run lint Run ESLint
npm run lint:fix Fix linting issues

Important URLs During Development

URL Purpose
http://localhost:5173 Full app with API (HMR + /api proxy)
http://localhost:8787 Workers preview (serves dist/)

Debugging in VS Code (CDP / Chrome attach)

Some debugging workflows (including VS Code โ€œAttach to Chromeโ€) expect a browser already running with Chrome DevTools Protocol (CDP) enabled on port 9222.

This repo includes a helper script that launches Playwrightโ€™s bundled Chromium with CDP enabled (so you donโ€™t need system Chrome installed):

# Starts Chromium with CDP on http://127.0.0.1:9222
npm run chrome:debug

Notes:

  • In many Linux container/remote environments Chromium sandboxing is restricted; the script will automatically fall back to --no-sandbox when needed.

  • If you need the port reachable from outside the container/VM, bind to all interfaces and forward the port:

    npm run chrome:debug -- --host 0.0.0.0
  • To avoid port conflicts, pick another port:

    npm run chrome:debug -- --port 9333

If you use VS Code, this repo also includes .vscode/launch.json + .vscode/tasks.json with an โ€œAttach to CDP Chromium (9222)โ€ configuration.

๐Ÿงช Testing

# Run all tests
npm test

# Accessibility tests
npm run test:a11y

# Vision quality gates
npm run gate:vision

# Narrative quality gates
npm run gate:narrative

Tests use Node.js native test runner with .test.mjs files in the tests/ directory.

๐Ÿšข Deployment

Deploy to Cloudflare

# Build and deploy
npm run build && npm run deploy

# Or use the combined script
npm run deploy

Set Production Secrets

wrangler secret put AZURE_OPENAI_ENDPOINT --config wrangler.jsonc
wrangler secret put AZURE_OPENAI_API_KEY --config wrangler.jsonc
wrangler secret put AZURE_OPENAI_GPT5_MODEL --config wrangler.jsonc
# ... add other secrets as needed

Deployment URLs

๐Ÿ“– Documentation

Detailed documentation is available in the docs/ directory:

For comprehensive project guidance, see CLAUDE.md.

๐Ÿค Contributing

  1. Follow Conventional Commits: feat:, fix:, chore:, docs:, test:
  2. Run npm test before pushing changes
  3. Run npm run lint to check code style
  4. Include screenshots for UI changes in PR descriptions
  5. Keep PRs focused; avoid bundling unrelated changes

๐Ÿƒ Spreads

Spread Cards Description
One-Card Insight 1 Quick guidance for a focused question
Three-Card Story 3 Past, Present, Future narrative
Five-Card Clarity 5 Core, Challenge, Hidden, Support, Direction
Decision/Two-Path 5 Compare two options with clarity
Relationship Snapshot 3 You, Them, Connection dynamic
Celtic Cross 10 Classic deep dive for complex questions

โš–๏ธ Ethics

  • Tarot readings are for guidance and reflection, not replacement for professional advice
  • Emphasizes user agency and free will over deterministic predictions
  • No medical, legal, or financial advice
  • Trauma-informed, empowering language
  • Cards are never invented or hallucinated by the AI

๐Ÿ“œ Card Images

The app uses public domain 1909 Rider-Waite "Roses & Lilies" deck images from Wikimedia Commons.


Built with ๐Ÿ”ฎ by the Tableu team

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7

0