You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cd server
# Install dependencies
go mod download
# Create config file
mkdir -p configs
cat > configs/config.yaml <<EOFserver: port: 8080database: dsn: "your_user:your_password@tcp(localhost:3306)/survey_db?charset=utf8mb4&parseTime=True&loc=Local"jwt: secret: "your-jwt-secret-at-least-64-characters-long-for-security" cookie_name: "survey_token"storage: local_path: "./uploads"EOF# Create upload directory
mkdir -p uploads
# Run the server
go run cmd/server/main.go
Frontend Setup
cd website
# Install dependencies
npm install
# Development server
npm run dev
# Production build
npm run build
# Type check
npm run type-check
Environment Variables
Variable
Description
JWT_SECRET
JWT signing secret (min 64 chars)
Configuration
Server Config (config.yaml)
Field
Description
Default
server.port
HTTP server port
8080
database.dsn
MySQL connection string
Required
jwt.secret
JWT signing secret
Required
jwt.cookie_name
Auth cookie name
survey_token
storage.local_path
File upload directory
./uploads
OAuth 2.0 Configuration
Field
Description
oauth.enabled
Enable OAuth authentication
oauth.client_id
OAuth client ID from SSO provider
oauth.auth_url
Authorization endpoint URL
oauth.token_url
Token endpoint URL
oauth.userinfo_url
User info endpoint URL
oauth.redirect_url
Callback URL for your application
oauth.scopes
OAuth scopes (space-separated)
oauth.min_permission_level
Minimum permission level required
API Reference
Public Endpoints
Method
Path
Description
POST
/api/public/login
User login
POST
/api/public/logout
User logout
GET
/api/oauth/authorize
Get OAuth authorization config
GET
/api/oauth/callback
OAuth callback (returns HTML for PKCE flow)
POST
/api/oauth/callback
Complete OAuth login and get JWT
POST
/api/oauth/refresh
Refresh JWT token
POST
/api/oauth/logout
OAuth logout (clear session)
GET
/api/public/listRegisterRole
Get available registration roles
POST
/api/public/loadProject
Load survey by code
POST
/api/public/validateProject
Validate survey access
POST
/api/public/statistics
Get survey statistics
POST
/api/public/saveAnswer
Submit survey answer
POST
/api/public/tempSaveAnswer
Temporarily save answer
POST
/api/public/uploadAttachment
Upload question attachment
GET
/api/public/preview/:attachmentId
Preview attachment file
GET
/captcha/get
Get captcha image
POST
/captcha/check
Verify captcha
Protected Endpoints
User Management
Method
Path
Description
GET
/currentUser
Get current user info
GET
/userOverview
Get user overview statistics
GET
/api/user/list
List users (paginated)
POST
/api/user
Create user
PUT
/api/user
Update user
GET
/api/user/:id
Get user by ID
DELETE
/api/user/:id
Delete user
POST
/api/user/bindRole
Bind user role
PUT
/api/user/updatePassword
Update password
POST
/importUser
Import users from Excel
Project Management
Method
Path
Description
GET
/api/project/list
List projects (paginated)
GET
/api/project
Get project by ID
GET
/api/project/setting
Get project settings
POST
/api/project/create
Create project
POST
/api/project/update
Update project
POST
/api/project/delete
Delete project (soft)
GET
/api/project/trash
List deleted projects
POST
/api/project/destroy
Permanently delete project
POST
/api/project/restore
Restore deleted project
Participant Management
Method
Path
Description
GET
/api/project/partner/list
List participants
POST
/api/project/partner/create
Add participant
POST
/api/project/partner/delete
Remove participant
GET
/api/project/partner/download
Download participants Excel
POST
/api/project/partner/import
Import participants Excel
Selectors
Method
Path
Description
POST
/api/project/selectUser
User selector
POST
/api/project/selectRole
Role selector
POST
/api/project/selectTemplate
Template selector
Survey Settings
Method
Path
Description
GET/POST
/api/survey/setting
Get/update survey settings
GET/POST
/api/survey/logic
Get/update survey logic rules
Survey Logic Rules
Logic rules enable conditional question display. Each rule consists of:
Target question: The question to show/hide based on conditions
Conditions: One or more conditions with operator (equals, contains, greater than, less than, etc.)
Logic operator: AND (all conditions must match) or OR (any condition matches)
Frontend Components:
LogicRuleEditor.vue — Modal editor for creating/editing logic rules
ConditionBuilder.vue — Visual condition builder for AND/OR logic
useLogicEvaluator.ts — Runtime composable that evaluates rules during survey fill
Rules are stored in project settings and evaluated client-side. Hidden questions are excluded from validation during submission. Rules are automatically cleaned up when referenced questions are deleted.
Answer Management
Method
Path
Description
GET
/api/answer/list
List answers (paginated, supports cross-project)
GET
/api/answer/trash
List deleted answers
GET
/api/answer
Get answer by ID
POST
/api/answer/create
Create answer
POST
/api/answer/update
Update answer
POST
/api/answer/delete
Delete answer (soft)
POST
/api/answer/destroy
Permanently delete answer
POST
/api/answer/restore
Restore deleted answer
POST
/api/answer/read
Mark answer as read
POST
/api/answer/unread
Mark answer as unread
GET
/api/answer/download
Export answers to Excel (includes IP and timing data)
Template Management
Method
Path
Description
GET
/api/template/list
List templates
GET
/api/template
Get template by ID
POST
/api/template/create
Create template
POST
/api/template/update
Update template
POST
/api/template/delete
Delete template
GET
/api/template/category/list
List template categories
GET
/api/template/tag/list
List template tags
System Management
Method
Path
Description
GET
/api/system
Get system info
POST
/api/system/update
Update system settings
GET
/api/system/role/list
List roles
POST
/api/system/role/create
Create role
POST
/api/system/role/update
Update role
POST
/api/system/role/delete
Delete role
File Management
Method
Path
Description
POST
/api/public/uploadAttachment
Upload question attachment
GET
/api/public/preview/:attachmentId
Preview/download attachment
Database
Tables use t_ prefix. Core tables:
Table
Description
t_project
Survey projects
t_answer
Survey responses
t_template
Question templates
t_file
Uploaded files
t_user
Users
t_role
Roles
t_account
Authentication accounts
t_oauth_session
OAuth refresh tokens
t_project_partner
Survey participants
t_user_role
User-role associations
t_sys_info
System settings
t_comm_dict_item
Dictionary items for dropdowns
Answer Model Fields
The t_answer table includes these notable fields:
is_read, read_at, read_by — Read status tracking
ip_address — Submitter IP for restriction enforcement
timing_info — JSON field storing question-level timing data