Skip to content

empowersocialapp/Empower-Social-2

Repository files navigation

Empower Social 🌟

Less Scrolling. More Living.

A personalized event recommendation engine that uses psychology-backed assessments to match users with meaningful real-world activities and communities.

Version Status Deployment


πŸ“– Table of Contents


🎯 Overview

Empower Social is a web application that helps people find events, activities, and communities that match their personality, motivations, and social needsβ€”not just their interests. By combining validated psychological assessments (TIPI for Big Five traits, Situational Motivation Scale) with AI-powered recommendation generation, Empower provides personalized suggestions that truly resonate.

How It Works

  1. User completes a 7-page intake survey (~5 minutes)

    • Demographics and location
    • Personality assessment (Big Five traits)
    • Social connection metrics
    • Core motivations
    • Interest categories and specific activities
    • Activity preferences and affinity groups
  2. Backend processes and calculates scores

    • Personality dimensions (Extraversion, Conscientiousness, Openness)
    • Social need scoring (prioritizes community for isolated users)
    • Motivation factors (Intrinsic, Social, Achievement)
  3. AI generates personalized recommendations

    • GPT-4-turbo creates conceptual activity recommendations
    • Recommendations consider personality fit, social needs, motivations, and practical constraints
    • Cached for performance, regenerated on profile updates
  4. User views and manages recommendations

    • Card-based display with personalized explanations
    • Ability to regenerate recommendations
    • Edit profile/survey to update preferences

✨ Features

Core Functionality βœ…

  • Comprehensive intake survey (7 pages, ~5 minutes)
  • Psychology-backed assessments
    • TIPI (Ten-Item Personality Inventory) for Big Five traits
    • Situational Motivation Scale for core motivations
  • Smart score calculation (automated via Airtable formulas)
  • AI-powered recommendations (GPT-4-turbo with personalized prompts)
  • User authentication (email-based login for returning users)
  • Profile editing (update survey responses and regenerate recommendations)
  • Recommendation regeneration (bypasses cache for fresh results)
  • Responsive design (mobile-friendly UI)

Data Management βœ…

  • Airtable integration (cloud-based database)
    • Users table
    • Survey_Responses table
    • Calculated_Scores table (formula fields)
    • GPT_Prompts table (audit trail)
  • Data validation (frontend and backend)
  • Empty field handling (proper cleanup for optional fields)
  • Multi-select field support (interests, affinity groups)

Code Quality βœ…

  • ESLint configuration (code style enforcement)
  • Pre-commit hooks (Husky for linting before commits)
  • Error handling (comprehensive try-catch blocks)
  • Logging (structured error and info logs)

πŸ›  Tech Stack

Frontend

  • Vanilla HTML/CSS/JavaScript (no frameworks)
  • Responsive CSS (mobile-first design)
  • Modern typography (Montserrat + DM Sans)

Backend

  • Node.js (v14+)
  • Express.js (RESTful API)
  • Airtable API (database)
  • OpenAI API (GPT-4-turbo for recommendations)

Database

  • Airtable (cloud-based relational database)
    • Linked records for relationships
    • Formula fields for automatic calculations
    • Lookup fields for data aggregation

Deployment

  • AWS Amplify (hosting and auto-deployment)
  • GitHub (version control and CI/CD)

Development Tools

  • ESLint (code linting)
  • Husky (Git hooks)
  • npm (package management)
  • Playwright (end-to-end testing)

πŸ“ Project Structure

