A full-stack solution for building survey analytics dashboards with SurveyJS, MongoDB, and Grafana. It lets you create surveys, collect and process responses, run sentiment and text analysis using a natural language processing (NLP) service, and visualize results in interactive dashboards.
- SurveyJS provides survey data models.
- Node.js backend handles surveys, responses, analytics, and Grafana queries.
- NLP service performs sentiment and text analysis.
- Redis caches analytics for faster performance.
- Grafana plugin visualizes survey data in real time.
Redis Cache MongoDB
↓ ↓
SurveyJS → Node.js Backend → Grafana Plugin → Grafana Dashboards
↓
NLP Service (text analysis)
node-server
- Backend servicemongo
- MongoDB configurationnlp-service
- Natural language processing servicegrafana
- Grafana configurationgrafana/provisioning
- Automatic configuration filesgrafana/surveyjs-grafana-datasource
- Plugin for analytics visualization
# Clone this repo
git clone https://github.com/surveyjs/surveyjs-mongodb-grafana.git
# Build SurveyJS Grafana DataSource
cd surveyjs-mongodb-grafana/grafana/surveyjs-grafana-datasource
npm i
npm run build
# Build Node.js backend
cd ../../node-server
npm i
npm run build
# Prepare NLP service
cd ../nlp-service
pip install -r requirements.txt
python -m spacy download en_core_web_sm
# Run Docker containers
cd ..
docker compose up -d
NLP model download and build may take ~5 minutes.
Access services:
- http://localhost:3000/ - SurveyJS backend: view survey list, run a survey, display results in a table.
- http://localhost:3001/ - Grafana dashboards (login:
admin
, password:grafana
).
MongoDB and Grafana access is controlled by environment variables:
# MongoDB Configuration
MONGO_ROOT_USER=admin
MONGO_ROOT_PASSWORD=your_secure_password
# Grafana Configuration
GRAFANA_ADMIN_USER=admin
GRAFANA_ADMIN_PASSWORD=your_grafana_password
A preconfigured Grafana dashboard (burger_survey.json
) demonstrates choice distributions, ratings, sentiment analysis, and temporal response trends.
# Check service status
docker-compose ps
# View service logs
docker-compose logs [service-name]
# Restart specific service
docker-compose restart [service-name]
# Check MongoDB connectivity
docker-compose exec mongodb mongosh --eval "db.adminCommand('ping')"
# Check Redis connectivity
docker-compose exec redis redis-cli ping
- Verify data sources are configured correctly.
- Check backend service connectivity.
- Review Grafana logs for errors.
- Ensure survey data exists in MongoDB.
Enable debug logging for detailed troubleshooting:
# Node.js backend
NODE_ENV=development docker-compose up
# Grafana
GF_LOG_LEVEL=debug docker-compose up grafana
Apache-2.0. See LICENSE.