Skip to content
hyperdargoPublic

About

A web application with app for gym freaks.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

DTGym

A gym platform with an AI coach, from DTEmpire. It has a public landing page, a member website, an admin dashboard and an Android app.

  • AI coach (iAPI, Hermes). It answers from the member's real plan. A member can message it something like "only 3 chest and 3 shoulder on Sunday" and it builds a one-day workout. The workout applies only after the member taps to accept, and the trainer's plan is never edited.
  • Gym timer and streak. Members check in and out and see live session time, hours per week and month, and a 28-day calendar. Rest days on the plan never break the streak.
  • Water. One-tap glasses and a daily goal. Reminders come from the browser, or on Android from local alarms that work offline.
  • Videos per muscle part. Examples are upper chest, rear delts and glutes. Trainer-picked clips (YouTube Shorts work) come first, then a cached, quota-aware search on the backend. Videos play in the official YouTube player only.
  • Weekly body check-in (opt-in). Members can add height, birth year, goal and optional sex, and log their weight once a week. The coach then proposes a tuned next workout (sets and reps only) that applies after one tap. It never gives diet or calorie targets, and it refers fast weight changes or a low BMI to a professional. Turning it off deletes the data. The AI sees body stats only with a second opt-in, and never sees sex.
  • Open signup, no password recovery. Anyone can create a member account at /signup, after confirming that passwords can't be recovered. A gym admin can set a new password from the admin Members page. Turn signup off with SIGNUP_ENABLED=false.
  • Music. Gym-library playlists with background playback on Android (Media3).
  • Landing page. Ten interactive WebGL, canvas and CSS effects. Each one has a static fallback for reduced motion or no WebGL, and WebGL contexts are created only while their section is near the screen.
Path What
apps/backend Fastify 5 + zod API on Prisma/PostgreSQL (in-memory store for dev/tests). Every AI and YouTube Data API call happens here.
apps/web Landing page and member website (React 19 + Vite, three.js + GSAP on the landing page)
apps/admin Admin dashboard, served at /admin
packages/ui-core Shared API client, brand (logo, watermark), YouTube embed, play queue
apps/android Kotlin + Compose app (Media3 playback, water reminders)
deploy/ Server deploy script, Postgres backup script and systemd units
scripts/ serve-web.mjs (static + /api proxy + /downloads), secret-scan.mjs, probe-iapi.mjs
docs/ Plan, report, manual tests

Run locally

npm install
cp apps/backend/.env.example apps/backend/.env   # fill JWT_SECRET; keys stay in env only
cd apps/backend && SEED_PASSWORD=<pick one> npm run dev   # :4000, in-memory store unless DATABASE_URL is set
npm run dev -w apps/web      # site on :5173 (proxies /api)
npm run dev -w apps/admin    # admin dashboard

Android needs JDK 17 or 21.

cd apps/android && ./gradlew testDebugUnitTest assembleRelease -PgymApiBaseUrl=https://your.domain

Release signing reads apps/android/keystore.properties, which is gitignored. Keep the keystore outside the repo. Without that file, the release APK is unsigned.

Test

npm test                                  # backend (80% coverage gate), ui-core, web, admin
node --test scripts/secret-scan.test.mjs
npm run build && npm run scan:secrets     # scans web/admin bundles and any built APK

Deploy (home server)

There are two directories on the server:

  • ~/DTGym is this repository.
  • ~/dtgym-data holds .env (chmod 600), uploaded media in storage/, downloads/DTGym.apk and backups/.
~/DTGym/deploy/deploy.sh      # git pull, npm ci, prisma generate, build, prisma db push, restart
  • Services: the systemd user units in deploy/systemd run the API on 127.0.0.1:9878, and the site on :9879 with /admin, /api and /downloads.
  • Backups: gym-backup.timer runs deploy/backup-postgres.sh every night. It writes a pg_dump -Fc and keeps the newest 7.
  • Restore a dump with:
docker exec -i gym-postgres pg_restore -U gym -d gym --clean --if-exists < ~/dtgym-data/backups/gym-<stamp>.dump

Secrets

IAPI_API_KEY and YOUTUBE_API_KEY are read only from the backend process environment:

  • They are never stored in the database or returned by any endpoint.
  • They are never logged.
  • They are never shipped to the web, admin or Android clients.

The clients only know the backend URL. npm run scan:secrets enforces this on the built artifacts.

About

A web application with app for gym freaks.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages