• Blog
  • Docs
  • Pricing
  • Weโ€™re hiring!
Log inSign up
axiom

axiom

the-playbook-hono-react

open-source demo by Banks (jabanks@gmail.com)
Remix of axiom/the-playbook
Public
Like
the-playbook-hono-react
Home
Code
11
ui
2
README.md
api.ts
auth.ts
config.ts
database.ts
engine.ts
H
main.ts
setup.ts
types.ts
utils.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ€“ all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
โ€ฆ
README.md

๐Ÿ† THE PLAYBOOK

"Attack the market. Armor the business."

The Playbook is a premium AI-powered positioning intelligence platform that analyzes your business copy from both offensive and defensive perspectives. Think of it as having an elite coaching staff that gives you the plays they don't teach โ€” and the defense they can't break.

Version TypeScript Hono License


๐ŸŽฏ What Is This?

The Playbook analyzes your positioning copy (websites, sales pages, pitch decks, etc.) through 8 specialized AI lenses โ€” 4 offensive and 4 defensive โ€” giving you:

  • Core belief extraction from your copy
  • Offensive analysis to find market attack opportunities
  • Defensive analysis to identify vulnerabilities before competitors do
  • Phoenix Fortress combined analysis for total market dominance

It's like having a $50,000 strategic consultant available 24/7.


๐Ÿ”ฅ๐Ÿฐ The Dual-Service Model

The Phoenix ๐Ÿ”ฅ (Offense)

"Rise. Strike. Dominate."

The Unstoppable Force. Finds opportunities others miss and turns your positioning into a weapon.

The Fortress ๐Ÿฐ (Defense)

"Stand. Shield. Survive."

The Immovable Object. Protects your position from every angle of attack.

Phoenix Fortress โš”๏ธ๐Ÿ›ก๏ธ (Combined)

"Total. Market. Dominance."

When the Unstoppable Force meets the Immovable Object. Complete strategic command.


๐Ÿ“‹ Features

Core Capabilities

  • โœ… AI-Powered Belief Extraction โ€” Distills your copy into 5-7 core positioning beliefs
  • โœ… 8 Strategic Lenses โ€” 4 offensive + 4 defensive perspectives
  • โœ… Clarity Scoring โ€” 0-100 score with actionable feedback
  • โœ… Phoenix Fortress Analysis โ€” Premium combined offense + defense report
  • โœ… Document Management โ€” Upload, organize, and re-analyze your copy

Platform Features

  • โœ… First-Run Setup Wizard โ€” Guided initial configuration
  • โœ… Tiered Access Control โ€” Rookie โ†’ Starter โ†’ MVP
  • โœ… Session-Based Auth โ€” Secure cookie-based authentication
  • โœ… Usage Tracking โ€” Analytics for feature usage
  • โœ… Responsive UI โ€” Works on desktop and mobile

๐Ÿ” The 8 Strategic Lenses

๐Ÿ”ฅ Phoenix Squad (Offensive)

LensRoleBias
๐Ÿ’ฅ The Market DisruptorFinds blue ocean opportunities"If you're not zigging while they zag, you're invisible."
๐ŸŽฏ The CloserIdentifies conversion killers"Every word either sells or stalls. There is no neutral."
๐Ÿš€ The Viral ArchitectEvaluates shareability & growth"If they can't explain you in 10 seconds, they won't."
๐Ÿ‘‘ The Premium PositionerAudits pricing psychology"Cheap is a strategy. Expensive is a strategy. Confused is a disaster."

๐Ÿฐ Fortress Squad (Defensive)

LensRoleBias
๐Ÿคจ The Skeptical ProspectHunts for trust gaps"Prove it or lose it. I've been burned before."
๐Ÿ•ต๏ธ The Competitor's StrategistFinds attack vectors"I see your flank. Trust me, they see it too."
โš ๏ธ The Risk AuditorSpots compliance & legal risks"What can go wrong, will go wrong. Let's find it first."
๐Ÿ”ฎ The Churn ProphetPredicts retention risks"Winning the deal means nothing if you lose the client in 90 days."

๐Ÿ’ฐ Tier System

TierPriceDocuments/MoOffensive LensesDefensive LensesPhoenix Fortress
๐ŸŒฑ RookieFree31 (Disruptor)1 (Skeptic)โŒ
โญ Starter$79/mo50All 4All 4โœ…
๐Ÿ† MVP$199/mo500All 4All 4โœ… + Team

