surveyjs / survey-library

Free JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout.
https://surveyjs.io/form-library
MIT License
4.22k stars 814 forks source link

PostgreSQL data storage #8869

Open gregvolny opened 1 month ago

gregvolny commented 1 month ago

Are you requesting a feature, reporting a bug or asking a question?

I'm Requesting a new feature.

What is the current behavior?

Right now, you already integrate SurveyJS with PostgreSQL. But, it on server side. However, because of the new PGLite: https://github.com/electric-sql/pglite, we can have better integration, persistent or in memory on any device. Also, you can reduce the complexity of this approach: https://github.com/surveyjs/surveyjs-nodejs-postgresql by allowing serverless PostgreSQL support.

What is the expected behavior?

If implemented we can have persistent data on any device with SurveyJS powered PWA and we can easily sync PGLite to remote PG Server

Some idea for implementation

There's several Express like Service Worker routing library able to implement worker rest API, for example, https://github.com/jcubic/wayne or Service worker microserver like: https://github.com/sinclairzx81/smoke And a lot of example of implementing Rest API in Service Worker. So, we can implement a Rest API able to store JSON from SurveyJS in relational PG schema. The last version have better JSON support/integration:https://www.postgresql.org/about/news/postgresql-17-released-2936/. The local (in memory or persistent) PostgreSQL database can be sync to remote centralized PG servers using https://pglite.dev/docs/sync or other (future) JS PostgreSQL sync engine or packages.

tsv2013 commented 1 month ago

Thank you for suggestion!

This functionality definitely makes sence for some our customers. But it looks rather specific for me for the following reasons:

I think it's this is a good idea for a third party (or comminity driven) project That's why I wouldn't add this funtionality in our survey-library project

gregvolny commented 1 month ago

Thanks @tsv2013 for replying. I think survey JS is PWA and with future support for ESM, will facilitate usage of any JS packages. Having relational schema support and device will and SQL queries will greatly boost the power of SurveyJS.