SurveyJS are client-side libraries that work in a web browser. You can think of them as building blocks that you can insert anywhere in your application to create a frontend for your survey management system. Developers can integrate SurveyJS with any server-side framework and database to build a backend for this system. This help topic describes the main aspects that should be taken into account when you integrate SurveyJS with your backend.
To communicate with the server, SurveyJS libraries use JSON objects. The following diagram illustrates the communication process:
SurveyJS libraries send and receive two types of JSON objects:
Contains a survey model that describes the survey structure. The survey model can contain pages, panels, and questions.
Contains a respondent's answers to survey questions.
Your backend development team should implement server-side code that stores these JSON objects in a database and delivers them to and from the client side.
Backend implementation is a custom development task that lies beyond the application scope of SurveyJS libraries. However, we can highlight implementation aspects that guarantee successful SurveyJS integration.
Design a REST API endpoint that accepts JSON data in requests and sends JSON data in responses.
To authenticate a user that sends a request, determine their identity. To authorize the user, determine the resources that they can access. Prevent users from accessing API operations outside their predefined roles.
A survey management application should include a database to store survey schemas and results. Depending on your business needs, you can build an on-premises data storage or host data in a cloud service.
In the simplest case, the database can include two tables: one for survey schemas and one for survey results. The tables should have a one-to-many relationship (one schema to many survey results) and can have the fields described below.
id- A unique identifier of a survey schema.
content- A JSON object or text string that contains the survey schema.
id- A unique identifier of a survey result.
survey_schema_id- A required field that refers to
content- A JSON object or text string that contains the survey result.
Each database can also have additional fields as required. For example, if you need to track who and when created or changed a survey schema, you can add the
changedBy fields to the
The following table illustrates permissions that each SurveyJS component needs for correct operation:
|Survey Creator||Create / Read / Update||-|
Note that SurveyJS Dashboard needs to read one record from
SurveySchemas and all records with the same
SurveyResults. SurveyJS PDF Generator needs to read one record from
SurveySchemas and, optionally, one record with a desired result from
Although SurveyJS does not offer production-ready backend solutions, you can refer to the following page for free examples that can be used as a starting point to implement a full-cycle survey management system on your premises: Backend Integration Examples.