> 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="/files/8f2feyLS6ySe2JFqrqPo" 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="/pages/VCj1z4V5JzvqM0rifvCZ">/pages/VCj1z4V5JzvqM0rifvCZ</a></td></tr><tr><td>OpenAPI Spec</td><td>Auto-generate Swagger/OpenAPI 3.0 specs.</td><td><a href="/pages/ocr5wdLIi4nt3hSkbXkU">/pages/ocr5wdLIi4nt3hSkbXkU</a></td></tr><tr><td>Type Safety</td><td>Helpers for SQL type safety.</td><td><a href="/pages/5l2gSJdM8xiGf7dlipLK">/pages/5l2gSJdM8xiGf7dlipLK</a></td></tr><tr><td>Examples</td><td>Real-world usage patterns.</td><td><a href="/pages/YDE5J8CzW3qkyRVz8GE6">/pages/YDE5J8CzW3qkyRVz8GE6</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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
