Macro Tracker is an AGPLv3 nutrition and macro tracking application designed for self-hosting.
The backend uses SQLite with local authentication and billing disabled by default.
This project is licensed under the GNU Affero General Public License v3.0.
See LICENSE.
APP_MODE=self-hostedAUTH_MODE=localBILLING_MODE=disabled
Expected behavior:
- Local auth routes enabled (
/api/auth/*local endpoints) - Session transport via
mt_sessionsecure cookie + DB-backed sessions - Billing routes unmounted (
404by absence) - Billing UI hidden
Backend canonical variables:
ANALYTICS_MODE,EMAIL_MODEAPP_URL,PUBLIC_APP_NAME,SUPPORT_EMAILENABLE_METRICS
Frontend optional branding/public link variables:
VITE_APP_URLVITE_PUBLIC_APP_NAMEVITE_SUPPORT_EMAILVITE_GITHUB_REPO_URLVITE_DOCS_URL
Provider env vars are only required when corresponding modes are enabled:
- PostHog keys only when
ANALYTICS_MODE=posthog - Resend/SMTP keys only when
EMAIL_MODE=resend|smtp
Reference templates:
backend/.env.examplefrontend/.env.example
bun install
cp backend/.env.example backend/.env.development
cp frontend/.env.example frontend/.env.development
bun run devUseful scripts:
bun run dev:backend
bun run dev:frontend
bun run --cwd backend test
bun run --cwd frontend test
bun run typecheck
bun run lintThis repository includes a self-host starter compose stack.
mkdir -p data
docker compose pull
docker compose up -dThe default compose file uses prebuilt GHCR images in local-auth mode (VITE_AUTH_MODE=local),
so no Clerk publishable key is required for self-hosted deployments.
It also uses same-origin API requests (/api) through nginx proxying, so clients do not
need to reach backend on localhost.
Services:
- frontend:
http://localhost:5173(Mapped to internal container port 80) - backend API:
http://localhost:3000(Direct access usually not needed since frontend proxies/api)
The SQLite database is persisted at ./data/macrotrackr.db.
docker compose -f docker-compose.yml -f docker-compose.build.yml up --buildThis mode is useful for contributors and local image customization.
- Start the stack.
- Open
http://localhost:5173/register. - Create the initial local user account.
cp data/macrotrackr.db data/macrotrackr.db.backupcp data/macrotrackr.db.backup data/macrotrackr.dbgit pull
docker compose pull
docker compose up -d- Frontend deployment guide:
frontend/docs/DEPLOYMENT.md - This public repository focuses on self-hosted deployments.
- Managed hosting infrastructure is maintained in a separate private repository.
backend/ Bun + Elysia API, SQLite schema, auth modules
frontend/ React + Vite app (local auth UI)
docs/ public project docs