FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
all
allssscQuiz
Unlisted
Like
ssscQuiz
Home
Code
12
.vscode
.vt
frontend
4
shared
8
.vtignore
README.md
REFACTORING_NOTES.md
H
admin.http.ts
config.ts
deno.json
H
index.http.ts
H
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
2
Settings
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in miliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
…
README.md

Social Archetype Quiz

A comprehensive personality assessment tool that identifies your social archetype through a series of carefully crafted questions. Built with modern web technologies and designed to provide deep insights into personality types and social behavior patterns.

🚀 Latest Updates (v3.0)

New Modular Architecture

  • Separated concerns: Questions, archetypes, and utilities are now in separate files
  • Easy customization: Modify archetypes and questions independently
  • Better maintainability: Clear separation of data and logic
  • Enhanced admin features: Delete functionality with X icons
  • User choice tracking: Capture what users actually resonate with vs quiz results

Enhanced Database Schema (v3.0)

  • Added user_selected_archetype field to track user preferences
  • Automatic migration from v1 and v2 schemas
  • Better analytics and insights

Features

🎯 Core Functionality

  • 15-Question Assessment: Scientifically-designed questions that map to 9 distinct archetypes
  • Real-time Results: Instant calculation and display of personality breakdown
  • User Choice Capture: Track which archetype users actually resonate with
  • Email Integration: Automated delivery of detailed results to participants
  • Admin Dashboard: Comprehensive analytics and submission management with delete functionality
  • Data Export: Enhanced CSV export with quiz results vs user selections

🎨 User Experience

  • Progressive Interface: Email → Intro → Countdown → Quiz → Results → Choice Selection flow
  • Responsive Design: Optimized for desktop, tablet, and mobile devices
  • Interactive Elements: Smooth animations, progress tracking, and visual feedback
  • Social Sharing: Built-in sharing capabilities for social media platforms
  • Archetype Selection: Users can choose which archetype they most resonate with

📊 Analytics & Insights

  • Quiz vs Reality Comparison: See how quiz results compare to user self-selection
  • Personality Complexity Scoring: Measures trait distribution balance (0.0-1.0)
  • Response Consistency Analysis: Evaluates answer pattern consistency
  • Completion Time Tracking: Detailed timing analytics for each submission
  • Archetype Distribution: Statistical breakdown of result patterns

🛡️ Data Management

  • SQLite Database: Robust local storage with automatic schema versioning (v3.0)
  • Data Migration: Seamless upgrades between schema versions
  • Privacy Protection: IP hashing and secure data handling
  • Admin Controls: Delete individual submissions with confirmation
  • Backup & Recovery: Built-in data export and recovery mechanisms

Architecture

Database Schema (v3.0)

