Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
329ce35
Update .gitignore to include .env.schema, and add varlock dependency …
nealhorner Apr 26, 2026
47bdd36
Add .env.schema file for environment variable specifications, includi…
nealhorner Apr 26, 2026
01dc9f6
Update .gitignore to include .env.local and env.d.ts for better envir…
nealhorner May 3, 2026
561b881
Update .env.schema to define APP_ENV and add optional database URLs f…
nealhorner May 3, 2026
6487a1d
Update package.json description and add better-auth dependencies in p…
nealhorner May 3, 2026
d8e686a
Update cSpell configuration to include 'varlock' in the list of recog…
nealhorner May 3, 2026
0e1c671
Refactor Prisma configuration for SQLite and Postgres
nealhorner May 3, 2026
02f3ef6
Update package dependencies and enhance README with server environmen…
nealhorner May 3, 2026
dafb588
Rename DATABASE_URL to POSTGRES_DATABASE_URL in CI workflow for clarity
nealhorner May 3, 2026
e84f8af
Refactor database connection handling to use POSTGRES_DATABASE_URL an…
nealhorner May 3, 2026
a1c0629
Auth and onboarding end2end test
nealhorner May 3, 2026
eb529b8
Reformated code
nealhorner May 3, 2026
1d16f5e
Fix user creation logic in seed script to use appUser model and inclu…
nealhorner May 3, 2026
6d3898f
Reformated seed script
nealhorner May 3, 2026
a0bfdc0
Update random name generation logic with better randomness and expand…
nealhorner May 3, 2026
ca97d4b
Add TCP connection readiness check for sidecar server
nealhorner May 3, 2026
04941de
Enhance remote session guard with error handling for /me request
nealhorner May 3, 2026
58ac943
Add error handling for sign-in process to manage network errors
nealhorner May 3, 2026
873b7fc
Improve BETTER_AUTH_SECRET validation and logging for local-only mode
nealhorner May 3, 2026
816ee18
Add BETTER_AUTH_SECRET to Vitest configuration for enhanced authentic…
nealhorner May 3, 2026
d88a6c7
Formatted BETTER_AUTH_SECRET configuration for improved readability
nealhorner May 3, 2026
c611677
Refactor Playwright configuration to support multiple web servers and…
nealhorner May 3, 2026
89d1318
Refactor layout component to use reactive $page store for pathname ch…
nealhorner May 3, 2026
1852bec
Refactor public configuration fetching in layout component to improve…
nealhorner May 3, 2026
115afe5
Refactor guard function in layout component to streamline navigation …
nealhorner May 3, 2026
b485904
Update varlock to version 1.1.0 and integrate varlockVitePlugin in Vi…
nealhorner May 3, 2026
c684c83
Improve error handling in welcome page by adding try-catch for user f…
nealhorner May 3, 2026
bd1d472
Update CI workflow, package scripts, and configuration files; add .pr…
nealhorner May 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .env.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# This env file uses @env-spec - see https://varlock.dev/env-spec for more info
#
# @defaultRequired=infer @defaultSensitive=false
# @generateTypes(lang=ts, path=env.d.ts)
# ----------

# @type=enum(development, production)
APP_ENV=development

# Postgres
# @optional @sensitive @example="postgresql://postgres:postgres@localhost:5432/trackr"
POSTGRES_DATABASE_URL=

# SQLite
# @optional @sensitive @example="file:./.local/trackr.sqlite"
SQLITE_DATABASE_URL=


# Auth
# @required @sensitive @example="00000000000000000000000000000000"
BETTER_AUTH_SECRET=
133 changes: 96 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,12 @@ name: CI

on:
pull_request:
branches: ["main"]
push:
branches: ["main"]

jobs:
test-build:
quality:
runs-on: ubuntu-latest
# Service containers start before steps
# (e.g. PRs from forks). Must match Postgres service env below.
env:
CI_PG_PASSWORD: ${{ secrets.CI_POSTGRES_PASSWORD }}
DATABASE_URL: postgresql://postgres:${{ secrets.CI_POSTGRES_PASSWORD }}@localhost:5432/trackr_test
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: ${{ secrets.CI_POSTGRES_PASSWORD }}
POSTGRES_DB: trackr_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=5s
--health-timeout=5s
--health-retries=10

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -38,37 +18,53 @@ jobs:
node-version: 22
cache: npm

- name: Load environment variables
uses: dmno-dev/varlock-action@v1.0.1

- name: Install dependencies
run: npm ci

- name: Prisma generate (Postgres + SQLite clients)
working-directory: packages/prisma
run: npm run build

