About schemas Last updated: 26. May 2026
All Docly documents refer a document schema. The schema defines the structure and editor for a document. There are builtin schemas and you can create custom schemas.
Schemas in a document database
In Docly (a NoSQL database) you create document schemas that provide the fields and structure of your different type of documents. It is similar to defining what columns and column types you have in a table in a SQL relational database. But it is not as strict and it allows a structure of data and not only a table. Also if you change a schema the existing documents are not automatically changed.
The editor to add and edit documents are also generated from the document schema in Docly. So you easily can provide possibility to add and edit data to your users. You can also code this yourself if you prefer that to the built-in features.
Document schemas can have a structure and contain arrays of data and structures recursively which makes it possible and easy to keep much larger and more complex data structures within one document than you would in one SQL database row.
When to create a new schema
Before designing a new schema, decide whether you actually need one. Custom schemas are powerful, but every additional schema adds maintenance — fields to keep in sync, editors to test, templates to update. The criteria below help separate cases where a new schema earns its keep from cases where an existing one will serve you better.
Create a new schema when:
Your documents have a distinct field structure that no existing schema captures
You need a dedicated editing UI for a specific content type
You want your own display template that renders these documents differently from anything builtin
You are building a reusable package that ships schema + template together
Reuse an existing schema when:
The content fits naturally into a builtin schema —
Documentation.5for help pages,KB articlefor knowledge-base entries,Docly functionfor function referencesYou only need a new display template — schemas can be shared across folders, and templates are scoped per folder
You are adding metadata fields to an existing content type — consider extending the existing schema rather than forking a new one
For the practical how-to, see Create schemas for step-by-step instructions and Example schemas for working starting points you can adapt.
Creating custom schemas
Users with granted developer access can create their own document schemas in Docly.
A schema consists of the following components:
HTML form - the form fields and structure
JavaScript - validation, user feedback and other logic
CSS - you can style your form either with inline styles or provide CSS separately
Templates - HTML, XLSX or DOCX documents that merge data from your documents into a visual representation (HTML, PDF, DOCX, XLSX or any other text format)
You can either code the entire HTML form by hand or use the Docly Schema designer, which allows you to drag and drop components and fields into your document schema.
Document schemas and data their documents store can be used to generate output files or web content, databases or configuration.
Folder and Document schemas
Choose "Use this schema for" Documents or Folders to specify whether this schema applies to documents or folders.
Docly Schema
Docly Schema (designer)
The built-in JavaScript events
Event name | Description |
|---|---|
Global JS declarations | Any javascript code that you can add to your schema page. You can add any variables, functions etc. |
AttachDocEvents($e, $form) | As the Docly schemas can add new list items dynamically, you can attach your event handlers through this function. |
UpdateFormGUI() | Runs after 250 ms of a change, makes it possible to calculate values, show/hide elements etc in your form. |
UpdateCalculations() | Runs immediately after a change in the form. Be careful not to create lag. |
Custom functions
Creating built-in templates
With the built-in templates you can create HTML, PDF, DOCX or XLSX versions of the data in your document. The templates can either be used for sending and downloading your document - or publishing on the web.
To create a PDF file either make a template in HTML or DOCX and add ".pdf" to the template name:
Image collection
Developer access
Coding Docly schemas means you have to act responsibly or you may be blocked.
Anyone who wants to code custom schemas will have to apply to get developer access on our official page:
Please report any abuse or suspicious activity you may see.
Once your schema is defined, see Create display templates for your schemas to render your documents as HTML pages, or Built-in schemas for templates stored inside the schema itself.