Velo: Integrating External Databases with Your Wix Site

Visit the Velo by Wix website to onboard and continue learning.

Velo by Wix is a full-stack development platform with integrated databases and backend code capabilities.  Wix Content Management System (CMS) data collections are document-oriented databases, optimized to store and retrieve websites’ content. Data collections are globally replicated and have native support for PII encryption and GDPR. Collections run on secure, shared infrastructure, and are fully managed by Wix. 

While CMS collections cover a wide range of use cases for content driven websites and applications, some projects may have very specific requirements that can not be addressed by the integrated database solution.

To address such cases, Velo by Wix allows users to connect an external database to their Wix site by using an external database adaptor. Once the connection is set up users can use wix-data APIs, display data in Wix Editor elements, use the data to create dynamic pages, and connect it to user input elements.

This article explains what an external database adaptor is and how to use one.

What is an External Database Adaptor?

An external database adaptor is a server that translates Wix Data requests from your site to an external database’s protocol, and translates the response back to a Wix Data format. From the Wix site’s point of view, the external database is a data collection and behaves exactly like an internal collection. This means that you can use any of the wix-data and wix-dataset APIs and populate repeaters, tables, and other page elements with data from your external database.

External database flows:

  1. A Wix Data request is made to an external database collection. The request is sent to the adaptor.

  2. The adaptor validates the request and translates it to a native database request in the required protocol.

  3. The native protocol request is sent to the external database.

  4. The external database sends a response in its native protocol and format.

  5. The adaptor translates the response to a Wix Data format.

  6. The translated response is sent to the Wix site and processed in the same way as an internal data response.

Deploy an External Database Adaptor

Wix created container image adaptors for a number of databases that can run on AWS, Google Cloud Platform, and Microsoft Azure. 

Use the following tutorials to walk through the setup of an external database adaptor hosted on each of the major cloud platforms.

If you don't want to use the Wix container image, you can adapt and extend the adaptor project to suit your needs. The project is a reference implementation of the Wix Data External Database Collections SPI, allowing the development or extension of alternative external database adaptors.

Add an External Data Collection to Your Site

Once you have deployed your adaptor, add the external collection to your site to complete the integration.

Use Existing Data

You can use existing data from your external database in your Wix site. If you want your existing database table to be read-write on your site, it must contain the following columns:

  • _id 
  • _createdDate
  • _updatedDate
  • _owner 

Tables without these columns are read-only in your Wix site.

When creating new tables, include these columns to make the table writable from your site.

Choose the Right DB Engine for Your Site Workload

There's a lot of material on the internet about database comparisons and benchmarks, which can help you decide which database engine to use.

We suggest taking the following into account:

  • Use the Wix-integrated CMS collections for:
    • CRUD operations for 1 to 10k items or up to 100k items, depending on the size of the data
    • Query operations of 1 to 10k items while using indexes.
  • Use relational databases for:
    • User facing operational workloads, including aggregates and data consistency validations. They scale according to the actual data and capacity planning for specific workloads
  • Use analytical databases for:
    • Reporting or analytical workloads when the dataset is mainly used for reporting or aggregates and, the dataset size exceeds the capacity of the relational database instance
    • Dedicated analytical databases include Google BigQuery or Snowflake.

Supported Databases

MySQL

MySQL supported vanilla MySQL versions 5.7 to 8.0. This includes variants like MariaDB and Percona Server for MySQL, as MySQL APIs are fully compatible. 

The following managed versions of MySQL are supported:

Postgres 

Open-source versions 9 to 13. 

The following managed versions are supported:

MongoDB

MongoDB can be run as a self-managed open source edition instance, or use managed MongoDB Atlas

  • Atlas can be hosted on Google Cloud, Amazon AWS, and Microsoft Azure.
  • The adaptor also supports MongoDB API compatible databases such as Microsoft Azure Cosmos DB.

MS SQL

Microsoft SQL Server server can be connected both as an on-premises, self-managed installation or managed version where available:

Google Cloud Spanner

  • Google Cloud Spanner: Fully managed relational database with unlimited scale, strong consistency, and up to 99.999% availability from Google.

Google Cloud BigQuery

  • Google Cloud BigQuery : Fully managed, scalable, and serverless data warehouse by Google with built-in machine learning capabilities.
Was this helpful?
Yes
No