Form.io requires MongoDB or a compatible equivalent. This is not a preference or a default that you can swap out during installation. The entire data layer assumes the MongoDB document model, query language, and indexing capabilities. Attempting to substitute PostgreSQL, MySQL, or another database will break core functionality in ways that cannot be patched around.
This document explains why the dependency exists, what specifically breaks if you try to work around it, and how to plan your infrastructure accordingly.
The Architectural Dependency
Form.io stores two primary document types: form schemas and submissions. Both are JSON documents with nested structures, variable fields, and arrays of arbitrary depth. MongoDB stores JSON natively. Relational databases do not.
A typical form schema contains a recursive components array where each component can contain child components. A Data Grid component might contain five child fields. An Edit Grid inside a Panel inside a Wizard step creates four levels of nesting. The schema must preserve this structure exactly because the Form.io renderer reads it directly to display forms.
{
"components": [
{
"type": "panel",
"key": "employeeInfo",
"components": [
{
"type": "editgrid",
"key": "workHistory",
"components": [
{"type": "textfield", "key": "company"},
{"type": "textfield", "key": "title"},
{"type": "datetime", "key": "startDate"},
{"type": "datetime", "key": "endDate"}
]
}
]
}
]
}
MongoDB stores this document as-is. A relational database would require either a recursive table structure with joins to reconstruct the hierarchy, or a JSON column that cannot be indexed or queried efficiently. Neither approach matches how Form.io reads and writes schema data.
Submissions follow the same pattern. The data object inside each submission mirrors the form structure, including nested arrays from Data Grids and Edit Grids. MongoDB’s query language can filter, sort, and aggregate across these nested structures. SQL cannot do this without significant preprocessing or denormalization.
What Breaks With Relational Databases
If you attempt to replace MongoDB with a relational database, the following capabilities fail.
Schema storage and retrieval. Form.io reads the entire form schema as a single document and passes it to the renderer. The renderer expects the exact JSON structure stored in MongoDB. A relational reconstruction would need to join multiple tables and reassemble the component hierarchy in the correct order. The Form.io server does not contain this logic because it was never designed to work that way.
Submission queries with nested filters. The Form.io API accepts MongoDB query syntax for filtering submissions. A request like ?data.workHistory.company=Acme filters on a nested array field. This query syntax is passed directly to MongoDB. Relational databases use SQL, which has no equivalent single-query pattern for filtering inside JSON arrays without database-specific extensions.
Aggregation pipelines for reporting. The Data Reporting feature uses MongoDB aggregation pipelines to compute statistics, group submissions, and join data across forms. These pipelines operate on the document structure as stored. There is no abstraction layer that translates aggregation pipelines to SQL.
Indexing on dynamic fields. Form schemas vary between projects. One form might have fields named firstName and lastName; another might have patientId and encounterDate. MongoDB allows you to create indexes on data.firstName or data.patientId directly. Relational databases cannot index inside JSON columns in the same way, and creating tables with columns matching every possible form field defeats the purpose of a flexible form builder.
Atomic document updates. When a submission updates, Form.io writes the entire data object in a single operation. MongoDB handles this atomically. Relational storage would require updating multiple rows across multiple tables within a transaction, adding complexity and failure modes that the Form.io server does not manage.
Why Not PostgreSQL JSONB?
PostgreSQL’s JSONB column type stores JSON documents and supports some querying. Developers familiar with PostgreSQL often ask why Form.io cannot use JSONB instead of MongoDB.
The short answer: JSONB solves storage but not querying, indexing, or the aggregation pipeline.
JSONB stores JSON as a binary format and allows basic operators like -> and ->> to extract fields. You can write queries like:
SELECT * FROM submissions WHERE data->>'firstName' = 'Sarah';
This works for simple top-level fields. It does not work well for the following scenarios that Form.io requires.
Nested array queries. Finding submissions where any element in a nested array matches a condition requires jsonb_array_elements and subqueries. The syntax is verbose and performance degrades on large datasets without specialized indexes.
Dynamic indexing. Creating a GIN index on a JSONB column indexes the entire document, not specific paths. Path-specific indexes require knowing the paths in advance. Form.io forms have arbitrary field structures defined by users, not by application code.
Aggregation. PostgreSQL has no equivalent to MongoDB’s aggregation pipeline. Computing grouped statistics across nested submission data requires extracting data into temporary structures, running standard SQL aggregations, and reassembling results. Form.io’s reporting features assume pipeline operations are available.
Query language compatibility. The Form.io API accepts MongoDB query objects. Translating these to PostgreSQL JSONB queries would require a query compiler that handles every MongoDB operator. This compiler does not exist in Form.io because the architecture assumes MongoDB.
Why Not Firestore or DynamoDB?
Cloud-native document databases like Firestore and DynamoDB store JSON-like documents but lack features Form.io depends on.
Firestore uses a hierarchical data model with collections and subcollections. It does not support the query flexibility MongoDB provides. You cannot query across subcollections, filter on arbitrary nested fields, or run aggregation pipelines. Firestore also limits document size to 1MB, which large form schemas can exceed when forms contain many components with extensive configuration.
DynamoDB is a key-value store with document support. Queries require defining indexes in advance for every access pattern. Form.io’s dynamic query API, where users filter on any field in their submission data, would require indexes on every possible field combination. DynamoDB’s pricing model also charges per read/write operation, which becomes expensive for applications with high submission volumes and frequent queries.
Both databases are designed for specific access patterns defined at application design time. Form.io is a platform where users define their own data structures through form building. The database must support queries on structures that did not exist when the application was deployed. MongoDB does this. Firestore and DynamoDB do not.
What You Can Do With Relational Databases
MongoDB is required for Form.io’s core operation, but that does not prevent you from using relational databases elsewhere in your architecture.
Synchronize submissions to SQL. The webhook action sends submission data to external endpoints in real-time. You can build a small service that receives webhooks and inserts data into PostgreSQL, MySQL, or any other database. The relational database integration guide documents this pattern.
Export and transform. The Export Form Data feature produces JSON and CSV files. You can schedule exports, transform the data, and load it into a data warehouse. This is a batch approach rather than real-time, but it gives you submission data in whatever format your analytics stack requires.
Query MongoDB alongside SQL. Many deployments run MongoDB for Form.io and PostgreSQL or MySQL for application data. Your application code queries both databases as needed. This adds operational complexity but lets you use the right database for each workload.
The pattern to avoid is attempting to make Form.io itself run against a non-MongoDB database. That path leads to forking the codebase, rewriting the data layer, and maintaining a divergent version that cannot receive upstream updates.
Infrastructure Planning
If you are evaluating Form.io, plan for MongoDB from the start. Self-hosted deployments require you to provision and manage MongoDB infrastructure.
MongoDB Atlas is the managed cloud option. Atlas handles replication, backups, scaling, and maintenance. You connect Form.io to an Atlas cluster using a connection string. This is the lowest operational burden for teams without MongoDB expertise.
Self-managed MongoDB gives you full control over the database server. You handle installation, configuration, replication, and backups. This fits organizations with existing MongoDB operations teams or strict requirements about where data resides.
Replica sets are required for production deployments. Form.io uses MongoDB transactions in some operations, and transactions require a replica set. A single MongoDB instance works for development but will fail in production scenarios that trigger transaction logic.
For capacity planning, form schemas are small (typically under 100KB each). Submissions vary based on form complexity and file attachment references. A form with 50 fields capturing text data produces submissions around 5-10KB. Plan storage based on submission volume and retention requirements.
The Form.io server repository documents MongoDB version requirements and connection configuration. Current deployments should use MongoDB 5.0 or later to ensure compatibility with all Form.io features.
When MongoDB Is a Blocker
Some organizations have policies that prohibit MongoDB. Common reasons include standardization on a single database platform, lack of MongoDB operational expertise, or compliance frameworks that have not been evaluated for MongoDB deployments.
If you cannot run MongoDB or a compatible equivalent, Form.io is not the right choice for your project. This is a hard constraint, not a soft preference. Attempting to work around it will consume engineering time without producing a stable result.
Alternatives to evaluate in this situation:
You do not have to store data in Form.io. Form.io can be used to store your form definitions, but you can use your own submission API to store the data elsewhere.
Form builders that store data in relational databases exist, though they typically sacrifice the schema flexibility and API-first architecture that Form.io provides. You trade the MongoDB requirement for other constraints.
Building a custom form solution on your preferred database is possible if your requirements are narrow. Form.io solves a broad set of problems around form rendering, validation, submission handling, multi-tenancy, and access control. Replicating all of this is substantial work.
Using Form.io in a sandboxed environment with data synchronization to your primary database is a middle path. Form.io runs with MongoDB in its own infrastructure boundary. Webhooks or scheduled exports move submission data into your SQL database for integration with other systems. This adds architectural complexity but can satisfy both Form.io’s requirements and organizational database standards.
Related Resources
- Form Schemas vs Submissions explains the two document types Form.io stores
- Self-Hosted covers deployment options
- Data Reporting documents MongoDB aggregation pipeline access
- Export Form Data explains extraction to JSON and CSV
- Relational Database Integration guides SQL synchronization
- Form.io Server Repository contains configuration documentation
- API Documentation details query syntax for submissions

