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.12k stars 802 forks source link

PostgreSQL data storage #8869

Open gregvolny opened 1 day ago

gregvolny commented 1 day 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.