Skip to content

Sheperdd/min_max

Repository files navigation

MinMaxLife

MinMaxLife is a React Native application built with Expo that gamifies personal development. It maps real-world habits and tasks to RPG-style attributes (Strength, Intelligence, Discipline, etc.), allowing users to track progress through a quantitative stat system.

The application leverages Supabase for backend persistence and OpenAI's GPT-4o-mini to intelligently categorize user-defined tasks into appropriate stat buckets.

Project Overview

The core concept involves "quests"—tasks with defined frequencies (daily, weekly, monthly, one-time). Completion of these quests awards experience points to specific stats. The application handles complex logic for stat decay (missing recurrence windows) and diminishing returns to simulate realistic habit formation.

Technical Stack

Frontend

  • Framework: React Native (Expo SDK 54)
  • Routing: Expo Router (File-based routing)
  • Language: TypeScript
  • State Management: TanStack Query (React Query)
  • Styling: NativeWind (Tailwind CSS implementation for React Native)
  • Visualization: Victory Native (Charts)

Backend & Services

  • Database: Supabase (PostgreSQL)
  • Authentication: Supabase Auth
  • AI Integration: OpenAI API (GPT-4o-mini with structured outputs)
  • Schema Validation: Zod

Features

  • Attribute System: Tracks 8 core stats: Strength, Intelligence, Discipline, Charisma, Growth, Efficiency, Health, and Creativity.
  • Automated Categorization: Utilizes OpenAI to analyze quest titles/descriptions and automatically assign relevant stat points and difficulty multipliers.
  • Temporal Logic: Implements logic for daily, weekly, and monthly recurrence, including penalties for missed periods.
  • Data Visualization: Renders historical progress of attributes using interactive line charts.
  • Cross-Platform: Compatible with iOS, Android, and Web clients.

Database Schema

The project uses a relational schema hosted on Supabase:

  • profiles: User identity and metadata.
  • user_stats: Aggregated current values for each of the 8 attributes.
  • quests: Active and inactive tasks with JSONB columns for assigned stat rewards.
  • quest_completions: Ledger of all completed events for history tracking and auditing.

Local Development

Prerequisites

  • Node.js (LTS)
  • npm or yarn
  • Expo Go (for device testing) or Android/iOS Simulators

Installation

  1. Clone the repository:

    git clone [https://github.com/your-username/min-max-life.git](https://github.com/your-username/min-max-life.git)
    cd min-max-life
  2. Install dependencies:

    npm install
  3. Configure environment variables: Create a .env file in the root directory.

    EXPO_PUBLIC_SUPABASE_URL=your_supabase_url
    EXPO_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
    EXPO_PUBLIC_OPENAI_API_KEY=your_openai_api_key
  4. Initialize Database: Execute the contents of supabase-setup.sql in your Supabase SQL Editor to generate the required tables, Row Level Security (RLS) policies, and indexes.

  5. Start the development server:

    npx expo start

Architecture Notes

  • Stat Assignment: The ai-service.ts module uses OpenAI's JSON mode to ensure strictly typed responses when parsing user input for quest creation.
  • Optimistic Updates: The application uses TanStack Query's optimistic updates to ensure immediate UI feedback upon quest completion, syncing with Supabase in the background.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors