Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
zite
✓ import { zite } from 'zitejs/db'
✗ import { zite } from 'zitejs'
The main client is exported from 'zitejs/db', not the root package.
createEndpoint
✓ import { createEndpoint } from 'zitejs/api'
✗ import createEndpoint from 'zitejs/api'
createEndpoint is a named export from 'zitejs/api'. Default import will fail.
useAuth
✓ import { useAuth } from 'zitejs/auth'
✗ import useAuth from 'zitejs/auth'
useAuth is a named export. Requires React context provider.
useUpload
✓ import { useUpload } from 'zitejs/upload'
✗ import { useUpload } from 'zitejs'
useUpload is exported from 'zitejs/upload', not root package.
ZitePdf
✓ import { ZitePdf } from 'zitejs/pdf'
✗ import ZitePdf from 'zitejs/pdf'
ZitePdf is a named class export.
ZiteSchedule
✓ import { ZiteSchedule } from 'zitejs/schedules'
✗ import { ZiteSchedule } from 'zitejs/schedule'
The module is 'schedules' (plural). Typo leads to module not found.
Shows usage of database client, API endpoint creation, and auth hook with ZiteJS.
// Setup: run `zite sync` to generate db client
import { zite } from 'zitejs/db';
import { createEndpoint } from 'zitejs/api';
import { useAuth } from 'zitejs/auth';
// Example: fetch all users
const users = await zite.users.findMany();
// Example: endpoint
export default createEndpoint({
execute: async ({ input }) => {
const users = await zite.users.findMany({ where: { role: input.role } });
return { data: users };
}
});
// Example: auth hook
function Profile() {
const { user } = useAuth();
return <div>Hello {user?.name}</div>;
}
Errors
Common errors & fixes
Cannot find module 'zitejs' or its corresponding type declarations.
Importing from root 'zitejs' instead of a subpath like 'zitejs/db'.
fixChange import to import { zite } from 'zitejs/db'. Uncaught TypeError: Cannot destructure property 'user' of 'useAuth(...)' as it is undefined.
Missing AuthProvider or using useAuth outside React component tree.
fixEnsure AuthProvider wraps the component and useAuth is called inside a component.
Cannot find module 'zitejs/schedule' or its corresponding type declarations.
Typo: module is 'schedules' (plural).
fixImport from 'zitejs/schedules'.
Module '"zitejs/api"' has no exported member 'createEndpoint'. Did you mean to use default import?
Using default import instead of named import for createEndpoint.
fixUse named import: import { createEndpoint } from 'zitejs/api'. Audit
Dependencies
@tanstack/react-queryoptionalRequired for data synchronization and query management in React applications.
reactoptionalRequired for hooks like useAuth and useUpload.