youreply-survey
v2.1.0
Published
YouReply Survey - Framework-agnostic JSON Schema for survey definitions with A/B testing, flow orchestration, and content blocks
Maintainers
Readme
YouReply Survey Schema
Core JSON Schema for YouReply Survey system - framework-agnostic and UI-independent.
🎯 What's New: Survey Builder!
Visual survey creation is now available! We've added a powerful drag-and-drop Survey Builder that makes creating surveys easy and intuitive.
👉 See Builder Documentation | Try Demo
Quick Start with Builder
import { SurveyBuilder } from 'youreply-survey';
import 'youreply-survey/dist/builder.css';
<SurveyBuilder
defaultLanguage="en"
onSurveyChange={(survey) => console.log(survey)}
/>Features:
- ✨ Drag and drop questions
- 🎨 Visual property editor
- 👀 Live JSON preview
- 📤 Export/copy JSON output
- 🎯 19 question types supported
- 📄 Multi-page surveys
Features
- Multi-language Support: All text fields support multiple languages using ISO 639-1 language codes
- Multiple Question Types: 19 different question types supported
- Conditional Logic: Page, question, and survey-level logic rules
- Versioning: Built-in metadata for tracking versions and changes
- Validation: Comprehensive validation rules for data quality
- Framework Agnostic: Pure JSON Schema without UI/CSS dependencies
- Survey Builder: NEW! Visual drag-and-drop survey creation tool
Schema Version
Current version: 1.0.0
Schema Draft: JSON Schema Draft 2020-12
Question Types
The schema supports the following question types:
- single_choice - Single selection from options
- multiple_choice - Multiple selections from options
- text_short - Short text input
- text_long - Long text/textarea input
- number - Numeric input
- email - Email address input
- phone - Phone number input
- date - Date picker
- time - Time picker
- datetime - Date and time picker
- rating - Star rating or similar
- scale - Linear scale (e.g., 1-10)
- matrix - Grid of questions with same options
- ranking - Rank items in order
- slider - Slider for numeric input
- dropdown - Dropdown/select list
- file_upload - File upload
- signature - Digital signature
- location - Geographic location
Conditional Logic
The schema supports complex conditional logic through:
- Conditions: Compare question answers using various operators
- Actions: Perform actions when conditions are met
- Operators: AND/OR logic for combining conditions
- Scope: Logic rules can be defined at survey, page, or question level
Supported Condition Operators
equals,not_equalscontains,not_containsgreater_than,less_than,greater_or_equal,less_or_equalis_empty,is_not_emptyis_answered,is_not_answeredin,not_in
Supported Actions
show,hide- Show/hide questions or pagesrequire,unrequire- Make questions required/optionalskip_to_page,skip_to_question- Navigate to specific elementsend_survey- Complete the surveyset_value- Set a variable valuecalculate- Perform calculations
Multi-Language Support
All text fields use the MultiLanguageText type:
{
"en": "Welcome to our survey",
"tr": "Anketimize hoş geldiniz",
"es": "Bienvenido a nuestra encuesta"
}Example Survey
See examples/ directory for complete survey examples.
Validation
The schema includes comprehensive validation:
- Required field validation
- Pattern matching (regex)
- Min/max values and lengths
- Custom validation expressions
- Multi-language error messages
Versioning
Each survey includes metadata for tracking:
- Creation and update timestamps
- Creator and updater information
- Status (draft, active, archived, deleted)
- Tags for organization
Usage
This schema can be used with any programming language or framework that supports JSON Schema validation. It's designed to be a universal format for survey definitions.
License
Copyright © YouReply