- name: Migrate and seed Postgres
working-directory: packages/prisma
run: |
npx prisma migrate deploy --config prisma.config.ts
npm run seed
- name: Check format
run: npm run format:check

- name: Lint
run: npm run lint

- name: Test
env:
RUN_INTEGRATION: "true"
run: npm run test
- name: Test (unit)
run: npm run test:unit

- name: Build (exclude desktop app on generic Linux job)
run: npx turbo build --filter=!@trackr/desktop
build_web_stack:
needs: [quality]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Playwright browsers
run: npx playwright install chromium
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: E2E (exclude desktop app on generic Linux job)
run: npx turbo e2e --filter=!@trackr/desktop
- name: Load environment variables
uses: dmno-dev/varlock-action@v1.0.1

desktop-build:
- name: Install dependencies
run: npm ci

- name: Prisma generate (Postgres + SQLite clients)
working-directory: packages/prisma
run: npm run build

- name: Build web and server
run: npx turbo build --filter=@trackr/web --filter=@trackr/server

build_desktop:
needs: [quality]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -80,6 +76,9 @@ jobs:
node-version: 22
cache: npm

- name: Load environment variables
uses: dmno-dev/varlock-action@v1.0.1

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

Expand Down Expand Up @@ -107,3 +106,63 @@ jobs:
- name: Build desktop app
working-directory: apps/desktop
run: npm run build

integration_and_e2e:
needs: [quality, build_web_stack, build_desktop]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't gate web/server tests on the desktop build.

Line 111 makes integration_and_e2e wait for build_desktop, but this job only runs server integration tests and Playwright with --filter=!@trackr/desktop. A desktop-only failure now prevents unrelated web/server validation from running.

Suggested fix
-    needs: [quality, build_web_stack, build_desktop]
+    needs: [quality, build_web_stack]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
needs: [quality, build_web_stack, build_desktop]
needs: [quality, build_web_stack]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml at line 111, The CI job integration_and_e2e is
currently blocked by build_desktop via the needs: [quality, build_web_stack,
build_desktop] entry; remove build_desktop from the needs array (so it becomes
needs: [quality, build_web_stack]) in the integration_and_e2e job definition to
avoid desktop-only failures gating web/server integration and Playwright tests.
Locate the integration_and_e2e job in the workflow and update its needs list
accordingly.

runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_PASSWORD: ${{ secrets.CI_POSTGRES_PASSWORD }}
POSTGRES_DB: trackr_test
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=5s
--health-timeout=5s
--health-retries=10

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm

- name: Load environment variables
uses: dmno-dev/varlock-action@v1.0.1

- name: Install dependencies
run: npm ci

- name: Prisma generate (Postgres + SQLite clients)
working-directory: packages/prisma
run: npm run build

- name: Migrate and seed Postgres
working-directory: packages/prisma
run: |
npx prisma migrate deploy --config prisma.config.ts
npm run seed

- name: Server integration tests (Vitest)
run: npm run test:integration

- name: Install Playwright browsers
run: npx playwright install chromium

- name: E2E (full suite)
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main') }}
run: npx turbo e2e --filter=!@trackr/desktop

- name: E2E (changed only, PR base not main)
if: github.event_name == 'pull_request' && github.event.pull_request.base.ref != 'main'
working-directory: apps/server
run: npx playwright test --only-changed=${{ github.event.pull_request.base.sha }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ packages/prisma/.local/

# Tauri
apps/desktop/src-tauri/gen/schemas/

# Environment variables
!.env.schema
.env.local
.env.*.local
env.d.ts

# Vitest Varlock coordinator → worker cache
apps/server/.vitest-cache/
6 changes: 3 additions & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
npm run format:fix

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't auto-fix in pre-commit unless you restage.

Line 1 writes formatting changes to the working tree, but this hook never adds them back to the index. The hook can pass on formatted files while the commit still contains the pre-format version.

Suggested fix
-npm run format:fix
+npm run format:check
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
npm run format:fix
npm run format:check
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.husky/pre-commit at line 1, The pre-commit hook runs "npm run format:fix"
but doesn't restage files, so commits may contain unformatted versions; update
the .husky/pre-commit hook to restage changes after formatting (e.g., run the
formatter then call git add to stage modified files) or switch to using
lint-staged so only staged files are formatted and automatically re-staged;
ensure the hook either stages formatted changes (git add) or uses lint-staged
invocation instead of only running "npm run format:fix".

npm run lint
npm run test
npm run build -- --filter=!@trackr/desktop
npm run format
npm run build:all

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep the desktop build out of the pre-commit fast path.

Line 3 runs the full monorepo build, so every commit now depends on the Rust/Tauri desktop toolchain being installed locally. That will block web/server-only contributors from committing at all.

Suggested fix
-npm run build:all
+npx turbo build --filter=@trackr/web --filter=@trackr/server
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
npm run build:all
npx turbo build --filter=@trackr/web --filter=@trackr/server
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.husky/pre-commit at line 3, The pre-commit hook currently runs the full
monorepo build via the command "npm run build:all", which forces local
Rust/Tauri toolchain installs; update the hook to skip the desktop build by
replacing "npm run build:all" with a fast build script that excludes desktop
artifacts (for example "npm run build:web" or a project-specific "npm run
build:fast" that omits Tauri/Rust), or wrap the call to only run targeted
packages; ensure the updated line in .husky/pre-commit no longer invokes "npm
run build:all" so web/server-only contributors can commit without the desktop
toolchain.

npm run test:unit
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Rust / Tauri build output (large, generated)
apps/desktop/src-tauri/target/
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"cSpell.words": ["autoincrement", "Tauri", "Trackr", "Turborepo"]
"cSpell.words": ["autoincrement", "Tauri", "Trackr", "Turborepo", "varlock"]
}
86 changes: 86 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Contributing to Trackr

Thanks for your interest in Trackr. This guide covers how to work in the monorepo, what we expect before you open a pull request, and how CI validates changes.

For environment variables, database setup, and day-to-day dev commands, start with the [README](README.md) — especially **Local development**, **Database and Prisma**, and **End-to-end tests**.

## Prerequisites

- **Node.js** 22 or newer (LTS recommended)
- **npm** — the repo pins a version in the root `package.json` (`packageManager`); use [Corepack](https://nodejs.org/api/corepack.html) if you want npm to match automatically
- **PostgreSQL** — required for server development, integration tests, and most E2E flows
- **Desktop / Tauri** — Rust stable toolchain and platform libraries when you work on `apps/desktop` (see CI’s `desktop-build` job for Linux packages)

## Getting started

From the repository root:

```bash
npm install
```

Match CI more closely (clean install from the lockfile):

```bash
npm ci
```

Generate Prisma clients before running server or tests that touch the database:

```bash
npm run build -w @trackr/prisma
```

Apply migrations and seed a dev database when you need auth and sample data (see README for `POSTGRES_DATABASE_URL`):

```bash
npm run migrate:dev -w @trackr/prisma # or migrate:deploy in CI-like environments
npm run seed -w @trackr/prisma
```

Use workspace-scoped scripts when you only need one app, for example:

```bash
npm run dev -w @trackr/server
npm run dev -w @trackr/web
```

## Quality checks (run locally)

Run these from the **repo root** before opening a PR:

| Command | Purpose |
| ---------------------- | ------------------------------------------------------ |
| `npm run format` | Apply Prettier |
| `npm run check-format` | Verify formatting (also enforced via Husky pre-commit) |
| `npm run lint` | Turborepo lint across packages |
| `npm run test` | Unit / Vitest tasks |
| `npm run build` | Production builds (see CI note for desktop on Linux) |

**Integration tests** for the server need a real Postgres database and:

```bash
RUN_INTEGRATION=true npm run test -w @trackr/server
```

**E2E (Playwright):** install Chromium once (`npx playwright install chromium`), build the server if `dist/` is missing, then use the README’s E2E section. Onboarding E2E resets the database — use a disposable dev DB. Root shortcuts: `npm run e2e`, `npm run dev:e2e`, `npm run dev:e2e-desktop`.

## Pull requests

- **Target branch:** `main`
- **Describe the change** in the PR: what problem it solves and any trade-offs
- **Keep scope focused** — unrelated refactors make review harder
- **Update tests** when behavior changes; add coverage when it prevents regressions

CI (`.github/workflows/ci.yml`) runs on pushes and PRs to `main`: `npm ci`, Prisma generate, migrate + seed, lint, tests with `RUN_INTEGRATION=true`, Turbo build (desktop excluded on the generic Linux job), then E2E (desktop excluded on that job). A separate job builds the desktop app with Rust and Tauri dependencies.

Maintainers: configure the **`CI_POSTGRES_PASSWORD`** repository secret as described in the README so the Postgres service uses a strong password. Fork PRs use a documented fallback in the workflow.

## Issues and discussion

- **Bugs and features:** [GitHub Issues](https://github.com/nealhorner/trackr/issues)
- **Repository:** [github.com/nealhorner/trackr](https://github.com/nealhorner/trackr)

## License

Trackr is distributed under the terms in [LICENSE](LICENSE). Read that file before redistributing or relying on permission to modify the software; contribution and use may be limited by those terms.
Loading
Loading