Currently apps are expected to construct an adapter and call Stack.create(adapter) directly:
const adapter = await SQLiteAdapter.initialize({ path, entityId, timezone });
const stack = await Stack.create(adapter);
This leaks infrastructure concerns into app code. An app shouldn't need to know whether the underlying storage is local SQLite, a JSON folder, or a remote server — that decision belongs to the stack's owner, not the app consuming it.
Proposed model: the stack owner is responsible for initializing and configuring the stack (choosing the adapter, setting the entity ID and timezone). Apps receive a Stack instance they didn't create and interact with it purely through the record/type/query API. Whether the stack is local or remote should be opaque to the app — it can inspect stack.capabilities if it needs to know what the backend supports, but it shouldn't have to construct it.
This likely means:
- A separate "admin" or "owner" API for stack initialization (could be a static method, a factory, or a separate class)
- Apps access stacks via a stable reference (file path, URL, handle) rather than constructing adapters themselves
- The
adapter-api (remote) adapter becomes fully transparent to apps — an app written for local SQLite should work unmodified against a remote stack
This is a design question as much as an implementation one — needs a concrete API proposal before any code changes.
Currently apps are expected to construct an adapter and call
Stack.create(adapter)directly:This leaks infrastructure concerns into app code. An app shouldn't need to know whether the underlying storage is local SQLite, a JSON folder, or a remote server — that decision belongs to the stack's owner, not the app consuming it.
Proposed model: the stack owner is responsible for initializing and configuring the stack (choosing the adapter, setting the entity ID and timezone). Apps receive a
Stackinstance they didn't create and interact with it purely through the record/type/query API. Whether the stack is local or remote should be opaque to the app — it can inspectstack.capabilitiesif it needs to know what the backend supports, but it shouldn't have to construct it.This likely means:
adapter-api(remote) adapter becomes fully transparent to apps — an app written for local SQLite should work unmodified against a remote stackThis is a design question as much as an implementation one — needs a concrete API proposal before any code changes.