Skip to content

surveyjs/collaborative-form-filling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Collaborative Form Filling by SurveyJS

A real-time collaborative survey and form filling service that allows multiple participants to complete the same form simultaneously (similar to Google Docs for for document editing).

  • Frontend – React + TypeScript + SurveyJS (survey-core, survey-react-ui), Vite
  • Backend – Node + Express + Socket.IO
  • Storage – In-memory (MVP, no database or authentication)

How It Works

  • Participants join a room using its identifier.
  • The server stores the survey schema and current responses in memory.
  • When a participant changes a value, the onValueChanged event in SurveyJS is triggered, and the update is broadcast to other participants via Socket.IO.
  • Clients apply incoming updates using survey.setValue().
  • An applyingRemote flag prevents update loops (see packages/client/src/sync.ts).
  • Conflicts are resolved using a last-write-wins strategy at the individual question level.

Server Setup

  • The Express server hosts both the client application and Socket.IO on a single port in both development and production.
  • In development, Vite runs in middleware mode with HMR.
  • In production, the server serves the built client assets from client/dist and provides SPA fallback routing.

See packages/server/src/index.ts.

Running

Development

npm install
npm run dev

The application is available at http://localhost:3001. The first startup may take longer while Vite optimizes dependencies.

To test collaboration, open the application in two browser tabs using the same room identifier and edit the survey simultaneously.

Production

npm run build
npm start

npm run build compiles the server and builds the client application. npm start serves the production build and Socket.IO on http://localhost:3001.

Use the PORT environment variable to override the default port.

Tests

npm test
npm run test:e2e
  • npm test – Unit tests (Vitest) for the server, sockets, and client synchronization logic.
  • npm run test:e2e – End-to-end tests (Playwright) that verify collaborative editing across two browser contexts.

Before running E2E tests for the first time, install Playwright browsers:

npm run test:e2e:install

Project Structure

Related Resources

About

Real-time collaborative survey and form filling with SurveyJS. Multi-user form completion build with React, SurveyJS Form Library, Node.js, Express, and Socket.IO with live response synchronization.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages