Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/CodeWithCJ/SparkyFitness/llms.txt

Use this file to discover all available pages before exploring further.

Building SparkyFitness from source lets you run the application directly on your machine without Docker — useful for contributing to the codebase, experimenting with new features, or deeply customising the application. You will need Node.js, pnpm, and a local PostgreSQL instance. The backend applies database migrations and creates the limited-privilege app user automatically on first start, so the manual setup steps are minimal.

Prerequisites

  • Node.js 24 or laternodejs.org
  • pnpm — install with npm install -g pnpm
  • PostgreSQL 17 or laterpostgresql.org

Steps

1

Clone the repository

git clone https://github.com/CodeWithCJ/SparkyFitness.git
cd SparkyFitness
2

Install dependencies

Install all workspace dependencies from the repo root:
pnpm install
3

Configure environment variables

Copy the example environment file to the repo root and edit it:Linux / macOS
cp docker/.env.example .env
Windows (PowerShell)
Copy-Item docker\.env.example .env
Open .env and set the following required values:
VariableDescription
SPARKY_FITNESS_DB_HOSTPostgreSQL host — use localhost for local installs
SPARKY_FITNESS_DB_NAMEDatabase name (e.g. sparkyfitness_db)
SPARKY_FITNESS_DB_USERSuperuser for migrations (e.g. sparky)
SPARKY_FITNESS_DB_PASSWORDSuperuser password
SPARKY_FITNESS_APP_DB_USERApp user with limited privileges (e.g. sparky_app)
SPARKY_FITNESS_APP_DB_PASSWORDApp user password
SPARKY_FITNESS_FRONTEND_URLSet to http://localhost:8080 for local builds
SPARKY_FITNESS_API_ENCRYPTION_KEY64-character hex string — generate with openssl rand -hex 32
BETTER_AUTH_SECRETRandom secret for session signing — generate with openssl rand -hex 32
The default SPARKY_FITNESS_DB_HOST in the example file is set to a Docker service name (sparkyfitness-db). Change it to localhost for a local (non-Docker) install.
4

Set up PostgreSQL

Create the superuser and database that match your .env values. The limited-privilege app user (SPARKY_FITNESS_APP_DB_USER) is created automatically by the server on first startup — you do not need to create it.Linux
sudo -u postgres createuser --pwprompt sparky
sudo -u postgres createdb sparkyfitness_db --owner sparky
macOS (Homebrew) — omit the sudo -u postgres prefix if your current user already has PostgreSQL superuser rights:
createuser --pwprompt sparky
createdb sparkyfitness_db --owner sparky
Windows — open a terminal and use psql as the postgres user (adjust the path to match your PostgreSQL installation):
psql -U postgres -c "CREATE ROLE sparky WITH LOGIN PASSWORD 'yourpassword';"
psql -U postgres -c "CREATE DATABASE sparkyfitness_db OWNER sparky;"
5

Start the backend server

cd SparkyFitnessServer
pnpm start
On first run the server applies all database migrations, creates the app database user, and starts listening on port 3010. Swagger API docs are available at:
http://localhost:3010/api/api-docs/swagger
6

Start the frontend

Open a second terminal from the repo root:
cd SparkyFitnessFrontend
pnpm dev
The Vite dev server starts on port 8080. Open your browser at:
http://localhost:8080

Port Summary

ServiceDefault URL
Frontend (Vite dev server)http://localhost:8080
Backend APIhttp://localhost:3010
API Docs (Swagger)http://localhost:3010/api/api-docs/swagger

Tips for Development

  • Live reloading — the Vite frontend hot-reloads on every file save. The backend (pnpm start) does not hot-reload by default; restart it after backend changes.
  • Database migrations run automatically every time the server starts. You do not need to run them manually.
  • Environment file location — the server reads .env from the repo root, not from the SparkyFitnessServer/ subdirectory.
  • Switching to Docker — if you later want to use Docker Compose for development, the docker-helper.sh dev up command mounts the same source directories into the containers, giving you live reloading without changing your local setup. See Docker Compose for details.

Build docs developers (and LLMs) love