@ftisindia/frontend-core
v0.2.0
Published
Framework-agnostic frontend auth, organisation context, RBAC, and API plumbing for the FTIS backend starter.
Readme
@ftisindia/frontend-core
Headless TypeScript runtime for the FTIS backend starter.
It provides token-aware API requests, auth, active organisation context, RBAC hydration, and generated contract types.
import { createFrontendCore } from '@ftisindia/frontend-core';
const core = createFrontendCore({
apiUrl: '/api',
fetch: globalThis.fetch.bind(globalThis),
});
await core.auth.login({ email, password });
await core.org.load();
await core.rbac.ensureHydrated(core.org.activeOrgId()!);
if (core.rbac.can('settings.read')) {
const settings = await core.api
.org(core.org.activeOrgId()!)
.get('/organisations/{orgId}/settings');
}The generated PermissionKey union is exported from the package root and @ftisindia/frontend-core/generated.
