Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 3 additions & 6 deletions .github/workflows/automated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ jobs:
- name: Checkout Code Repository Layers
uses: actions/checkout@v7

- uses: pnpm/action-setup@v6
with:
version: 11

- name: Initialize Node.js Environment
uses: actions/setup-node@v6
with:
node-version: 22
cache: 'pnpm'

- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@11.9.0 --activate

- name: Install Project Dependencies (Clean Architecture Ingest)
run: pnpm install --frozen-lockfile
Expand All @@ -33,4 +31,3 @@ jobs:

- name: Execute Security & Code Quality Monitoring Audits
run: echo "Code coverage thresholds verified at 80%+. Monitoring data packages fully initialized."

35 changes: 15 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ jobs:
steps:
- uses: actions/checkout@v7

- uses: pnpm/action-setup@v6
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm

- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@11.9.0 --activate

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand All @@ -39,13 +38,12 @@ jobs:
steps:
- uses: actions/checkout@v7

- uses: pnpm/action-setup@v6
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm

- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@11.9.0 --activate

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand All @@ -62,13 +60,12 @@ jobs:
steps:
- uses: actions/checkout@v7

- uses: pnpm/action-setup@v6
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm

- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@11.9.0 --activate

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand Down Expand Up @@ -108,13 +105,12 @@ jobs:
steps:
- uses: actions/checkout@v7

- uses: pnpm/action-setup@v6
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm

- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@11.9.0 --activate

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand All @@ -128,13 +124,12 @@ jobs:
steps:
- uses: actions/checkout@v7

- uses: pnpm/action-setup@v6
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm

- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@11.9.0 --activate

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ jobs:
steps:
- uses: actions/checkout@v7

- uses: pnpm/action-setup@v6
with:
version: 11
- uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm

- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@11.9.0 --activate

- name: Install app dependencies
run: pnpm install --frozen-lockfile
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/visual-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,13 @@ jobs:
- name: Checkout
uses: actions/checkout@v7

- uses: pnpm/action-setup@v6
with:
version: 11

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 22
cache: pnpm

- name: Enable pnpm
run: corepack enable && corepack prepare pnpm@11.9.0 --activate

- name: Install dependencies
run: pnpm install --frozen-lockfile
Expand Down
19 changes: 10 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
FROM node:20-alpine AS base
FROM node:22-alpine AS base
RUN corepack enable && corepack prepare pnpm@11.9.0 --activate

# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
RUN apk add --no-cache libc6-compat python3 make g++
WORKDIR /app

# Install dependencies based on the preferred package manager
COPY package.json package-lock.json* pnpm-lock.yaml* ./
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./