๐Ÿ—๏ธ Architecture

Tech Stack

  • Runtime: Deno (Val Town)
  • Framework: Hono 4.4
  • Database: SQLite (libSQL)
  • AI: OpenAI GPT-4o
  • Frontend: React 18 (CDN + Babel)
  • Styling: CSS-in-JS (generated)

File Structure

/playbook
โ”œโ”€โ”€ index.ts              # Main entry point & Hono server
โ”œโ”€โ”€ config.ts             # App constants, mascots, tiers, lenses
โ”œโ”€โ”€ types.ts              # TypeScript interfaces & type guards
โ”œโ”€โ”€ database.ts           # SQLite schema, migrations, CRUD operations
โ”œโ”€โ”€ auth.ts               # Authentication service & middleware
โ”œโ”€โ”€ engine.ts             # AI analysis engine (OpenAI integration)
โ”œโ”€โ”€ api.ts                # REST API route handlers
โ”œโ”€โ”€ setup.ts              # First-run setup wizard
โ”œโ”€โ”€ utils.ts              # Helper utilities
โ””โ”€โ”€ ui/
    โ”œโ”€โ”€ pages.ts          # HTML page generators
    โ””โ”€โ”€ styles.ts         # CSS stylesheet generator

๐Ÿš€ Getting Started

Prerequisites

  • Val Town account (or Deno runtime)
  • OpenAI API key (configured in Val Town)

Installation

  1. Clone/Import the project into Val Town

  2. Run the application โ€” On first run, you'll see the Setup Wizard

  3. Complete Setup:

    • Enter your admin email
    • Optionally add your name and company
    • Accept terms and initialize
  4. Start Analyzing:

    • Upload your first document (website copy, sales page, etc.)
    • View extracted positioning beliefs
    • Run offensive and defensive analyses
    • Get actionable recommendations

Environment Variables

The following should be configured in Val Town:

VariableDescription
OPENAI_API_KEYYour OpenAI API key (auto-configured in Val Town)

๐Ÿ“ก API Reference

Authentication

POST /api/auth/login

Authenticate or create a user by email.

// Request { "email": "coach@company.com", "name": "Coach Johnson" } // Response { "success": true, "message": "Welcome to The Playbook", "user": {...} }

POST /api/auth/logout

End the current session.

GET /api/auth/me

Get the current authenticated user.


Documents

GET /api/docs

List all documents for the authenticated user.

POST /api/docs

Upload and analyze a new document.

// Request { "title": "Homepage V2", "text": "Your positioning copy here..." } // Response { "success": true, "document": {...}, "beliefs": [...], "score": 75 }

GET /api/docs/:id

Get a specific document.

DELETE /api/docs/:id

Delete a document and all analyses.

GET /api/docs/:id/beliefs

Get extracted beliefs for a document.

GET /api/docs/:id/analyses

Get all analyses run on a document.


Analysis

POST /api/analyze/offensive

Run an offensive (Phoenix) analysis.

// Request { "documentId": "doc_xxx", "lensId": "MarketDisruptor" } // Response { "success": true, "lens": { "id": "MarketDisruptor", "name": "The Market Disruptor", ... }, "mascot": { "name": "The Phoenix", ... }, "analysis": { "score": 72, "strengths": [...], "gaps": [...], "plays": [...], "summary": "..." } }

POST /api/analyze/defensive

Run a defensive (Fortress) analysis.

// Request { "documentId": "doc_xxx", "lensId": "SkepticalProspect" } // Response { "success": true, "lens": { "id": "SkepticalProspect", ... }, "mascot": { "name": "The Fortress", ... }, "analysis": { "score": 68, "protected": [...], "exposed": [...], "fortifications": [...], "summary": "..." } }

POST /api/analyze/phoenix-fortress

Run a combined Phoenix Fortress analysis (Starter+ only).

// Request { "documentId": "doc_xxx" } // Response { "success": true, "mascot": { "name": "Phoenix Fortress", ... }, "analysis": { "offensiveScore": 74, "defensiveScore": 68, "combinedScore": 71, "executiveSummary": "...", "topPlays": [...], "criticalFortifications": [...], "ultimateStrategy": "The cheat code..." } }