Empower-Social/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ login.js              # User authentication
β”‚   β”‚   β”œβ”€β”€ recommendations.js    # Recommendation endpoints
β”‚   β”‚   └── survey.js             # Survey submission/retrieval
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ airtable.js           # Airtable database operations
β”‚   β”‚   β”œβ”€β”€ openai-conceptual.js  # GPT prompt generation
β”‚   β”‚   β”œβ”€β”€ recommendations-v2.js # Recommendation generation logic
β”‚   β”‚   └── events.js             # Event-related utilities
β”‚   β”œβ”€β”€ scripts/                  # Utility scripts
β”‚   └── server.js                 # Express server entry point
β”‚
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   β”œβ”€β”€ css/                  # Stylesheets
β”‚   β”‚   └── js/
β”‚   β”‚       └── recommendations.js # Frontend recommendation logic
β”‚   β”œβ”€β”€ profile/
β”‚   β”‚   β”œβ”€β”€ login.html            # Login page
β”‚   β”‚   └── recommendations.html  # Recommendations display
β”‚   β”œβ”€β”€ survey/
β”‚   β”‚   └── intake-survey.html    # Main survey form
β”‚   β”œβ”€β”€ config.js                 # Frontend configuration
β”‚   └── index.html                # Landing page
β”‚
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ SURVEY_FIELDS_REFERENCE.md    # Complete survey field documentation
β”‚   β”œβ”€β”€ GPT_PROMPT_TEMPLATE.md        # GPT prompt structure
β”‚   β”œβ”€β”€ AIRTABLE_SETUP_GUIDE.md       # Database setup instructions
β”‚   β”œβ”€β”€ API_SETUP_GUIDE.md            # API key configuration
β”‚   β”œβ”€β”€ AMPLIFY_SETUP.md              # Deployment guide
β”‚   β”œβ”€β”€ EMPOWER_SYSTEM_GUIDE.md       # System overview
β”‚   └── RECOMMENDATION_SYSTEM_DEVELOPMENT.md  # Development documentation
β”‚
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ config.spec.js            # Configuration tests
β”‚   β”œβ”€β”€ welcome-page.spec.js      # Landing page tests
β”‚   β”œβ”€β”€ survey-flow.spec.js       # Survey flow tests
β”‚   β”œβ”€β”€ recommendations-page.spec.js  # Recommendations tests
β”‚   β”œβ”€β”€ login-flow.spec.js        # Login tests
β”‚   β”œβ”€β”€ integration-flow.spec.js  # End-to-end tests
β”‚   β”œβ”€β”€ accessibility.spec.js      # Accessibility tests
β”‚   └── README.md                 # Test documentation
β”‚
β”œβ”€β”€ package.json                  # Root package.json (ESLint, Husky, Playwright)
β”œβ”€β”€ playwright.config.js          # Playwright test configuration
β”œβ”€β”€ .eslintrc.json               # ESLint configuration
β”œβ”€β”€ .husky/                      # Git hooks
└── README.md                    # This file

πŸš€ Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm (comes with Node.js)
  • Airtable account and API key
  • OpenAI API key
  • AWS Amplify account (for deployment)

Installation

  1. Clone the repository

    git clone https://github.com/empowersocialapp/Empower-Social-2.git
    cd Empower-Social
  2. Install backend dependencies

    cd backend
    npm install
  3. Install root dependencies (for ESLint/Husky)

    cd ..
    npm install
  4. Set up environment variables

    Create backend/.env file:

    AIRTABLE_API_KEY=your_airtable_api_key
    AIRTABLE_BASE_ID=your_base_id
    OPENAI_API_KEY=your_openai_api_key
    PORT=3000
  5. Set up Airtable database

    See docs/AIRTABLE_SETUP_GUIDE.md for detailed instructions on:

    • Creating tables (Users, Survey_Responses, Calculated_Scores, GPT_Prompts)
    • Setting up fields and formulas
    • Configuring linked records
  6. Start the backend server

    cd backend
    npm start
  7. Open the frontend

    Open frontend/index.html in your browser, or serve it via a local server:

    # Using Python
    cd frontend
    python -m http.server 8000
    
    # Or using Node.js http-server
    npx http-server frontend -p 8000

Configuration

  • Frontend API endpoint: Edit frontend/config.js to point to your backend URL
  • Backend CORS: Configure in backend/server.js if needed
  • Airtable field names: Must match exactly as specified in docs/SURVEY_FIELDS_REFERENCE.md

πŸ“š Key Documentation

For Developers

For Understanding the System


πŸ”„ Recent Updates

