跳转到内容
#0306
ExecSqliteContainers

Every customer gets analytics; no customer gets a BI seat

Your SaaS has 600 customers. They all want a usage page. Embedded-BI vendors quote per viewer; your margin quotes back no.

Each customer already has a container with their own SQLite file. You drop one script into every container's exec folder: analytics/usage.ts queries the local database, aggregates by week, returns JSON. Your product iframes or fetch()es it from the customer's own container URL.

There is no cross-tenant query to get wrong, because there's no cross-tenant database. Customer 4411's analytics script can only see customer 4411's file. A heavy customer's aggregation runs on their container, not in a shared query pool.

Six hundred containers, six hundred copies of one script, idle ones sharing blocks on a flat-rate box. The 601st customer costs a container clone and nothing else.

Embedded analytics used to be a pricing tier. Now it's a file in every container.