> For the complete documentation index, see [llms.txt](https://jacksonkasi.gitbook.io/tablecraft/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jacksonkasi.gitbook.io/tablecraft/getting-started/readme.md).

# Introduction

<figure><img src="https://1282458048-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FuebxGRxgggfGsASgp3gt%2Fuploads%2Fgit-blob-69b6dcc41558eecf9c234be13c7cce81cbccc30a%2Fog-image.png?alt=media" alt=""><figcaption></figcaption></figure>

Welcome to the TableCraft Engine documentation! This engine simplifies database interactions by allowing you to define table configurations and automatically generate powerful APIs with filtering, sorting, pagination, and more.

## Getting Started

Start with the basics to understand how to define tables and fetch data.

{% columns %}
{% column %}
**Basics**

1. [**Basics**](/tablecraft/basics/1-basics.md)
   * Defining your first table.
   * Standard query parameters (sort, filter, paginate).
   * Basic API setup.
2. [**Relationships & Joins**](/tablecraft/basics/2-relationships.md)
   * Connecting tables (e.g., Users → Orders).
   * Fetching related data.
   * Filtering across relationships.
3. [**Advanced Configuration**](/tablecraft/basics/3-advanced.md)
   * Computed columns (SQL expressions).
   * Custom search logic.
   * Transforms (formatting data).
     {% endcolumn %}

{% column %}
**Core Concepts**

4. [**Security & Access Control**](/tablecraft/core-concepts/4-security.md)
   * Handling sensitive data.
   * Tenant isolation.
   * Soft deletes.
5. [**Extending & Raw SQL**](/tablecraft/core-concepts/5-extending.md)
   * When the engine isn't enough.
   * Writing raw Drizzle queries.
   * Using `manualResult`.
6. [**Error Handling**](/tablecraft/core-concepts/6-errors.md)
   * Input validation.
   * Typed error class.
     {% endcolumn %}
     {% endcolumns %}

## Features

{% tabs %}
{% tab title="Date Filtering" %}
Automatic date range filtering with smart detection:

* Auto-detects date columns from schema
* Prefers `createdAt` as default filter column
* Full calendar date picker in frontend
* Quick presets (Today, This Week, This Month, etc.)

[Learn more about Date Filtering →](/tablecraft/features/date-filtering.md)
{% endtab %}

{% tab title="Type Generation" %}
Generate TypeScript types from your API:

* Full type safety for frontend code
* Autocomplete for columns and filters
* Typed adapter factory functions
* CI/CD integration ready

```bash
npx @tablecraft/codegen --url http://localhost:3000/api/engine --out ./src/generated
```

[Learn more about Type Generation →](/tablecraft/features/codegen.md)
{% endtab %}
{% endtabs %}

## API Reference

<table data-view="cards"><thead><tr><th>Topic</th><th>Description</th><th data-card-target data-type="content-ref">Link</th></tr></thead><tbody><tr><td>Metadata API</td><td>Auto-generated frontend schema endpoint.</td><td><a href="/tablecraft/api-reference/metadata-api.md">Metadata API</a></td></tr><tr><td>OpenAPI Spec</td><td>Auto-generate Swagger/OpenAPI 3.0 specs.</td><td><a href="/tablecraft/api-reference/openapi.md">OpenAPI</a></td></tr><tr><td>Type Safety</td><td>Helpers for SQL type safety.</td><td><a href="/tablecraft/guides/type-safety.md">Type Safety</a></td></tr><tr><td>Examples</td><td>Real-world usage patterns.</td><td><a href="/tablecraft/guides/examples.md">Examples</a></td></tr></tbody></table>

## Packages

| Package                         | Description                     |
| ------------------------------- | ------------------------------- |
| `@tablecraft/engine`            | Core engine with query building |
| `@tablecraft/table`             | React DataTable component       |
| `@tablecraft/client`            | Frontend SDK                    |
| `@tablecraft/codegen`           | TypeScript type generator       |
| `@tablecraft/adapter-hono`      | Hono.js adapter                 |
| `@tablecraft/adapter-express`   | Express adapter                 |
| `@tablecraft/adapter-next`      | Next.js adapter                 |
| `@tablecraft/adapter-sveltekit` | SvelteKit adapter               |
| `@tablecraft/adapter-elysia`    | Elysia (Bun) adapter            |
| `@tablecraft/plugin-cache`      | Caching plugin                  |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://jacksonkasi.gitbook.io/tablecraft/getting-started/readme.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
