Skip to content
Easily convert your SQL database into a REST API, using the SQLConnector action from
Branch: master
Clone or download

Easily convert your SQL database into a REST API, using the SQLConnector action from

This is a lightweight Express.js server that is able to wrap a SQL database, and expose functionality through pre-configured SQL Statements attached to a REST API. Using data from your project, routes are dynamically generated along with the SQL code to allow you to create forms in, and have the contents automatically inserted into your SQL Database using field mapping within the SQL Connector Form Action. Please go to to learn more.

This library currently supports Microsoft SQL Server, MySQL, and PostgreSQL.

Getting Started

To get started with a new formio-sql server:

  1. Clone this repo
  2. Copy the contents of .env.example to .env
  3. Update the contents of TYPE, DB_SERVER, DB_USER, DB_DATABASE to match your SQL instance.
  4. Select the PORT you want to run your formio-sql instance on
  5. Create a API Key on your Project for the FORMIO_KEY
  6. Add your project domain to the FORMIO_PROJECT
  7. Configure your Project settings, to have a SQL Connector Data Connection
  8. Configure a Form to have the SQL Connector action, and configure the mappings
  9. Start your formio-sql server, which will dynamically connect your server to your Forms, so all submissions will be stored in your connected database.


The following items are required to use the formio-sql server.

  1. A Project on the Team Pro or Commercial Plan
  2. A Node.js LTS Server, 4.x.x
  3. A MySQL/Microsoft SQL/PostgreSQL server (only one)


All the settings of this library are controlled via environment variables, which may be manually added to the start command, e.g. SETTING=something npm start, or you can configure the .env file. To configure the .env file, copy the .env.example file to .env and add your settings.


Setting Default Required Purpose
PORT 3000 yes The port this express server will run on.
TYPE mysql yes The type of SQL syntax to use (mysql, mssql, postgresql).
DB_SERVER localhost yes The SQL database host to use.
DB_PORT no The SQL database Port to use.
DB_USER root no The SQL database user to use.
DB_PASSWORD no The SQL database password to use.
DB_DATABASE formiosql yes The SQL database user to use.
FORMIO_KEY yes The API key for your Project.
FORMIO_PROJECT yes The Project _id for your Project.
AUTH_USERNAME no A Random username required to access this Server for Basic Auth, also used in the Project settings for SQL Connector.
AUTH_PASSWORD no A Random password required to access this Server for Basic Auth, also used in the Project settings for SQL Connector.
LEGACY no Override legacy support. Useful if you don't make a config.json file, and don't want to use defaults.json

Backwards Compatibility

This library originally used a defaults.json file. That has been deprecated in favor of config.json. You can copy use config.json.example as a template, and add/remove any settings you want.

The db settings in config.json are used as a template, so any additional database settings will be passed on to the underlying libraries for extended functionality.

If you want don't want to create a config.json, it is recommended that you add the env variable LEGACY=false, to force the settings logic to use the expanded functionality.


The routes are primarily generated on, but can also be added manually. Adding custom routes to routes.json will overwrite generated routes.

How it works

Upon running the formio-sql server, it will authenticate to your project and grab all the generated SQL Connector routes, so anytime the SQLConnector action is changed on, this server will need to be restarted to get the updated routes.

If you are not using a project, check out Resquel.


  • The Team
You can’t perform that action at this time.