🥋 Dojo Jutsu Docs docs.dojojutsu.com
← dojojutsu.com Launch Portal →

# Dojo Jutsu — Custom Website & Portal Developer Handover Guide ("Hand This to Your Tech Guy")

Audience: Dojo Webmasters, Technical Students, WordPress/Squarespace Admins, and Full-Stack Agency Developers
Security Architecture: Zero-Leak Row Level Security (RLS) • Scoped SHA-256 API Keys • CORS Domain Locking • HMAC-SHA256 Webhooks

# 1. Quick Start: Choose Your Integration Level

Dojo Jutsu gives you three ways to connect your academy's website (my-dojo.com) to your live dojo operations—ranging from a 2-minute copy-paste HTML snippet to a custom server-to-server portal API:

LevelBest ForKey Type UsedEffort
Level 1: Drop-In Web ComponentsWordPress, Squarespace, Wix, Webflow, static HTML sites wanting live schedules, rank requirements, and online trial waiversPublishable Key (dj_pub_...)2 Minutes (Copy & Paste)
Level 2: Hosted Companion Web Portal LinkLinking your website's "Student Login" button directly to your branded Dojo Jutsu Web Portal (portal.dojojutsu.com/<your-slug>)None (Uses Supabase OAuth / Magic Link / Biometrics)1 Minute
Level 3: Custom Server-to-Server REST API & WebhooksCustom Next.js, React, Django, or CRM portals built by your dojo's developerRestricted Secret Key (dj_sec_...)1–2 Hours

# 2. How the Dojo Owner Generates Your API Keys

  • In the Dojo Jutsu app (or Web Admin Dashboard), the Head Instructor / Owner opens Administration & Dojo Setup → API Keys & Web Embeds.
  • Whitelist Your Domain: Under Whitelisted Website Domains (CORS Armor), add your production website URL (e.g., https://wakatakekan.com).
  • For Frontend Embeds (Level 1): Tap New Publishable Key (dj_pub_...). This key is safe to place in public HTML and can only read public schedules, syllabus titles, and submit new student trial waivers.
  • For Custom Backend Scripts (Level 3): Tap New Secret Key (dj_sec_...).
  • Security Note: Creating or revoking a dj_sec_... key requires the Sensei to complete Tier 2 Dual-Gate Verification (Biometrics / Phone PIN + 6-digit Authenticator MFA or Sensei Security PIN).
  • Copy the raw dj_sec_... key immediately and store it in your server's .env file (DOJOJUTSU_SECRET_KEY). Never commit dj_sec_... keys to Git or expose them in browser JavaScript.

# 3. Level 1: Drop-In HTML Web Components (dj_pub_...)

Paste this snippet into any WordPress Custom HTML block, Squarespace Code Block, or Next.js page:

HTML
<!-- 1. Load the lightweight Dojo Jutsu Embed SDK -->
<script src="https://cdn.dojojutsu.com/v1/embed.js" async></script>

<!-- 2. Live Class Schedule Grid -->
<dojo-jutsu-schedule
  dojo-key="dj_pub_wakatake_live_9f81a7b2c3d4e5f6"
  theme="forest_green">
</dojo-jutsu-schedule>

<!-- 3. Digital Trial Signup & E-Waiver Form (Flows directly to Sensei's Mat Tablet!) -->
<dojo-jutsu-waiver
  dojo-key="dj_pub_wakatake_live_9f81a7b2c3d4e5f6">
</dojo-jutsu-waiver>

<!-- 4. Belt Rank & Curriculum Syllabus Viewer -->
<dojo-jutsu-syllabus
  dojo-key="dj_pub_wakatake_live_9f81a7b2c3d4e5f6">
</dojo-jutsu-syllabus>

# 4. Level 3: Server-to-Server Scoped REST API (dj_sec_...)

All server-to-server calls route through the tenant-isolated Edge Gateway. You never need raw database credentials; the gateway validates the SHA-256 hash of your dj_sec_... key and scopes every query strictly to your dojo_id.

# Base URL

TEXT
https://<project-ref>.supabase.co/functions/v1/tenant-developer-api

# Example 1: Fetch Live Class Schedules & Seminars (Server-Side Next.js / Node.js)

TYPESCRIPT
const response = await fetch(
  "https://<project-ref>.supabase.co/functions/v1/tenant-developer-api/schedules",
  {
    method: "GET",
    headers: {
      Authorization: `Bearer ${process.env.DOJOJUTSU_SECRET_KEY}`, // dj_sec_...
      "Content-Type": "application/json",
    },
    next: { revalidate: 60 },
  }
);

const { dojo, schedules } = await response.json();

# Example 2: Submit a Custom Website Trial Lead / Waiver (write:prospects scope)

BASH
curl -X POST "https://<project-ref>.supabase.co/functions/v1/tenant-developer-api/prospects" \
  -H "Authorization: Bearer dj_sec_wakatake_..." \
  -H "Content-Type: application/json" \
  -d '{
    "full_name": "Kenji Takahashi",
    "email": "kenji@example.com",
    "phone": "+1-555-0199",
    "waiver_signed": true,
    "waiver_signature_text": "Kenji Takahashi",
    "notes": "Interested in Saturday 0530 Keiko"
  }'

# 5. Verifying Outbound Webhooks (X-DojoJutsu-Signature)

When you register a webhook receiver URL in the API Keys console, Dojo Jutsu signs every outbound POST request (prospect.waiver_signed, student.checked_in, student.rank_promoted, membership.status_changed) using HMAC-SHA256:

TYPESCRIPT
import crypto from "node:crypto";

export function verifyDojoJutsuWebhook(
  rawBody: string,
  signatureHeader: string,
  webhookSecret: string // whsec_...
): boolean {
  const expected = crypto
    .createHmac("sha256", webhookSecret)
    .update(rawBody, "utf8")
    .digest("hex");

  return crypto.timingSafeEqual(
    Buffer.from(signatureHeader, "utf8"),
    Buffer.from(expected, "utf8")
  );
}

# 6. Shoulder-Surfing Privacy Guardrail for External Portals

Even when using a server-side dj_sec_... key:

  • Public or roster-summary endpoints never return individual student dollar amounts, grandfathered rates, or scholarship labels.
  • Individual billing renewal links are accessible only when a student authenticates with their personal JWT via /functions/v1/headless-student-portal.