Skip to content

optimal-ai-app/optimal

Repository files navigation

Optimal - Frontend Repository

Website: Optimal

Demo Video:

About

Optimal is an AI-powered accountability coaching app built with React Native and Expo, deployed to iOS via TestFlight. The frontend communicates with a multi-agent Spring Boot backend, rendering dynamic in-chat UI components driven by agent response tags. Users interact with AI coaching workflows for goal creation, milestone planning, and task scheduling through a conversational interface that surfaces interactive cards, confirmation flows, and date pickers inline within the chat.

Frontend Highlights

  • Tag-driven UI rendering -- Agent responses carry structured JSON tags (e.g. CREATE_TASK_CARD_TAG, CREATE_GOAL_CARD_TAG, CONFIRM_TAG) that the frontend maps to interactive React Native components, enabling the backend to drive UI state from the LLM layer
  • Zustand state management -- Modular stores for chat, goals, tasks, and users with selector hooks to minimize re-renders across the app
  • Axios HTTP service -- Singleton with JWT injection, automatic token refresh on 401, and retry logic backed by Supabase session management
  • Expo Router file-based navigation -- Tab and stack navigation with animated transitions, safe area handling, and deep linking support
  • React Native Reanimated -- Spring, sequence, and stagger animations throughout, including message entrance effects, loading dots, and pulse animations

Environment Variables

Required Environment Variables

The app requires three environment variables for production builds:

  • API_BASE_URL - Your backend API URL (must be internet-accessible)
  • SUPABASE_URL - Your Supabase project URL
  • SUPABASE_ANON_KEY - Your Supabase anonymous key

Setting Environment Variables in EAS

  • Environment variables are set in EAS (Expo Application Services) and are automatically injected during the build process.
  • API_BASE_URL must be internet-accessible. Localhost or temporary ngrok URLs won't work for TestFlight builds
# Set API_BASE_URL
eas env:create --scope project --name API_BASE_URL --value "https://your-backend-url.com/" --type string --environment production --visibility secret

# Set SUPABASE_URL
eas env:create --scope project --name SUPABASE_URL --value "https://your-project.supabase.co" --type string --environment production --visibility secret

# Set SUPABASE_ANON_KEY
eas env:create --scope project --name SUPABASE_ANON_KEY --value "your-supabase-anon-key" --type string --environment production --visibility secret

Verifying Environment Variables

# List all environment variables (requires interactive selection)
eas env:list

Building for iOS

Prerequisites

  1. EAS CLI installed: npm install -g eas-cli
  2. Logged into EAS: eas login
  3. EAS project configured: eas build:configure

From Local Changes to TestFlight

# 1. Make changes locally

# 2. Commit and push
git add .
git commit -m "{Insert commit message}"
git push origin dev

# 3. Switch to production branch
git checkout prod
git merge dev
git push origin prod

# 4. Build

eas build --platform ios --profile production

During the build, you'll be prompted:

  • Encryption: Answer Y (yes) - app uses standard/exempt encryption
  • Apple Account Login: Answer Y (yes) - allows EAS to manage credentials automatically
  • Distribution Certificate: Answer Y (yes) - generates new certificate if needed

5. Wait for build (15-30 minutes)

6. Submit to TestFlight

# 5. Submit 
eas submit --platform ios --profile production

7. Wait for Apple processing (5-10 minutes)

8. Test in TestFlight app

Open TestFlight → Update → Test

About

React Native and Expo iOS app for Optimal. Features tag-driven in-chat UI rendering where agent response tags surface interactive goal, milestone, and task creation components directly within the conversational interface.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors