Inspiration

Beginners often know the name of an exercise but still struggle to understand what the movement should look like, which muscles it trains, and how to turn it into a practical routine. Finding those answers usually means switching between search results, long videos, generic workout templates, and payment pages.

I created MotionPay AI to bring that journey into one coherent experience: ask a fitness question, see the movement, receive a plan that fits your preferences, preview it, and unlock the complete plan through a secure PayPal sandbox checkout.

What it does

MotionPay AI is a conversational fitness application that combines AI-generated training plans, visual exercise demonstrations, and PayPal-powered access.

Users can:

  • Ask the AI coach to explain or demonstrate an exercise.
  • Continue the conversation with contextual follow-up questions.
  • Browse a library of more than 300 exercises across 12 collections.
  • View credited GIFs, illustrations, and predefined or dynamically discovered YouTube tutorials.
  • Generate a four-week plan based on their goal, experience level, weekly schedule, available equipment, and preferred session length.
  • Preview Week 1 before purchasing.
  • Unlock Weeks 2–4 through PayPal’s sandbox checkout.
  • Automatically return to MotionPay after approval and securely verify the payment.
  • Access purchased plans through their authenticated account.

The AI never controls the payment, chooses the final price, or grants access. Those responsibilities remain with the backend.

How I built it

The frontend was built with React Native, Expo SDK 58, Expo Router, and TypeScript. It supports a mobile-first experience and a deployed web version.

The FastAPI backend handles:

  • Groq AI requests using openai/gpt-oss-20b
  • Structured plan generation
  • Exercise and plan validation
  • Server-owned pricing
  • PayPal Orders v2 sandbox checkout
  • Payment capture and verification
  • Account-specific content access
  • Rate limits, timeouts, and error handling

Supabase provides email authentication, PostgreSQL storage, row-level security, purchase records, and account-linked plan access.

AI-generated plans use structured output. Exercise IDs must come from the application’s catalog, and the backend validates the number of sessions, exercises, and identifiers before saving a plan. If AI generation is unavailable, MotionPay can fall back to deterministic planning rules.

PayPal checkout is explicitly user-approved. Before unlocking a plan, the backend verifies the order ID, user association, plan association, amount, currency, order status, and capture status. Completion is stored atomically to make retries safe.

The project is deployed on Render as two services:

  • A Dockerized FastAPI web service
  • An Expo web static site

Challenges I ran into

One major challenge was keeping AI useful without allowing it to control sensitive business logic. The model needed enough flexibility to create meaningful plans, while prices, exercise identifiers, and access decisions had to remain server-controlled. Structured output and strict backend validation helped establish that boundary.

Payment reliability was another challenge. Checkout can be interrupted, cancelled, retried, or approved before the application regains focus. We implemented persistent checkout reservations, idempotency identifiers, account-bound orders, server-side capture verification, and automatic verification when PayPal returns to the hosted application.

Cross-platform return behavior also required careful handling. Mobile development builds, Expo Go, and web browsers behave differently after an external PayPal flow. The deployed web experience now returns directly to MotionPay and verifies the pending order automatically, while still preserving a manual verification option.

Exercise media presented an additional challenge. Some movements have bundled GIFs, others have credited illustrations, and some benefit from video. MotionPay uses a layered fallback system with bundled media, predefined YouTube videos, optional YouTube Data API discovery, and search links when embedding is unavailable.

Accomplishments that I'm proud of

I am especially proud that MotionPay demonstrates a complete AI-and-commerce workflow rather than a disconnected prototype.

Key accomplishments include:

  • A working conversational coach with contextual follow-ups
  • A catalog of more than 300 exercises
  • Structured four-week AI plan generation
  • Strict validation of AI-selected exercise IDs
  • A free Week 1 preview
  • Server-controlled plan pricing
  • PayPal sandbox approval and verified capture
  • Automatic post-checkout verification
  • Persistent, account-specific access
  • Safe handling of cancelled and interrupted checkout attempts
  • A deployed mobile-first web experience
  • Automated backend, TypeScript, lint, build, and payment-contract checks

The final backend test suite contains more than 100 passing tests, including payment validation, account isolation, retry behavior, plan generation, request limits, and conversational context.

What I learned

This project reinforced that integrating AI into commerce requires clear boundaries. AI is valuable for understanding intent, explaining exercises, and generating personalized content, but it should not be trusted to set prices, process payments, or decide whether a user owns something.

I also learned that a successful payment is not only a checkout screen. A reliable integration must handle authentication, order ownership, approval, capture, amount and currency verification, retries, cancellation, persistence, and recovery after interrupted requests.

Building across mobile and web highlighted the importance of testing the complete user journey on each platform. External navigation, authentication persistence, media playback, and return URLs can behave differently even when the underlying application logic is shared.

Finally, I learned that transparent limitations improve a product. MotionPay clearly identifies sandbox payments, draft exercise content, AI uncertainty, and the difference between educational fitness information and professional medical or training advice.

What's next for MotionPay AI

The next step is to strengthen MotionPay’s personalization and production readiness.

Future improvements include:

  • Progress tracking and completed-workout history
  • Plans that adapt from week to week based on user feedback
  • Professionally reviewed exercise instructions and training templates
  • Improved accessibility and multilingual coaching
  • More high-quality, licensed exercise demonstrations
  • Shared rate limiting for horizontally scaled deployments
  • Production PayPal webhooks, refunds, reversals, and entitlement revocation
  • More extensive mobile-device acceptance testing
  • Coach explanations that reference the user’s completed sessions and preferences

The long-term vision is for MotionPay to become a trusted bridge between asking a fitness question and taking a structured, user-approved next step—while keeping AI assistance, payment authority, and account security clearly separated.

Built With

Share this project:

Updates

Submission history