Work Tracker

Architecture & Implementation

Where the assessment system lives in the existing stack. Maps to Motherboard, Tathya-portfolio, and the plugin ecosystem.


Existing Stack

ComponentWhatWhere
Motherboard APIGo/Gin gateway: CRM, plugin proxy, auth, entitlements, workflowsmotherboard-api/api/clients, /api/plugins/tathya/*
Client CRMFull model: name, email, phone, status, personal/professional/billing, onboarding, metadata, source, tags, notes, assignedTo, pluginKeyinternal/models/client.go
Client workflowsTransition endpoint: POST /api/clients/:id/transitionroutes_api.go
Plugin systemTathya proxied at /api/plugins/tathya/* with entitlement tathyaplugin_tathya.goTATHYA_PLUGIN_URL
Communication pluginsEmail, SMS, WhatsApp, Telegramroutes_plugin.go
Inventory pluginRegistered in MotherboardregisterInventoryPlugin()
Astrology pluginRegistered in MotherboardregisterAstrologyRoutes()
Tathya-portfolioNext.js 16 on Vercel (tathya.dev), NextAuth, Motherboard OAuthTathya-portfolio/src/app/
Dashboard/dashboard — currently placeholder “core vitals”src/app/dashboard/page.tsx
AnalyticsGTM + gtag on tathya.devlayout.tsx
Tathya-mbExpress microservice (port 3120), MongoDB, JWT authTathya-mb/server/

Architecture Decision

The assessment is NOT a separate app. It splits across two layers:

PUBLIC (no auth)                        PRIVATE (auth + workspace)
─────────────────                       ─────────────────────────
tathya.dev                              Motherboard
├── /assess (public form)               ├── /api/clients (CRM)
├── /assess/[id] (public report)        ├── /api/plugins/tathya/* (plugin API)
├── /api/assess (Next.js route)         ├── Client.metadata.assessment {}
│   ├── POST → create assessment        ├── Client.onboarding {}
│   ├── GET /[id] → fetch results       ├── Workflow transitions
│   └── POST /[id]/verify → run audit   └── Communication plugins
└── /dashboard/assessments (private)
    ├── list all submissions
    ├── per-assessment deep dive
    └── verification overlay
LayerResponsibilityAuth
tathya.dev /assessPublic form + instant reportNone (public)
tathya.dev /api/assessRoute handler: store, score, optionally create Motherboard clientNone for POST, session for dashboard
Tathya-mb or Tathya pluginAssessment data model, scoring engine, verification serviceJWT / plugin proxy
Motherboard CRMProspect → client lifecycle. Assessment in Client.metadataOAuth + workspace
Motherboard commsFollow-up via WhatsApp/Email after assessmentPlugin proxy

Data Model

Assessment Submission (New Collection: assessments)

Lives in Tathya-mb’s MongoDB (or as a Tathya plugin collection proxied through Motherboard).

{
  _id: ObjectId,
 
  profile: {
    businessType: "local" | "ecommerce" | "b2b" | "creator" | "nonprofit" | "other",
    industry: String,
    yearsOperating: "< 1" | "1-3" | "3-10" | "10+",
    teamSize: "solo" | "2-5" | "6-20" | "20+",
    revenueRange: String,
    language: "en" | "hi" | "kn",
    location: {
      city: String,
      state: String,
      country: String  // default "IN"
    }
  },
 
  assessmentPath: "starting" | "growing" | "scaling",
 
  answers: {
    "q1_1": 2,
    "q1_2": 3
    // keyed by question ID
  },
 
  scores: {
    dimensions: {
      strategy:      { raw: 2.5, scaled: 3.1, level: 3 },
      website:       { raw: 1.0, scaled: 1.25, level: 1 },
      analytics:     { raw: 0.5, scaled: 0.63, level: 0 },
      search:        { raw: 1.5, scaled: 1.88, level: 1 },
      content:       { raw: 2.0, scaled: 2.5, level: 2 },
      social:        { raw: 3.0, scaled: 3.75, level: 3 },
      whatsappEmail: { raw: 0.0, scaled: 0.0, level: 0 },
      paidAds:       { raw: 1.0, scaled: 1.25, level: 1 },
      conversion:    { raw: 1.5, scaled: 1.88, level: 1 },
      teamProcess:   { raw: 1.0, scaled: 1.25, level: 1 }
    },
    overall: 1.67,
    maturityLevel: 1,
    maturityLabel: "Present",
    topGaps: ["whatsappEmail", "analytics", "website"],
    pattern: "spiky"  // flat_low | spiky | plateau | high_with_holes | uniform_high
  },
 
  verification: {
    completedAt: Date,
    completedBy: ObjectId,
    checks: {
      googleSearch: {
        query: String,
        found: Boolean,
        position: Number,
        competitors: [String],
        screenshot: String
      },
      googleBusinessProfile: {
        exists: Boolean,
        claimed: Boolean,
        complete: Boolean,
        reviewCount: Number,
        rating: Number,
        missingFields: [String]
      },
      website: {
        exists: Boolean,
        url: String,
        mobileFriendly: Boolean,
        pageSpeedMobile: Number,
        pageSpeedDesktop: Number,
        coreWebVitals: { lcp: Number, inp: Number, cls: Number, pass: Boolean },
        hasAnalytics: Boolean,
        analyticsTool: String,
        hasMetaTags: Boolean,
        hasStructuredData: Boolean
      },
      socialMedia: {
        instagram: { exists: Boolean, handle: String, lastPost: String, followers: Number },
        facebook: { exists: Boolean, lastPost: String, followers: Number },
        youtube: { exists: Boolean },
        whatsapp: { type: "personal" | "business" | "none" }
      },
      directories: {
        justdial: { listed: Boolean, reviews: Number, rating: Number },
        practo: { listed: Boolean },
        sulekha: { listed: Boolean }
      },
      upiPayment: {
        hasQR: Boolean,
        onlinePayment: Boolean
      }
    },
    verificationScore: Number,  // 0-20
    estimatedLevel: Number,
    discrepancies: [{
      dimension: String,
      selfReported: Number,
      verified: Number,
      note: String
    }]
  },
 
  contact: {
    email: String,
    phone: String,
    name: String,
    websiteUrl: String,
    preferredLanguage: "en" | "hi" | "kn",
    consent: {
      saveReport: Boolean,
      emailFollowUp: Boolean,
      whatsappFollowUp: Boolean
    }
  },
 
  status: "completed" | "partial" | "verified" | "converted",
  motherboardClientId: ObjectId,
 
  source: String,    // "website" | "whatsapp_share" | "linkedin" | "direct" | "walk_in"
  referrer: String,
  completedAt: Date,
  createdAt: Date,
  updatedAt: Date
}

Extending the Motherboard Client Model

When an assessment converts to a client, data flows into the existing Client model. No schema changes needed — metadata is already map[string]interface{}.

metadata: {
  "assessment": {
    "assessmentId": "abc123",
    "maturityLevel": 1,
    "maturityLabel": "Present",
    "overallScore": 1.67,
    "topGaps": ["whatsappEmail", "analytics", "website"],
    "pattern": "spiky",
    "verificationScore": 6,
    "assessedAt": "2026-03-23T..."
  }
}
 
source: "assessment"
 
tags: ["level-1", "local-business", "hindi", "healthcare"]
 
onboarding: {
  stage: "assessed"
  // assessed → call_booked → proposal_sent → engaged → active
}

API Endpoints

Public (tathya.dev — Next.js Route Handlers)

MethodPathPurposeAuth
POST/api/assessSubmit answers, calculate scores, store, return reportNone
GET/api/assess/[id]Fetch results by ID (shareable link)None
POST/api/assess/[id]/contactAdd contact info after report shownNone
POST/api/assess/[id]/bookBooking intent; optionally create Motherboard clientNone

Private (Tathya Plugin via Motherboard Proxy)

MethodPath (via /api/plugins/tathya/)PurposeAuth
GET/assessmentsList all (dashboard)Workspace + entitlement
GET/assessments/:idFull detail with verificationWorkspace + entitlement
POST/assessments/:id/verifyRun/update verification checksWorkspace + entitlement
POST/assessments/:id/convertConvert to Motherboard ClientWorkspace + entitlement
GET/assessments/analyticsAggregate statsWorkspace + entitlement
POST/assessments/:id/followupTrigger WhatsApp/email via Motherboard pluginsWorkspace + entitlement

UI Components

Public: /assess

src/app/assess/
├── page.tsx                    # Landing: "Is your digital marketing working?"
├── form/
│   ├── page.tsx                # Assessment form (multi-step)
│   ├── gateway.tsx             # 3 gateway questions → route to path A/B/C
│   ├── path-a.tsx              # Starting Fresh (12 questions, Hindi/English)
│   ├── path-b.tsx              # Growing (standard 40 questions)
│   ├── path-c.tsx              # Scaling (full technical)
│   └── section.tsx             # Reusable section component
├── [id]/
│   └── page.tsx                # Public report page (shareable URL)
└── components/
    ├── radar-chart.tsx          # D3 radar chart
    ├── score-card.tsx           # Dimension breakdown card
    ├── gap-reveal.tsx           # Top 3 gaps with plain-language explanation
    ├── benchmark-comparison.tsx # Comparison to similar businesses
    ├── verification-overlay.tsx # Screenshot + data evidence (post-verify)
    ├── plain-report.tsx         # Path A simplified report (no radar, no jargon)
    └── cta-section.tsx          # Save report / Email breakdown / Book call

Private: /dashboard/assessments

src/app/dashboard/assessments/
├── page.tsx                    # List: sortable, filterable
├── [id]/
│   └── page.tsx                # Deep dive: scores + answers + verification + actions
└── analytics/
    └── page.tsx                # Aggregate: submissions, avg maturity, conversion rates, gaps

Uses existing dashboard layout. The “core vitals” placeholder shows:

  • Total assessments this month
  • Average maturity level
  • Top 3 gaps across all submissions
  • Conversion rate (assessment → call → client)
  • Revenue from assessment-sourced clients

Prospect → Client Pipeline

Assessment Submitted
       │
       ▼
  assessments collection (status: "completed")
       │
  Contact info provided
       │
       ▼
  status: "contacted" → trigger WhatsApp/Email follow-up via Motherboard plugins
       │
  Call booked
       │
       ▼
  POST /api/clients → Create Client in Motherboard CRM
    source: "assessment"
    metadata.assessment: { scores, gaps, pattern }
    tags: ["level-1", "local", "hindi"]
    onboarding.stage: "call_booked"
       │
  Strategy call → you have all the data
       │
       ▼
  POST /clients/:id/transition → "proposal_sent"
       │
  Proposal accepted
       │
       ▼
  transition → "engaged" → Sprint 1 begins
    Plugins activate:
    ├── WhatsApp comms
    ├── Email updates
    ├── Inventory (if applicable)
    └── Astrology (if applicable)

Uses EXISTING POST /api/clients/:id/transition. No new workflow engine.


Plugin Mapping to Client Types

Client TypeRelevant PluginsHow They Connect
Jyotishastrology, whatsapp, telegramAstrology plugin exists. WhatsApp for comms. Assessment identifies Level 0.
Ophthalmologyinventory, whatsapp, email, smsInventory for lens/frame/medication. WhatsApp for reminders. Assessment identifies marketing + ops gaps.
E-commerceinventory, orders, email, whatsappInventory for stock. Orders for fulfilment. Assessment identifies which channels work.
CRM Needwhatsapp, email, core CRMMotherboard CRM IS the solution. Assessment identifies they need structured lead management.

The assessment qualifies which Motherboard plugins the client needs. Maturity gaps → plugin recommendations.


Localisation (i18n)

Approach

Use next-intl with JSON message files. Route-based or cookie-based language selection.

/messages/en.json    # Default
/messages/hi.json    # Hindi — build first
/messages/kn.json    # Kannada — second

All question text, answer options, report text, CTA text, and error messages need translation. Scoring logic is language-independent.

Data Tracks Language

profile.language       // which language the form was taken in
contact.preferredLanguage  // for follow-up messages

Feeds: WhatsApp messages in Hindi, email in Hindi, report PDF in Hindi.


Verification Automation

POST /api/plugins/tathya/assessments/:id/verify

Input: Assessment ID (website URL and business name from the assessment)

Process:

  1. Fetch website → status code, <title>, <meta description>, analytics scripts
  2. PageSpeed Insights API → Core Web Vitals
  3. Google Places API → GBP existence, rating, reviews
  4. Social handles → public page fetch, existence, follower count, last post
  5. Store in verification.checks
  6. Flag manual checks (WhatsApp, in-person)

Semi-Automated Workflow:

Assessment submitted
       │
  Auto-verify runs immediately (website, speed, meta tags, GBP)
       │
  Results stored. Discrepancies flagged.
       │
  You review in dashboard. Add manual checks.
       │
  Full verified report available.

Cost: PageSpeed API free. Google Places API free tier (10K/month). Social checks via public page fetches.


Implementation Priority

#WhatWhereWhy First
1Assessment data model + APITathya-mb or plugin serviceEverything depends on storing and retrieving assessments
2Public assessment form (/assess)tathya.devThe product prospects interact with
3Scoring engine + instant reporttathya.dev + APIForm is worthless without the payoff
4Hindi translationmessages/hi.jsonFirst clients speak Hindi
5Dashboard view (/dashboard/assessments)tathya.devYou need to see and manage submissions
6Assessment → Client conversionMotherboard API integrationConnects to existing CRM pipeline
7Automated verificationTathya plugin APIReplaces manual checks with API calls
8WhatsApp follow-upMotherboard WhatsApp pluginFollow-up in the channel prospects use
9Benchmarking engineTathya-mbNeeds real submission data before it’s meaningful