GFS Platform

Infrastructure

Worker endpoints, cron, bindings, secrets map

Custom domain
api.ai-globalfoodsolutions.co
Fallback
gfs-platform.mikelevine.workers.dev
Endpoints
19
Crons
2
DNS records
6

Cloudflare services

  • Workergfs-platform, source src/index.ts. Routes api.ai-globalfoodsolutions.co/*.
  • D1gfs-netsuite (3818ecd5-995e-4694-a08b-a273c94291da).
  • KV — namespace CACHE (e880e40bc3674963bc37cf90e02f6369).
  • R2 — bucket gfs-files.
  • Pagesgfs-netsuite.pages.dev (this platform). Legacy: gfs-system-guide.pages.dev.
  • DNS / zoneai-globalfoodsolutions.co (owned). Corporate domain globalfoodsolutions.co also owned.

Worker endpoints — overview 19 detected

Detected by static analysis of src/index.ts. Detail per endpoint below.

PathAuthMethod
/PublicGET
/api/BearerGET
/api/ar/agingBearerGET
/api/briefingBearerGET
/api/customersBearerGET
/api/customers/rankingBearerGET
/api/financials/monthlyBearerGET
/api/financials/summaryBearerGET
/api/gl/accountsBearerGET
/api/healthPublicGET
/api/itemsBearerGET
/api/items/performanceBearerGET
/api/kpisBearerGET
/api/revenue/trendBearerGET
/api/searchBearerGET
/api/sync-statusPublicGET
/api/transactionsBearerGET
/api/vendorsBearerGET
/api/vendors/spendBearerGET

Worker endpoints — per-endpoint detail 20 documented

Param tables, auth, and example responses for every public endpoint. Source: data/api-endpoints.json.

GET /api/healthPublic

Example response

{ "status": "ok", "database": "gfs-netsuite", "counts": { "customers": 283, "vendors": 484, "items": 1265, "transactions": 102367, "invoice_lines": 28528, "so_lines": 29098, "vb_lines": 21315, "pricing": 1264 }, "timestamp": "2026-05-19T13:33:03.674Z" }
GET /api/kpisBearer

Example response

{ "revenue_2026_ytd": 11272175.89, "revenue_2025_total": 28435586.26, "open_ar": { "amount": 2299955.6, "count": 216 }, "open_ap": { "amount": ..., "count": ... }, "open_so": { "amount": ..., "count": 90 }, "timestamp": "..." }
GET /api/briefingBearer

Example response

{ "revenue_2026_ytd": ..., "open_ar": { "amount": ..., "count": ... }, "open_so": { "amount": ..., "count": ... }, "invoices_this_month": { "amount": ..., "count": ... }, "top_customers_2026": [ { "entity_name": "Driscoll Foods", "revenue": 4107918.47 }, ... ], "timestamp": "..." }
GET /api/customersBearer

Parameters

ParamTypeDefaultDescription
qstringSearch by company name (LIKE %q%)
limitint501-200
offsetint00-100000

Example response

{ "items": [...], "total": 283, "limit": 50, "offset": 0 }
GET /api/customers/:idBearer

Example response

{ "id": 475, "companyname": "Jkings", ..., "contacts": [...], "pricing": [...], "recent_orders": [...] }
GET /api/customers/:id/historyBearer

Example response

{ "customer_id": "475", "yearly": [{ "year": 2026, "type": "CustInvc", "txn_count": 47, "total": ... }], "top_items": [...] }
GET /api/customers/rankingBearer

Parameters

ParamTypeDefault
yearint2026

Example response

{ "year": 2026, "items": [{ "customer": "Driscoll Foods", "customer_id": 539, "inv_count": ..., "revenue": 4107918.47 }, ...] }
GET /api/vendorsBearer
GET /api/vendors/spendBearer

Parameters

ParamTypeDefault
yearint2026
GET /api/itemsBearer

Parameters

ParamTypeDefaultAllowed Values
typestringInvtPart, Assembly, Kit, NonInvtPart
allergenstringmilk, eggs, peanuts, soybeans, wheat, fish, tree_nuts, crustacean, celery, lupin, molluscs, mustard, sesame, sulphur_dioxide
limitint501-200
offsetint00-100000
GET /api/items/:idBearer
GET /api/items/performanceBearer

Parameters

ParamTypeDefault
yearint2026
GET /api/items/:id/customersBearer
GET /api/transactionsBearer

Parameters

ParamTypeDefaultAllowed
typestringCustInvc16 validated types
yearint2018-2027
limitint501-200
offsetint00-100000
GET /api/ar/agingBearer

Example response

{ "items": [{ "customer": "...", "customer_id": ..., "inv_count": ..., "total_ar": ..., "current_bal": ..., "days_1_30": ..., "days_31_60": ..., "days_61_90": ..., "days_90_plus": ... }] }
GET /api/financials/summaryBearer

Example response

{ "revenue": [{ "year": 2026, "invoices": 712, "total": 11272175.89 }, ...], "cogs": [...], "collections": [...] }
GET /api/financials/monthlyBearer

Parameters

ParamTypeDefault
yearint2026
GET /api/revenue/trendBearer
GET /api/gl/accountsBearer

Parameters

ParamTypeDefaultValues
typestringBank, AcctRec, AcctPay, Income, COGS, Expense, Equity, OthCurrAsset, OthCurrLiab, FixedAsset, OthIncome, OthExpense, NonPosting

Example requests

# Health (public) curl https://api.ai-globalfoodsolutions.co/api/health # KPIs (auth) curl -H "Authorization: Bearer $API_KEY" \ https://api.ai-globalfoodsolutions.co/api/kpis # Fallback when custom domain unavailable curl https://gfs-platform.mikelevine.workers.dev/api/health

CORS & security headers

Origins allowed by the Worker: https://ai-globalfoodsolutions.co, https://www.ai-globalfoodsolutions.co, http://localhost:3000, http://localhost:8787.

Headers on every JSON response: X-Content-Type-Options: nosniff, X-Frame-Options: DENY, Referrer-Policy: strict-origin-when-cross-origin, Content-Security-Policy: default-src 'none'; frame-ancestors 'none'.

DNS records 6 records

Records on the ai-globalfoodsolutions.co zone. Proxied = behind Cloudflare WAF/CDN.

TypeNameValueProxy
CNAMEapigfs-platform.mikelevine.workers.devProxied
CNAMEwwwai-globalfoodsolutions.coProxied
MX@route1.mx.cloudflare.net (priority 87)
TXT@v=spf1 include:_spf.mx.cloudflare.net ~all
TXT_dmarcv=DMARC1; p=none; ...
NS@chance.ns.cloudflare.com · leanna.ns.cloudflare.com

Cron schedules

Declared in wrangler.jsonc:

  • */15 * * * *
  • 0 19 * * *
