collections property in your FrogBot Config:
Organize collection files
Give each collection its own TitleCase file with a named export, such asexport const Posts in src/collections/Posts.ts, and import it into your config by its own path. Adding a collection means creating its file and adding it to collections; there is no index.ts to update.
When a collection gains hooks, access rules, or endpoints, turn its file into a folder with the same name:
Users.ts to Users/index.ts, then put its helpers in subfolders beside it. import { Users } from './collections/Users' resolves to either form, so the config doesn’t change.
Move the file rather than copying it. If Users.ts and Users/index.ts both exist, ./collections/Users resolves to Users.ts and the folder is ignored.
Match the casing of each import to its file name. ./collections/users finds Users.ts on macOS but fails with “Cannot find module” on Linux, for example in Docker or a deployment.
FrogBot collection model
Collections you configure remain ordinary FrogBot collections. Agents need chat and message stores, and pieces that create files need a files collection. You can adopt those roles into collections you own; FrogBot adds a files collection only when you mark one withfile: true.
Role markers
FrogBot identifies managed collections by role, not by a required slug. Mark a collection withchat: true, message: true, or file: true; FrogBot keeps its slug and merges in the required configuration.
chats and messages. An unmarked collection already using either default slug causes a configuration error rather than implicit adoption.
Field contribution per role
Your compatible field, access, admin, and option values win during the merge. Missing base fields are appended and hooks are combined.
FrogBot rejects incompatible base field types.
chats.user and messages.id, messages.chat, and messages.parts are reserved and cannot be redefined.
Default collections
The default collections use soft deletion, appear under Collections in the admin panel, and scope access to the authenticated chat owner. The message ID is the AI SDK UI message ID, allowing an interrupted assistant message to be continued in place across database adapters. The chat’suser relationship resolves as follows:
- No auth collection: FrogBot’s default
userscollection. - One auth collection: that collection, regardless of slug.
- Multiple auth collections: the collection selected by
admin.user.
Collection config options
The following options are available on anyCollectionConfig. FrogBot adds chat, message, and file to the built-in set; every other option below is part of the FrogBot configuration API. Configure connections in the root config.
It’s best practice to write Collections in separate files and import them into the root config.
Here is a minimal example:
Fields
Fields define the schema of the Documents within a Collection.Access Control
Collection Access Control determines what a user can and cannot do with any given Document within a Collection. To learn more, go to the Access Control documentation.Hooks
Collection Hooks allow you to tie into the lifecycle of your Documents so you can execute your own logic during specific events. To learn more, go to the Hooks documentation.Orderable
Whenorderable is enabled, FrogBot uses fractional indexing to efficiently manage document order. When enabled on collections, this allows you to manually drag and drop documents in the Admin Panel to reorder them, as well as programmatically set the order of documents via the Local API, REST API, or GraphQL API.
Orderable can also be added to join fields.
Admin Options
The behavior of Collections within the Admin Panel can be customized to fit the needs of your application. This includes grouping or hiding their navigation links, adding custom components, selecting which fields to display in the List View, and more. To configure Admin Options for Collections, use theadmin property in your Collection Config:
Collection Views
admin.views accepts CollectionView[]. CollectionView is the exported union ListView | BoardView | CalendarView | CustomView.
The array order controls the switcher and first-view fallback. A collection can have at most one list view, and it must be first. Omit views to use one default list view without a switcher.
Shared view properties
ViewPagination
ViewComponents
These shell slots are shared by list, board, calendar, and custom views. Each value uses aFrogBotComponent import path; array slots render in declaration order.
ListView
ListView components
BoardView
Board components
See Collection board for grouping, loading, and drag behavior.
CalendarView
Calendar components
See Collection calendar for modes, date fields, loading, and editing behavior.
CustomView
Custom Components
Collections can set Custom Components for their List and Edit Views. To override Collection Components, use theadmin.components property in your Collection Config:
List slots belong to a
type: 'list' entry in admin.views: use components.beforeView, toolbar, beforeTable, afterTable, afterView, and NoResults. To replace the collection list, use a type: 'custom' entry with component. See List View.
Edit View Options
Configure these slots underadmin.components.edit. See Edit View for working component examples.
Document Views
Useadmin.components.edit.views to replace a built-in document view or add a custom route or tab. See Document Views for configuration and examples.
root is mutually exclusive with every built-in and custom nested document view. When root is configured, it must be the only key in views.
Built-in and root view config
Custom view config
Document view configs do not support
exact; custom path values use document-view routing.
Document tab config
Pagination
All Collections receive their own List View which displays a paginated list of documents that can be sorted and filtered. The pagination behavior of the List View can be customized on a per-Collection basis, and uses the same Pagination API that FrogBot provides. To configure pagination options, usepagination on a list entry in admin.views:
List Searchable Fields
In the List View, there is a “search” box that allows you to quickly find a document through a simple text search. Normal search behavior includes the ID and, when defined,admin.useAsTitle. searchableFields adds fields to that behavior rather than replacing the title field.
To define which fields should be searched, use searchableFields on a list entry in admin.views:
List View Select API
The List View uses the Select API to query only the active columns, not whole documents. This keeps large collections fast, but a hook that relies on another field only gets it while that field’s column is shown:title present, return it from a select function on your Collection Config:
Format Document URLs
TheformatDocURL function allows you to customize how document links are generated in the List View. This is useful for disabling links for certain documents, redirecting to custom destinations, or modifying URLs based on user context or document state.
To define a custom document URL formatter, use the admin.formatDocURL property in your Collection Config:
formatDocURL function receives the following arguments:
The function should return:
nullto disable the link entirely (no link will be rendered)- A
stringcontaining the custom URL to use for the link - The
defaultURLparameter to use FrogBot’s default linking behavior
Examples
Disable linking for certain users:GraphQL
You can completely disable GraphQL for this collection by passinggraphQL: false to your collection config. This will completely disable all queries, mutations, and types from appearing in your GraphQL schema.
You can also pass an object to the collection’s graphQL property, which allows you to define the following properties:
TypeScript
You can import types from FrogBot to help make writing your Collection configs easier and type-safe. There are two main types that represent the Collection Config,CollectionConfig and SanitizedCollectionConfig.
The CollectionConfig type represents a raw Collection Config in its full form, where only the bare minimum properties are marked as required. The SanitizedCollectionConfig type represents a Collection Config after it has been fully sanitized. Generally, this is only used internally by FrogBot.