Skip to main content

Document Storage


Your Convex deployment contains tables that hold your app's data. Initially, your deployment contains no tables or documents.

Each table springs into existence as soon as you add the first document to it.

// `friends` table doesn't exist.
db.insert("friends", { name: "Jamie" });
// Now it does, and it has one document.

There is no need to specific any schemas up front, or to create any tables explicitly. Convex will happily store whatever you'd like.


Convex also has schema support! Adding a schema will improve your TypeScript type-safety.

Tables contain documents

Convex documents are very similar to JavaScript objects. They have fields and values, and you can nest arrays or objects within them.

These are all valid convex documents:

{"name": "Jamie"}
{"name": {"first": "Barack", "second": "Obama"}, "age": 60}

They can also contain references to other documents in other tables. See Types to learn more about the types supported in Convex and Data Modeling to learn about how to use those types to model your data.