Documentation

System documentation

Architecture, databases, junctions and how each incorporated application works.

TICH Technologies & Innovation Labs — system documentation

How the portal and applications fit together. All primary application code now lives inside this tichlabs directory so the tree can be moved to https://www.tichlabs.com without depending on C:\MockExam, C:\tichchat, or other host-specific paths.

---

1. Big picture

tichlabs/                          ← deploy this whole folder
├── index.php, products/, admin/, docs/, …
├── tichmock/                      ← TichMock (full app)
├── tichchat/                      ← TichChat (full app; site at web/)
│   └── web/                       ← public download / marketing site
├── tichschool/                    ← TichSchool (Next.js source + demo stub)
├── tichhealth/                    ← TichHealth (Next.js source + demo stub)
├── tichsacco/                     ← TichSACCO (PHP)
├── tichpos/                       ← TichPOS (Electron source + demo stub)
├── tichit/                        ← TichIT (PHP helpdesk / ITSM)
├── ticherp/                       ← TichERP (Electron source + demo stub)
├── tichai/                        ← demo stub (AI with TichChat)
└── apps/
    ├── tich_charlieti/
    ├── tich_election/
    └── tich_web/

Isolation rule: each product keeps its own database, sessions, uploads and credentials. The portal database (tichlabs_portal) is only for the marketing/admin site.

Refresh embedded copies from original machines (optional):

powershell -ExecutionPolicy Bypass -File E:\wwwroot\tichlabs\scripts\embed-apps.ps1

Verify no external junctions:

powershell -ExecutionPolicy Bypass -File E:\wwwroot\tichlabs\scripts\link-apps.ps1

---

2. Application map

| Product | URL | Folder | Stack | Data store |
|---|---|---|---|---|
| **TichMock** | `/tichmock/` | `tichmock/` | HTML/JS + PHP APIs | JSON banks + `api/*-store/` files |
| **TichChat** | `/tichchat/web/` | `tichchat/` | Flutter + NestJS | **PostgreSQL** + Redis |
| **TichSchool** | `/tichschool/` (demo stub; run Next separately) | `tichschool/` | Next.js 14 + Prisma | **MySQL** `tich_school` |
| **TichHealth** | `/tichhealth/` (demo stub) | `tichhealth/` | Next.js 15 + Drizzle | **MySQL** `tich_medical` |
| **TichSACCO** | `/tichsacco/` | `tichsacco/` | PHP | **MySQL** |
| **TichPOS** | `/tichpos/` (demo stub) | `tichpos/` | Electron + Express | **SQLite** |
| **TichIT** | `/tichit/` | `tichit/` | PHP | **MySQL** (`it_helpdesk.sql`) |
| **TichERP** | `/ticherp/` (demo stub) | `ticherp/` | Electron + Express | **SQLite** |
| **TichAI** | `/tichai/` demo | `tichai/` + `tichchat/` | NestJS AI proxy | Via TichChat |

Portal marketing pages show Open Application for TichMock and TichChat; other products show screenshot demos. The application source for every product still sits in this tree for deployment.

---

3. Portal database

  • Schema: `database/migrations/001_portal_schema.sql`
  • Default DB name: `tichlabs_portal`
  • Fallback: `storage/cache/` when MySQL is unavailable

Configure via config/local.php or TICHLABS_DB_* env vars. Never commit passwords.

---

4. How each major system works

4.1 TichMock (`tichmock/`)

Sign in with email OTP → pick certification → work mock sets → reveal answers with explanations → progress saved per email. Study books and audio study sit on the same banks.

Docs: tichmock/docs/TICHMOCK.md

4.2 TichChat (`tichchat/`)

OTP auth → device prekeys → E2EE messaging → optional calls → optional consent-gated AI. Public site: tichchat/web/. API: tichchat/server/. Schema: tichchat/database/migrations/001_init.sql.

4.3 TichSchool (`tichschool/`)

Next.js school ERP (academics, exams, finance, RBAC). Configure .env, npm install, Prisma, npm run dev. Portal index.php shows the marketing demo redirect.

4.4 TichHealth (`tichhealth/`)

Next.js clinical workflows. Own MySQL database. Never publish patient data on the corporate pages.

4.5 TichIT (`tichit/`)

PHP IT service / helpdesk. Schema dump: tichit/it_helpdesk.sql.

4.6 TichSACCO (`tichsacco/`)

PHP member finance app. Configure via its db_connect.php.

4.7 TichPOS / TichERP

Desktop Electron apps under tichpos/ and ticherp/. Install Node deps and run per each README.

4.8 TichAI

Assistance module shipped with TichChat; portal page documents the flow with demos.

---

5. Moving to www.tichlabs.com

  1. Copy the **entire** `tichlabs` folder to the server (or set the vhost document root to it).
  2. Set production `base_url`, disable debug, enable HTTPS.
  3. Create separate DB users/databases per product.
  4. Run `npm install` / migrations only for the Node apps you host.
  5. Confirm `/tichmock/` and `/tichchat/web/` load without referring to any `C:\` path.

Rebuildable folders such as node_modules and .next were excluded from the embed copy on purpose — recreate them on the target host.

---

6. Security

  • Separate DB credentials per app
  • Portal sessions under `storage/sessions`
  • Do not commit `.env`, `config/local.php`, or mail passwords
  • Rotate any credentials that previously lived in plaintext under older trees