zitejs
v0.9.92
Published
The Zite framework — build apps on Zite Database
Downloads
11,052
Readme
zitejs
The Zite framework package. Provides typed access to your Zite Database, API endpoints, authentication, and more.
Usage
// Database client (generated per-project by `zite sync`)
import { zite } from 'zitejs/db';
const contacts = await zite.contacts.findAll();
// Query and update Zite auth users from backend endpoints
const { records: users } = await zite.auth.findAllUsers({
appIds: ['app-1'],
filters: { email: '[email protected]' },
});
await zite.auth.updateUserProfile(users[0].id, {
firstName: 'New name',
});
// Auth users can also be queried with read-only SQL
const result = await zite.sql({
query: 'SELECT "id", "email" FROM "ziteUsers"',
});
// Define API endpoints
import { createEndpoint, ZiteError } from 'zitejs/api';
export default createEndpoint({
execute: async ({ input }) => { ... },
});
// Authentication
import { useAuth } from 'zitejs/auth';
const { user } = useAuth();
// File uploads
import { useUpload } from 'zitejs/upload';
// PDF generation
import { ZitePdf } from 'zitejs/pdf';
// Scheduled tasks
import { ZiteSchedule } from 'zitejs/schedules';