Billing

GET /api/billing/tiers

Get available subscription tiers.

POST /api/billing/upgrade

Upgrade to a new tier.

// Request { "tier": "tier_starter" } // Response { "success": true, "message": "Welcome to Starter!", "user": {...} }

Utility

GET /api/lenses

Get all lenses with access status for the current user.

GET /api/mascots

Get mascot information.

GET /api/health

Health check endpoint.


๐ŸŽจ Brand Guidelines

Taglines (Used Throughout)

  1. "Attack the market. Armor the business." โ€” Primary
  2. "Every angle. Every outcome. Every advantage." โ€” Comprehensive
  3. "The plays they don't teach. The defense they can't break." โ€” Insider knowledge
  4. "Win the deal. Survive the scrutiny." โ€” Outcomes
  5. "Tribal knowledge, weaponized." โ€” Expert edge

Colors

ElementColorHex
Phoenix (Offense)Amber/Orange#f59e0b
Fortress (Defense)Sky Blue#0ea5e9
Combined/LegendaryPurple#a855f7
SuccessEmerald#10b981
ErrorRose#f43f5e

Voice & Tone

  • Confident โ€” We know what we're talking about
  • Direct โ€” No fluff, no filler
  • Strategic โ€” Always thinking three moves ahead
  • Empowering โ€” We're here to help you win

๐Ÿงช Development

Running Locally (Deno)

# Install Deno curl -fsSL https://deno.land/install.sh | sh # Run the application deno run --allow-net --allow-env index.ts

Database Reset

If you need to reset the database during development:

import { resetDatabase } from "./database.ts"; await resetDatabase(); // WARNING: Deletes all data

Adding a New Lens

  1. Add the lens definition to config.ts:
// In OFFENSIVE_LENSES or DEFENSIVE_LENSES { id: "NewLensId", name: "The New Lens", emoji: "๐Ÿ†•", squad: "phoenix", // or "fortress" description: "What this lens does.", bias: "The lens's perspective quote.", focus: ["Focus area 1", "Focus area 2", ...], requiredTier: "tier_starter", }
  1. The engine will automatically pick it up โ€” no other changes needed!

๐Ÿ“Š Database Schema

Tables

TablePurpose
usersUser accounts
sessionsAuthentication sessions
documentsUploaded positioning copy
analysesIndividual lens analyses
playbook_reportsCombined Phoenix Fortress reports
system_configApp configuration (setup status, etc.)
usage_logsAnalytics and usage tracking

Key Relationships

  • Users โ†’ Documents (1:many)
  • Documents โ†’ Analyses (1:many)
  • Users โ†’ Playbook Reports (1:many)

๐Ÿ”’ Security Considerations

  • Session-based auth with HTTP-only cookies
  • User-scoped data โ€” users can only access their own documents
  • Input validation with Zod schemas
  • SQL injection protection via parameterized queries
  • XSS protection via HTML entity escaping

Production Recommendations

  • Add rate limiting
  • Implement proper payment processing (Stripe)
  • Add email verification
  • Enable HTTPS only
  • Add audit logging
  • Implement backup strategy

๐Ÿ—บ๏ธ Roadmap

v3.1 (Planned)

  • PDF export of analyses
  • Document comparison tool
  • Analysis history timeline
  • Team collaboration features

v3.2 (Future)

  • Custom lens creation
  • Industry-specific lens packs
  • API access for integrations
  • White-label reporting

v4.0 (Vision)

  • Real-time collaborative editing
  • Competitor tracking
  • A/B test recommendations
  • Automated improvement suggestions

๐Ÿค Contributing

We welcome contributions! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Style

  • Use TypeScript strict mode
  • Document all functions with JSDoc
  • Follow existing naming conventions
  • Write meaningful commit messages

๐Ÿ“œ License

MIT License โ€” see LICENSE for details.


๐Ÿ™ Acknowledgments

  • OpenAI for GPT-4o
  • Val Town for the hosting platform
  • Hono for the lightweight framework
  • The positioning strategists who inspired the lens philosophies

Built with ๐Ÿ”ฅ and ๐Ÿฐ by The Playbook Team

"Attack the market. Armor the business."

Get Started ยท API Docs ยท Report Bug ยท Request Feature

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
Weโ€™re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
ยฉ 2025 Val Town, Inc.