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

# Getting started

## Installation

```bash
npm install @rjdellecese/confect
```

```bash
yarn add @rjdellecese/confect
```

```bash
pnpm add @rjdellecese/confect
```

### `exactOptionalPropertyTypes`

Normally when using the Effect schema library,  it's recommended to set `exactOptionalPropertyTypes` in your `tsconfig.json` to `true`. However, this configuration is not supported by `convex-js` at the moment, so to use Confect, you must set it to `false` instead.

To understand the implications of this, see [this explanation](https://effect.website/docs/guides/schema/introduction#understanding-exactoptionalpropertytypes) in the Effect docs.

## Usage

### 1. Define your database schema

{% hint style="info" %}
Not every Effect `Schema` is valid for use in Confect. See [Schema restrictions](/confect/schema-restrictions.md) for more information about what's permitted and what's not.
{% endhint %}

{% @github-files/github-code-block url="<https://github.com/rjdellecese/confect/blob/main/example/convex/schema.ts>" fullWidth="false" %}

### 2. Generate your Convex function constructors and types.

{% @github-files/github-code-block url="<https://github.com/rjdellecese/confect/blob/main/example/convex/confect.ts>" fullWidth="false" %}

### 3. Write some Convex functions!

{% @github-files/github-code-block url="<https://github.com/rjdellecese/confect/blob/main/example/convex/functions.ts>" fullWidth="false" %}

## Example project

The above files are pulled from a real example project. Check it out [here](https://github.com/rjdellecese/confect/tree/main/example).


---

# 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:

```
GET https://rjdellecese.gitbook.io/confect/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