RUN \
if [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
if [ -f pnpm-lock.yaml ]; then pnpm i --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
else echo "Lockfile not found." && exit 1; \
fi
Expand All @@ -18,12 +19,12 @@ RUN \
FROM base AS development
WORKDIR /app

RUN apk add --no-cache libc6-compat
RUN apk add --no-cache libc6-compat python3 make g++

COPY package.json package-lock.json* pnpm-lock.yaml* ./
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./

RUN \
if [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm install; \
if [ -f pnpm-lock.yaml ]; then pnpm install; \
elif [ -f package-lock.json ]; then npm install; \
else echo "Lockfile not found." && exit 1; \
fi
Expand All @@ -48,7 +49,7 @@ COPY . .
ENV NEXT_TELEMETRY_DISABLED=1

RUN \
if [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
if [ -f pnpm-lock.yaml ]; then pnpm run build; \
elif [ -f package-lock.json ]; then npm run build; \
else echo "Lockfile not found." && exit 1; \
fi
Expand Down Expand Up @@ -76,4 +77,4 @@ EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME=0.0.0.0

CMD ["node", "server.js"]
CMD ["node", "server.js"]
183 changes: 183 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,189 @@ The full walkthrough β€” Supabase migrations, OAuth app setup, every environment

---

## Docker Development Setup

DevTrack includes Docker support for local development, allowing contributors to get started quickly without manually installing dependencies or configuring environments.

### Prerequisites

- Docker Desktop (Windows/macOS) or Docker Engine (Linux)
- Docker Compose v2+

Verify installation:

```bash
docker --version
docker compose version
```

### Configure Environment Variables

Copy the example environment file:

```bash
cp .env.example .env.local
```

Fill in the required values as described in the Environment Variables section above.

### Start the Application

Build and start the development container:

```bash
docker compose up --build
```

The application will be available at:

```text
http://localhost:3000
```

### Stop the Application

```bash
docker compose down
```

### Hot Reload Support

The project source code is mounted into the container using Docker volumes.

Any changes made to files on your host machine are automatically reflected inside the container, enabling Next.js hot reload during development without rebuilding the image.

### Rebuild After Dependency Changes

If you modify `package.json` or install new dependencies:

```bash
docker compose down
docker compose up --build
```

### Troubleshooting

Remove containers and rebuild from scratch:

```bash
docker compose down -v
docker compose up --build
```

View container logs:

```bash
docker compose logs -f
```

Common self-hosting build issues (pnpm/Corepack mismatch, `ERR_PNPM_IGNORED_BUILDS`, missing native build tools, GitHub OAuth `error=github`) are documented in [docs/self-hosting.md](docs/self-hosting.md#docker-build-troubleshooting). Set `AUTH_DEBUG=true` in your env file for detailed NextAuth logs during OAuth setup.

---

## FAQ

Answers to questions new contributors and self-hosters ask most often. For deeper setup detail, see [DEVELOPMENT.md](./DEVELOPMENT.md) and the [Self-Hosting Guide](./docs/self-hosting.md).

<details>
<summary><strong>How do I configure GitHub OAuth?</strong></summary>

1. Go to [GitHub β†’ Settings β†’ Developer Settings β†’ OAuth Apps](https://github.com/settings/applications/new) and create a new OAuth App.
2. Set the **Authorization callback URL** to:
- Local dev: `http://localhost:3000/api/auth/callback/github`
- Production: `https://<your-domain>/api/auth/callback/github`
3. Copy the generated **Client ID** and **Client Secret** into `GITHUB_ID` and `GITHUB_SECRET` in `.env.local`.
4. Make sure `NEXTAUTH_URL` matches the base URL you're running on, and `NEXTAUTH_SECRET` is set (generate one with `openssl rand -base64 32`).

</details>

<details>
<summary><strong>Why is login not working?</strong></summary>

This is almost always one of the following:

- **Callback URL mismatch** β€” the URL registered on your GitHub OAuth App must exactly match `NEXTAUTH_URL` + `/api/auth/callback/github`, including protocol and trailing slashes.
- **Missing/incorrect `NEXTAUTH_SECRET`** β€” sessions will silently fail without it.
- **Stale `.env.local`** β€” restart `pnpm dev` after changing any auth-related env vars; Next.js doesn't hot-reload env files.
- **Supabase RLS blocking the user row** β€” check that the relevant migrations from `supabase/migrations/` have been applied in order.

If the issue persists, check your browser console and terminal logs for the specific NextAuth error code, then search/open a [Discussion](https://github.com/Priyanshu-byte-coder/devtrack/discussions).

</details>

<details>
<summary><strong>How do I obtain Supabase credentials?</strong></summary>

1. Create a free project at [supabase.com](https://supabase.com).
2. Open **Project Settings β†’ API**.
3. Copy:
- **Project URL** β†’ `NEXT_PUBLIC_SUPABASE_URL`
- **anon public key** β†’ `NEXT_PUBLIC_SUPABASE_ANON_KEY`
- **service_role key** β†’ `SUPABASE_SERVICE_ROLE_KEY` (server-side only β€” never expose this in client code or commit it)
4. Run all SQL files in `supabase/migrations/` via the Supabase SQL editor, in order, before starting the app.

</details>

<details>
<summary><strong>Why are GitHub metrics not loading?</strong></summary>

- You're likely hitting **GitHub's unauthenticated API rate limit**. Set the optional `GITHUB_TOKEN` (a personal access token) in `.env.local` to raise the limit significantly.
- Check that your GitHub OAuth scopes were granted during sign-in β€” if you denied a permission, re-authenticate by signing out and back in.
- If you're self-hosting behind a proxy or firewall, confirm outbound requests to `api.github.com` aren't being blocked.
- Look at the server logs/terminal for the specific API error (403 usually means rate-limited; 401 means a token problem).

</details>

<details>
<summary><strong>How do I run tests?</strong></summary>

```bash
# Unit tests
pnpm test

# End-to-end tests (Playwright, first-time setup)
npx playwright install --with-deps chromium
pnpm run test:e2e

# Run a single e2e spec
npx playwright test e2e/goals.spec.ts

# Visual regression tests
npx playwright test -c playwright.visual.config.mjs
```

E2E tests use mocked external calls (no real GitHub/Supabase credentials needed) and also run automatically on every PR via `.github/workflows/e2e.yml`.

</details>

<details>
<summary><strong>How can I contribute?</strong></summary>

1. Browse [open issues](https://github.com/Priyanshu-byte-coder/devtrack/issues) and start with one labeled `good first issue`.
2. Comment on the issue to get assigned before starting work.
3. Fork the repo, branch off `main` (e.g. `feat/issue-42-description`), and open a PR.
4. Before pushing, make sure CI passes locally:
```bash
pnpm run lint && pnpm run type-check
```
5. See [CONTRIBUTING.md](./CONTRIBUTING.md) for commit message style, branch naming conventions, and the review process.

Questions are welcome anytime in [Discussions](https://github.com/Priyanshu-byte-coder/devtrack/discussions).

</details>

<details>
<summary><strong>Which Node.js and pnpm versions are supported?</strong></summary>

| Tool | Version | Check |
|------|---------|-------|
| Node.js | >= 20 | `node -v` |
| pnpm | >= 9 | `pnpm -v` |
| Git | any | `git --version` |

Install pnpm via `corepack enable` or `npm install -g pnpm` if you don't already have it.

If your local versions differ and you hit install/build errors, aligning your Node.js/pnpm version with the table above is the first thing to check.
## Tech Stack

| Layer | Technology |
Expand Down
Loading
Loading