Worker scheduled() handler is not implemented in src/index.ts. Periodic work runs locally — see next section.

Local cron (actually running)

ScriptCadenceFunctionSource
sync.shevery 15 min via launchdQueries Chartstone (localhost:56411) for modified NS transactions in the last 30 min, upserts into D1.sync.sh
daily-report.sharchived(Out of scope — revenue report.)archive/2026-05/daily-report.sh
Single-laptop dependency: if the Mac is off, sync stops. Migration to Worker-side scheduled() handler calling SuiteAPI directly — Tier 2 GAP.

Bindings

BindingTypeTarget
DBD1 databasegfs-netsuite (3818ecd5-995e-4694-a08b-a273c94291da)
CACHEKV namespacee880e40bc3674963bc37cf90e02f6369
STORAGER2 bucketgfs-files
API_KEYSecretset via wrangler secret put API_KEY

Secrets map

Names only. Rotation cadence in runbook → secret rotation.

NameLocationUse
API_KEYWorker env (Cloudflare)Bearer for protected REST endpoints
CHARTSTONE_SECRETLocal ~/.zshenvBearer used by sync.sh to call Chartstone
(NetSuite TBA tokens)NetSuite Manage Auth TokensSuiteAttach, Analytics Warehouse, Chartstone Pro

Deploy commands

# Worker wrangler deploy # Tail Worker logs wrangler tail # Run query against D1 wrangler d1 execute gfs-netsuite --remote --command="SELECT COUNT(*) FROM transactions" # Manage secret wrangler secret put API_KEY # Pages deploy (this platform) wrangler pages deploy . --project-name gfs-netsuite