December 2025

  • βœ… Added Playwright test suite - Comprehensive end-to-end testing with 108 tests across 3 browsers
  • βœ… Added configuration tests - Tests for config.js environment detection and API setup
  • βœ… Added descriptive file headers - All code files now include comprehensive headers documenting purpose, inputs, outputs, and dependencies
  • βœ… Improved code documentation - Enhanced inline comments throughout codebase
  • βœ… Updated documentation - README and docs updated to reflect current project state

November 2025

  • βœ… Fixed recommendation caching - Recommendations now properly regenerate when users edit their profiles
  • βœ… Fixed data saving issues - Close friends count, free time, travel distance, and affinity selections now save correctly
  • βœ… Fixed interests auto-select - Interests no longer reset to all selected when editing survey
  • βœ… Improved navigation - Standardized all navigation paths to use absolute paths for AWS Amplify compatibility
  • βœ… Fixed JavaScript errors - Converted inline onclick handlers to event listeners, fixed syntax errors
  • βœ… Added code quality tools - ESLint configuration and pre-commit hooks (Husky)
  • βœ… Created comprehensive documentation - Survey fields reference document for technical specifications
  • βœ… Added recommendation feedback system - Users can evaluate recommendations (Interested/Maybe/Not for Me)
  • βœ… Added evaluation summary - Summary appears after all recommendations are evaluated

Key Bug Fixes

  • Cache invalidation: Recommendations now bypass cache on regenerate/edit
  • Empty field handling: Proper cleanup of empty strings and arrays
  • Multi-select preservation: Empty arrays preserved for Airtable multi-select fields
  • Event listener migration: All buttons now use event listeners instead of inline handlers
  • Path standardization: All navigation uses absolute paths (/path/to/file.html)

πŸ’» Development

Code Style

  • Indentation: 2 spaces
  • Semicolons: Required
  • Quotes: Single quotes preferred
  • Trailing spaces: Not allowed
  • ESLint: Run npm run lint to check, npm run lint:fix to auto-fix

Git Workflow

  • Pre-commit hook runs ESLint automatically
  • Commit messages should be descriptive
  • Push to main branch triggers AWS Amplify deployment

Testing

Automated Tests (Playwright):

# Run all tests
npm test

# Run tests in UI mode (interactive)
npm run test:ui

# Run specific test file
npx playwright test tests/config.spec.js

Test Coverage:

  • βœ… Configuration tests (config.spec.js) - API configuration and environment detection
  • βœ… Welcome page tests (welcome-page.spec.js) - Landing page functionality
  • βœ… Survey flow tests (survey-flow.spec.js) - Complete survey journey
  • βœ… Recommendations tests (recommendations-page.spec.js) - Recommendation display and interaction
  • βœ… Login flow tests (login-flow.spec.js) - User authentication
  • βœ… Integration tests (integration-flow.spec.js) - End-to-end user journeys
  • βœ… Accessibility tests (accessibility.spec.js) - WCAG compliance

Manual Testing:

  1. Test survey submission: Fill out all 7 pages and verify data saves correctly
  2. Test recommendation generation: Verify recommendations appear after submission
  3. Test profile editing: Edit survey and verify recommendations regenerate
  4. Test login: Use username to login as returning user
  5. Test empty fields: Submit survey with optional fields empty
  6. Test feedback buttons: Evaluate recommendations (Interested/Maybe/Not for Me)

Debugging

  • Backend logs: Check backend.log or console output
  • Frontend console: Check browser developer console for JavaScript errors
  • Airtable: Verify records are created correctly in Airtable UI
  • API responses: Check network tab in browser dev tools

πŸ“ License

See LICENSE file for details.


🀝 Contributing

This is a private repository. For questions or issues, contact the project maintainer.


πŸ“§ Support

For technical questions or issues:

  • Check the documentation in the docs/ folder
  • Review docs/SURVEY_FIELDS_REFERENCE.md for data handling questions
  • Check docs/GPT_PROMPT_TEMPLATE.md for recommendation generation questions

Last Updated: December 2025
Version: 1.1.0

About

2.0 Version of Empower-Social

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •