Back to Overview
05 / 06
PROJECT 05•local first-nlp

Vita Personal Engine

Local-First Cognitive System with FSRS-6 Algorithm & Client-Side Persian NLP

Live Subdomain DemoView on GitHub

Technologies & Stack

Next.js 16React 19TypeScriptDexie.jsDrizzle ORMPostgreSQLFSRS-6Tailwind CSS v4
vita.parsadevstudio.ir
IDLE
Vita Personal Engine

System Overview & Purpose

A modular, privacy-first progressive web application. Integrates the 6th generation Free Spaced Repetition Scheduler (FSRS-6) with an in-browser Persian Natural Language Processing parser for colloquial financial tracking.

Core Architecture

Zero-latency local writes via Dexie.js (IndexedDB) with asynchronous PostgreSQL synchronization. URL-synced tab navigation completely free of SSR hydration mismatches.

Performance Benchmarks

Local-First

Data Architecture

Zero network latency; full offline operations via IndexedDB

FSRS-6 Model

Learning Engine

Advanced cognitive stability and difficulty forecasting

CLS = 0

Layout Stability

Pixel-perfect loading skeletons preventing render shifts

Engineering Challenges & Solutions

Real software roadblocks encountered during production and their architectural resolutions.

01.

In-Browser Persian Verbal Numeric Tokenizer

The Problem: Extracting numerical quantities and categories from colloquial spoken Persian without transmitting private financial data to external cloud APIs.
The Architectural Solution: Engineered an in-memory recursive segment evaluator parsing Persian verbal numbers, compound connectors ("و", "نیم"), and context classifiers.
In-Browser Persian Verbal Numeric Tokenizer — Source Solutiontypescript
12345678910111213// Client-side recursive tokenizer converting colloquial Persian speech to integer values
export function parseVerbalNumbers(text: string): string {
  const tokens = text.split(/(\s+/);
  // Evaluates words ("یک" to "بیست", "سی" to "نود", "صد" to "نهصد", "میلیون", "هزار")
  // Handles colloquial terms ("نیم", "پونزده تومن") entirely in browser memory
  let value = evaluateSegment(numericWords);

  // Normalizes informal Tomans when unaccompanied by non-financial classifiers (e.g. "کیلو", "ساعت")
  if (value < 1000 && !nonFinancialClassifiers.has(nextWord)) {
    value = value * 1000;
  }
  return value.toString();
}
02.

Resilient Clock-Drift Offline Sync & Tombstoning

The Problem: Client devices with drifted internal clocks caused synchronization queue corruption and overwrote fresh server state upon reconnection.
The Architectural Solution: Engineered a bidirectional sync engine with a 5-second sliding safe-window buffer and tombstones table (deleted_records) reconciling drift deterministically.
Resilient Clock-Drift Offline Sync & Tombstoning — Source Solutiontypescript
123456789101112131415// Bidirectional synchronization engine with 5-second sliding safe-buffer window
export async function syncData(payload: SyncPayload) {
  const lastSyncDate = payload.lastSyncedAt ? new Date(payload.lastSyncedAt) : new Date(0);
  const querySinceDate = new Date(Math.max(0, lastSyncDate.getTime() - 5000)); // 5s clock-drift tolerance

  await db.transaction(async (tx) => {
    // Reconcile and purge tombstones from deleted_records
    await tx.insert(languageCards).values(cardsToUpsert).onConflictDoUpdate({
      target: languageCards.id,
      set: { ...updatedFields },
      where: sql`EXCLUDED.updated_at > ${languageCards.updatedAt} AND ${languageCards.userId} = ${userId}`,
    });
  });
  return { pulled: await pullChangesSince(querySinceDate), serverTimestamp: new Date().toISOString() };
}

Interface & System Screens

High-resolution captures of the live interface and management panels.

Vita Personal Engine Screen 1
01
Vita Personal Engine Screen 2
02
Vita Personal Engine Screen 3
03
Vita Personal Engine Screen 4
04
Previous System
Metricon Link Infrastructure
Next System
Cafe Raz Specialized Commerce
Back to Overview