CREATE TABLE sssc_quiz_submissions_v3 ( id INTEGER PRIMARY KEY AUTOINCREMENT, email TEXT NOT NULL, primary_archetype TEXT NOT NULL, secondary_archetype TEXT, user_selected_archetype TEXT, -- NEW: User's actual choice breakdown TEXT NOT NULL, -- JSON: archetype scores answers TEXT NOT NULL, -- JSON: user responses timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, completion_time INTEGER, -- milliseconds insights TEXT, -- JSON: additional analytics user_agent TEXT, ip_hash TEXT, -- hashed for privacy session_id TEXT, quiz_version TEXT DEFAULT '3.0', personality_complexity_score REAL, -- 0.0-1.0 response_consistency_score REAL, -- 0.0-1.0 created_at DATETIME DEFAULT CURRENT_TIMESTAMP, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP );

Modular File Structure

ssscQuiz/
├── frontend/
│   ├── components/
│   │   ├── App.tsx                    # Main application component
│   │   ├── EmailScreen.tsx            # Email collection interface
│   │   ├── IntroScreen.tsx            # Welcome and instructions
│   │   ├── CountdownScreen.tsx        # Pre-quiz countdown
│   │   ├── PersonalityQuiz.tsx        # Main quiz interface
│   │   └── QuizResultsComponent.tsx   # Results + archetype selection
│   ├── index.html                     # Main HTML template
│   ├── index.tsx                      # Frontend entry point
│   └── style.css                      # Application styles
├── shared/
│   ├── archetypes.ts                  # 🆕 Archetype definitions (modular)
│   ├── questions.ts                   # 🆕 Quiz questions (modular)
│   ├── database.ts                    # Database schema and utilities
│   ├── quizData.ts                    # Re-exports for compatibility
│   ├── types.ts                       # TypeScript interfaces
│   └── utils.ts                       # Shared utility functions
├── admin.http.ts                      # Admin dashboard with delete functionality
├── config.ts                          # Configuration and settings
├── index.http.ts                      # Main HTTP entry point
├── main.tsx                           # Legacy entry point (redirects)
└── README.md                          # This file

The 9 Archetypes

🧭 The Explorer

Adventurous, Curious

  • Driven by curiosity and love for adventure
  • Thrives on discovering new experiences and cultures
  • Natural pioneer who inspires others to step outside comfort zones

⚗️ The Alchemist

Transformative, Intuitive

  • Transforms challenges into opportunities for growth
  • Deep intuition and spiritual insight
  • Helps others navigate life transitions

🤝 The Connector

Empathetic, Collaborative

  • Excels at bringing people together
  • Natural bridge-builder and relationship facilitator
  • Creates inclusive environments for collaboration

🔮 The Visionary

Creative, Innovative

  • Sees possibilities where others see limitations
  • Forward-thinking with ability to inspire others
  • Naturally drawn to cutting-edge ideas

💝 The Nurturer

Caring, Compassionate

  • Natural gift for caring and supporting others
  • Creates safe spaces for healing and growth
  • Deep fulfillment from helping others reach potential

🛡️ The Guardian

Protective, Reliable

  • Protector and stabilizer ensuring safety and security
  • Practical wisdom that keeps communities strong
  • Provides foundation for others to take risks

📚 The Sage

Wise, Reflective

  • Seeker of wisdom and understanding
  • Helps others navigate complex situations with clarity
  • Knowledge becomes guiding light for truth-seekers

🎨 The Artisan

Creative, Expressive

  • Brings beauty and creativity into the world
  • Unique perspective and skilled craftsmanship
  • Sees world through artistic lens

⚡ The Catalyst

Motivating, Dynamic

  • Force for positive change and transformation
  • High energy that motivates entire communities
  • Drives action toward meaningful goals

🔧 Customization Guide

Adding/Modifying Archetypes

Edit shared/archetypes.ts:

export const archetypeInfo: Record<string, ArchetypeInfo> = { "Your New Archetype": { name: "Your New Archetype", subtitle: "Descriptive, Adjective", description: "Detailed description...", traits: ["Trait 1", "Trait 2", ...], strengths: ["Strength 1", ...], challenges: ["Challenge 1", ...], idealEvents: ["Event 1", ...], famousExamples: ["Person 1", ...], careerPaths: ["Career 1", ...], compatibility: ["Works well with...", ...] } }; // Don't forget to add the icon and insights export const archetypeIcons: Record<string, string> = { "Your New Archetype": "🆕" };

Adding/Modifying Questions

Edit shared/questions.ts:

export const quizQuestions: QuizQuestion[] = [ { id: 16, // Next available ID text: "Your question text here?", options: [ { id: 1, text: "Option 1", archetypeWeights: { "The Explorer": 3, "The Sage": 2, "The Artisan": 1 } }, // ... 3 more options ] } ];

Question Validation

Use the built-in validation:

import { validateQuestions } from './shared/questions.ts'; const validation = validateQuestions(); if (!validation.isValid) { console.error("Question validation errors:", validation.errors); }

API Endpoints

Public Endpoints

  • GET / - Main quiz interface
  • POST /api/submit-quiz - Submit quiz results
  • POST /api/update-selection - 🆕 Update user's archetype selection
  • GET /frontend/* - Static frontend assets
  • GET /shared/* - Shared utility files

Admin Endpoints

  • GET /admin - Admin dashboard with delete functionality
  • GET /api/submission/:id - Get individual submission
  • DELETE /api/submission/:id - 🆕 Delete submission
  • GET /api/test-data - Insert test data

Debug Endpoints

  • GET /api/database-info - Database health check
  • GET /api/test-email - Test email functionality
  • GET /api/debug-config - Configuration verification

Admin Dashboard Features

Enhanced Table View

  • Quiz Result: Shows the algorithm-determined archetype
  • User Selected: Shows what the user actually chose (if any)
  • Delete Functionality: X icons with confirmation dialogs
  • Real-time Updates: Instant UI updates after deletions

CSV Export

Enhanced export includes:

  • Quiz results vs user selections
  • Secondary archetype information
  • Completion time analysis
  • Full breakdown data

Analytics Insights

  • Compare quiz accuracy vs user self-perception
  • Track archetype preference patterns
  • Monitor completion time trends
  • Analyze response consistency

Development

Local Setup

  1. Clone the repository
  2. Ensure Deno is installed
  3. Configure email settings in config.ts
  4. Run the main HTTP val: deno run --allow-all index.http.ts

Modular Development Workflow

  1. Modify Archetypes: Edit shared/archetypes.ts
  2. Update Questions: Edit shared/questions.ts
  3. Test Changes: Use validation functions
  4. Deploy: Upload to Val Town

Database Management

The system automatically handles schema versioning and migrations. To add new fields:

  1. Update the schema in shared/database.ts
  2. Increment the version number (currently v3.0)
  3. Add migration logic for existing data
  4. Test with sample data

Migration Guide (v2 → v3)

Automatic Migration

The system automatically migrates from v2 to v3, adding:

  • user_selected_archetype field (initially NULL)
  • Updated quiz version tracking
  • Enhanced analytics support

Manual Migration (if needed)

-- Add new column to existing v2 table ALTER TABLE sssc_quiz_submissions_v2 ADD COLUMN user_selected_archetype TEXT; -- Update version UPDATE sssc_quiz_submissions_v2 SET quiz_version = '3.0';

Performance Optimizations

Database

  • Indexed key fields for fast queries
  • Efficient pagination for large datasets
  • Optimized CSV export queries

Frontend

  • Modular imports reduce bundle size
  • Lazy loading for components
  • Efficient state management

Backend

  • Non-blocking email sending
  • Efficient file serving
  • Error isolation

Support & Maintenance

Monitoring

  • Check database health regularly via /api/database-info
  • Monitor email delivery success rates
  • Review completion time trends
  • Analyze quiz vs user selection accuracy

Troubleshooting

  • Email Issues: Check /api/test-email endpoint
  • Database Problems: Use /api/database-info for diagnostics
  • Performance: Monitor response times and optimize queries
  • Data Issues: Validate submissions and check for anomalies

License

This project is designed for educational and research purposes. Please ensure compliance with data privacy regulations when collecting and storing personal information.

Contributing

Contributions are welcome! Please focus on:

  • Improving question quality and archetype accuracy
  • Enhancing modular architecture
  • Adding new analytics and insights
  • Optimizing performance and reliability

Built with ❤️ for understanding human personality and social dynamics

Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.