ToolNaka — Hardening & Delivery Handoff

Industrial B2B procurement platform · https://toolsnaka.store
Live Auth hardened Delivery format removed DB tuned
Report generated 2026-09-12 · Next.js 16 · Prisma 6 · SQLite

1. What was completed this run

Delivery format

Removed 100%
ToolNaka-side fleet, rider, GPS-tracking and vehicle/settlement UI stripped from the vendor dashboard; landing-page claims rewritten to vendor-hand delivery.

API security

25 routes secured
Every previously-open /api/* handler now requires a valid Bearer token (verifyToken).

Database

13 new indexes
WAL journal + 5s busy-timeout enabled; daily automated backups scheduled.

Plant Head Oversight

Verified end-to-end
Vendor→parts visibility, department ordering, flag/clear with reason.

2. Delivery-format removal (frontend + backend)

AreaActionEvidence
Vendor dashboardRemoved Delivery tab, NAV entry, MOCK_DELIVERIES, DELIVERY_STEPS, VEHICLE_OPTIONS, VehicleOption/DeliveryStatus types, deliveries state & fetchFile rebuilt from source package; tsc 0
Landing page“Live Delivery Tracking” → “Vendor-Managed Delivery”; GPS/partner copy rewrittenLive HTML check: old string absent, new string present
Legacy APIs/api/delivery, /api/riders, /api/rider, /api/nearby, /api/zones, /api/zone-vendors, /api/driver-profileAll 404 live

3. API authentication hardening

25 routes that previously accepted unauthenticated requests now enforce a signed JWT. A global client-side fetch interceptor (AuthFetchPatch) auto-attaches the current user’s Bearer token to every /api/ call, so existing UI flows keep working.

TestResult
15 protected GET routes without a token401 Unauthorized (all 15)
POST /api/challan-invoices without a token401
Authenticated factory token → orders / invoices / challans / monthly-bills200 (all 4)
Client interceptor present in deployed bundleFound in static/chunks

4. Database reliability & scale

ItemDetailVerification
WAL journal modePRAGMA journal_mode=WALjournal_mode = wal (Prisma query)
busy timeoutPRAGMA busy_timeout=5000; pool connection_limit=1Applied at startup in src/lib/db.ts
Indexes addedProduct(name), Product(vendorId,isActive), Product(category,isActive), Order(factoryId,status), Order(vendorId,status), Order(createdAt), OrderItem(orderId/productId), Invoice(factoryId/paymentStatus,status,createdAt), Challan(factoryId/vendorId,status,createdAt,monthlyBillId), ChallanItem(challanId)39 total custom indexes confirmed via sqlite_master
Pagination/api/products?limit=&page= (legacy full list capped at 500)limit=3 → 3 of 35, 12 pages; no-param → 35
Daily backupscripts/backup-db.cjs (VACUUM INTO / file-copy fallback, keeps 14)Snapshot created (~2.6 MB); Windows task ToolNakaDbBackup @ 02:30

5. Plant Head Oversight (verified live)

GET  /api/oversight   -> 200
     vendors: 1   departments: 1   recentOrders: 4
     totals: { orderCount: 4, value: 17464, vendorCount: 1, flaggedCount: 0 }
POST /api/oversight   { orderId, action: "flag"|"clear", reason }  -> 200

Test account planthead@test.com seeded against the demo factory; oversight tab renders vendor→parts, department table and per-order Flag/Stop + Clear&Proceed controls.

6. Live endpoint verification

CheckStatus
Health200 {"status":"ok","db":"ok"}
Landing page200
Removed delivery routes404 ×7
Unauthenticated protected routes401 ×16
Authenticated factory/vendor/plant-head flows200

6b. Fresh-start reset (2026-09-13)

The site is brand new, so all registered accounts and their data were cleared so real registrations can begin on a clean slate.

ItemBefore → After
Accounts (factory / vendor / dept_manager / plant_head / delivery)19 → 0 (only admin@toolnaka.com kept)
Products38 → 0
Orders / Order items4 / 4 → 0
Challans / items, Invoices, Monthly bills34 / 17 / 2 → 0
RFQs / quotations, Part requests / responses, Payments4 / 5 / 5 / 4 / 6 → 0
Vendors / vendor profiles / factory profiles3 / 5 / 7 → 0
KeptPincodeCoverage reference data (19 rows)
SafetyFull DB snapshot taken before the wipe (kept in backups/)
UIAdmin dashboard mock-seeded lists emptied and obsolete delivery/fleet tabs (Deliveries, Zones & Coverage, Settlements) removed

Verified live: /api/products returns 0; all dashboards start from empty state.

7. How to operate

8. Remaining / next

Known open items (not blockers):
ToolNaka handoff report · generated automatically from live verification · source package: ToolNaka-Full-Package.tar.gz