Skip to content

Commit d42939b

Browse files
Merge pull request #399 from geturbackend/mintlify/00903861
Update from code changes: document AI Collection Creator
2 parents d290968 + 6ae0fbd commit d42939b

3 files changed

Lines changed: 115 additions & 1 deletion

File tree

‎mintlify/docs/concepts/collections-schemas.mdx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ A collection is a named container for JSON documents — conceptually equivalent
1313

1414
**Collections must be created in the dashboard before you can write to them.** The API will reject requests to endpoints that do not correspond to a registered collection. Creating a collection registers it under your project and connects it to your MongoDB database.
1515

16+
<Tip>
17+
Prefer designing a whole set of collections at once from a natural-language description? Use the [AI Collection Creator](/guides/ai-collection-creator) as an alternative to the manual field builder.
18+
</Tip>
19+
1620
<Warning>
1721
The `users` collection is reserved. All user account operations go through `/api/userAuth/*`. Requests to `/api/data/users` or any path starting with `/api/data/users` are blocked with a `403` response.
1822
</Warning>

‎mintlify/docs/docs.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@
5555
"guides/storage",
5656
"guides/webhooks",
5757
"guides/audit-log",
58-
"guides/ai-byok"
58+
"guides/ai-byok",
59+
"guides/ai-collection-creator"
5960
]
6061
},
6162
{
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
---
2+
title: "AI Collection Creator"
3+
description: "Design and create multiple MongoDB collections at once by chatting with an AI agent inside the urBackend dashboard."
4+
---
5+
6+
The AI Collection Creator is an in-dashboard agent that turns a natural-language description of your app into a set of production-ready MongoDB collections. You describe what you're building, iterate on the schema through chat, review the design on an interactive canvas, and create every collection in your project with a single click.
7+
8+
Use it when you want to bootstrap a new project's data model quickly instead of clicking through the manual field builder one collection at a time.
9+
10+
## When to use it
11+
12+
- **New project bootstrap** — turn a product idea ("multi-tenant SaaS with workspaces, projects, and tasks") into 5–15 collections without hand-designing each one.
13+
- **Exploring a schema shape** — iterate on relationships and field types in chat before committing anything to the database.
14+
- **Reference designs** — ask for well-known patterns (e-commerce, CMS, subscription billing) as a starting point you can then edit manually.
15+
16+
If you already know the exact shape of a single collection, the manual builder is faster. See [Collections & Schemas](/concepts/collections-schemas) for the manual flow and field-type rules.
17+
18+
## Open the AI Collection Creator
19+
20+
1. In the dashboard, open your project.
21+
2. Go to **Database** and click **Create Collection**.
22+
3. At the top of the create-collection page, switch the mode selector from **Manual Builder** to **AI-Assisted**.
23+
24+
The page splits into two panels:
25+
26+
- **Left — AI Schema Assistant.** A chat with the agent, plus a model selector and quick-start prompts.
27+
- **Right — Schema Canvas.** An interactive visualizer that renders the proposed schema as connected cards, one per collection. Fields, types, required/unique flags, and `Ref` relationships are drawn as edges between cards.
28+
29+
## Chat with the agent
30+
31+
Type a description of your app into the composer and press **Enter** (or **Shift+Enter** for a newline). The agent responds with either:
32+
33+
- A clarifying question, if it needs more detail before designing a schema.
34+
- A proposed set of collections, which appear as cards on the Schema Canvas on the right.
35+
36+
You can keep chatting to refine the design — add fields, split a collection, change a type, add references, remove something you don't need. Each turn updates the Schema Canvas in place.
37+
38+
### Quick-start prompts
39+
40+
When the chat is empty, the assistant offers a few one-click prompts you can send as-is or edit. They currently cover:
41+
42+
- **E-commerce Platform** — products, categories, orders, customers, product reviews.
43+
- **Project Management SaaS** — workspaces, projects, tasks, milestones, team members.
44+
- **Subscription Billing API** — plans, subscriptions, invoices, payment methods, usage logs.
45+
- **Content Management (CMS)** — articles, authors, categories, media assets, publishing revisions.
46+
47+
Use these as starting points, then iterate in chat.
48+
49+
### Model selector
50+
51+
A dropdown at the top of the chat panel lets you pick the model used for the next turn. The default (`qwen/qwen3.6-27b`) and `openai/gpt-oss-120b` currently produce the best schema designs; smaller models are faster but may return simpler results.
52+
53+
Individual messages are limited to 2,000 characters. Longer inputs return a `400` error asking you to shorten the message.
54+
55+
## Review the schema on the Schema Canvas
56+
57+
Every proposed collection is rendered as a card on the canvas on the right:
58+
59+
- Each row is one field with its type.
60+
- **Required** and **unique** flags are marked on the field.
61+
- `Ref` fields draw an edge to the referenced collection so you can see relationships at a glance.
62+
- `Object` and `Array` fields show their nested shape.
63+
64+
You can pan and zoom the canvas to inspect large designs. The canvas updates whenever the agent returns a new schema in chat.
65+
66+
## Create the collections
67+
68+
When you're happy with the design, click **Insert All** above the Schema Canvas. urBackend asks you to confirm, then creates every collection in the design in a single bulk operation. When the call finishes:
69+
70+
- Each collection is either marked as created or listed with the reason it failed (for example, a name that already exists in the project).
71+
- A toast summarizes how many collections were created and how many failed.
72+
- The chat session is cleared so you can start a fresh design.
73+
74+
### Bulk creation limits
75+
76+
The bulk-create endpoint enforces the following:
77+
78+
- Maximum **20 collections per Insert All call**. Designs larger than 20 collections must be split across multiple sessions.
79+
- Your project's overall collection limit (from your plan) still applies. If Insert All would exceed it, the excess collections fail with `Collection limit reached`.
80+
- Duplicate names against collections that already exist in the project fail with `Collection already exists`. Other collections in the same batch still succeed.
81+
82+
### The `users` collection is reserved
83+
84+
The AI Collection Creator never creates a collection named `users`. It's stripped from the AI response before the schema reaches the canvas, and the bulk-create endpoint additionally rejects any collection named `users` with a `403`.
85+
86+
The `users` collection has a fixed schema contract used by the auth system. Create it manually from the **Manual Builder** tab, where the dashboard pre-fills the required `email` and `password` fields. See [Collections & Schemas — The users collection](/concepts/collections-schemas#the-users-collection) and the [Authentication guide](/guides/authentication).
87+
88+
## Session iteration limits
89+
90+
A single AI Collection Creator session is capped at **20 iterations** (user + assistant turn pairs) when using the urBackend platform key. When you approach the limit, the composer shows a counter (`N of 20 AI turns used`). When you hit it, the composer is disabled and the next request returns:
91+
92+
```
93+
403 Forbidden
94+
Session iteration limit reached (20/20). Add your Groq API key in Settings for unlimited usage.
95+
```
96+
97+
Chat transcripts are cached for 2 hours. Clicking **Reset chat** in the canvas panel clears the transcript, resets the iteration counter, and starts a fresh session.
98+
99+
### BYOK bypasses the iteration cap
100+
101+
If you've configured a personal Groq API key at the developer or project level, the iteration cap **does not apply** — you can iterate as many turns as you like in a single session, subject only to Groq's own rate limits and billing on your key.
102+
103+
BYOK also removes the platform-key monthly AI session cap that applies to other AI features. See [BYOK for AI](/guides/ai-byok) for how to configure a key.
104+
105+
## Related
106+
107+
- [Collections & Schemas](/concepts/collections-schemas) — field types, constraints, and the manual builder.
108+
- [BYOK for AI](/guides/ai-byok) — bring your own Groq key to bypass iteration and session caps.
109+
- [Authentication](/guides/authentication) — how the reserved `users` collection is used.

0 commit comments

Comments
 (0)