Skip to content

About

02-Mobile-first AI web app for gym training. This project reflects my focus on translating real user needs into practical digital solutions. Includes VS Code + Antigravity AI agents team orchestration.

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

83 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fawredd Gym Training Assistant

Fawredd Gym is a mobile-first training log and AI coaching assistant. Users can record workouts, set a personal training objective, review their history, and generate a one-day workout recommendation informed by their recent activity.

The app keeps a compact, persistent training state so coaching requests can use a concise summary of a user's progress instead of repeatedly sending their entire workout history to the model. The application interface and AI-generated coaching content are currently in Spanish.

Features

  • Workout tracking: create, edit, and review workouts and their exercises.
  • Natural-language import: describe one or more past workouts and have AI extract structured workout data for review and storage.
  • Personal training objective: add or update a short objective that guides future coaching.
  • AI-generated routines: generate a structured, one-day routine using the user's training objective (or profile goal when no objective is set), recent workouts, and current training state.
  • Training memory: maintain a concise coaching summary covering priorities, progression focus, recovery, strategy, and next steps. It is refreshed when a workout is recorded or the training objective changes.
  • Dashboard: review recent workout dates, training summaries, progress information, and the latest AI recommendation.
  • Exercise catalog: normalize and classify exercises to support consistent workout history and muscle-group summaries.
  • Authentication and access control: protect user-specific pages and data with Clerk.
  • Progressive Web App support: includes a web app manifest and optional web push notifications.

How the AI context works

The routine-generation endpoint assembles its prompt on the server from the user's current training objective (or profile goal when no objective is set), the latest persisted training state, and up to ten recent workouts. The training-state generator uses the objective, previous state, and recent workout history to produce a concise coaching summary. The app validates structured AI outputs before storing or returning them.

This state is a coaching-memory summary, not a replacement for the underlying workout records. The AI endpoints do not accept arbitrary database access; workout and objective data are loaded by the application server for the authenticated user.

Technology stack

Getting started

Prerequisites

  • Node.js 20.9 or newer
  • pnpm
  • PostgreSQL 15 or a compatible PostgreSQL service
  • Clerk application keys
  • Google Generative AI API key
  • Vercel KV / Upstash REST credentials for endpoints that use the KV client

Docker Compose is provided for local PostgreSQL and Redis services. The application uses the Vercel KV REST client (@vercel/kv); a plain Redis REDIS_URL by itself does not configure that client. Use Vercel KV or compatible Upstash REST credentials for the app's KV integration.

1. Install dependencies

pnpm install

2. Configure environment variables

Copy .env.example to .env.local and fill in the values for your environment. Do not commit .env.local or any other file containing secrets.

Variable(s) Purpose
POSTGRES_URL PostgreSQL connection string used by Drizzle and database scripts. Include the schema=fawredd_gym query parameter.
POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_PORT Credentials and port used by the Docker Compose PostgreSQL service.
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY, CLERK_SECRET_KEY Clerk authentication.
GOOGLE_GENERATIVE_AI_API_KEY Gemini calls used by AI features.
KV_REST_API_URL, KV_REST_API_TOKEN Vercel KV / Upstash REST credentials used by @vercel/kv. Set these in your local environment and deployment environment.
OPENROUTER_API_KEY Used by the exercise reclassification script.
NEXT_PUBLIC_APP_URL Optional canonical site URL; useful for local or custom-domain configuration.
NEXT_PUBLIC_VAPID_PUBLIC_KEY, VAPID_PRIVATE_KEY Optional Web Push keys. Push notifications are disabled when valid keys are not configured.
GOOGLE_SITE_VERIFICATION Optional Google Search Console verification token.

For local development, a PostgreSQL URL can use this format:

POSTGRES_URL=postgres://fawredd:change_me@localhost:5432/fawredd_gym?schema=fawredd_gym

If you want to run the database and Redis through Docker Compose, also copy .env.example to .env and set the POSTGRES_* values in that file. Compose reads .env, while the database scripts prefer .env.local when both files exist.

3. Start local services (optional)

With Docker Desktop running and .env configured:

docker compose up -d db redis

The PostgreSQL container initializes the fawredd_gym schema on first startup. The database initialization script can also create it explicitly:

pnpm db:init

4. Apply the database schema

For a new or updated local database, push the Drizzle schema:

pnpm db:push

The project also provides pnpm db:generate, pnpm db:migrate, pnpm db:introspect, and pnpm db:studio for migration generation, applying migrations, schema introspection, and opening Drizzle Studio.

5. Run the app

pnpm dev

Open http://localhost:3000. Sign-in, AI features, and database-backed pages require valid credentials and services configured in the environment.

Available scripts

Command Description
pnpm dev Start the Next.js development server.
pnpm build Create a production build.
pnpm start Serve the production build.
pnpm lint Run ESLint.
pnpm db:init Create the fawredd_gym PostgreSQL schema if it does not exist.
pnpm db:push Push the Drizzle schema to the configured database.
pnpm db:generate Generate Drizzle migrations.
pnpm db:migrate Apply generated Drizzle migrations.
pnpm db:studio Open Drizzle Studio.
pnpm db:introspect Introspect the configured database.
pnpm db:push-force Force-push the Drizzle schema; use with care.

There is no pnpm test script configured in package.json at this time.

Project structure

app/
  api/                 Route handlers for AI, objectives, workouts, and exercises
  dashboard/           Authenticated dashboard
  entrenamientos/      Workout creation, editing, and objective screens
components/
  dashboard/           Dashboard UI
  entrenamientos/      Workout UI
  ui/                  Shared UI primitives
db/
  schema.ts            Drizzle tables and relations
  migrations/          Generated database migrations
lib/
  schemas/             Input and AI-output validation schemas
  training-state-utils.ts
  workouts-utils.ts    Workout persistence and AI context helpers
scripts/               Database and maintenance scripts

Deployment

The app is designed to deploy on Vercel. Configure the production PostgreSQL connection, Clerk keys, Google Generative AI API key, and Vercel KV credentials in the Vercel project environment settings. Add Web Push keys and Google Search Console verification only if those features are enabled.

For SEO, the canonical origin uses the Vercel production project URL when available, falling back to the deployment URL. Set NEXT_PUBLIC_APP_URL only when you need to specify a custom canonical domain. After deployment, verify ownership in Google Search Console, submit https://your-domain/sitemap.xml, and request indexing as needed. Search rankings and sitelinks are determined by search engines and are not guaranteed.

Contributing

  1. Create a branch for your change.
  2. Install dependencies with pnpm install.
  3. Configure the required environment variables and services.
  4. Run pnpm lint and pnpm build before opening a pull request.
  5. Keep changes focused and avoid committing credentials or local environment files.

About

02-Mobile-first AI web app for gym training. This project reflects my focus on translating real user needs into practical digital solutions. Includes VS Code + Antigravity AI agents team orchestration.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages