Skip to content

Commit b30ba9a

Browse files
authored
Merge pull request #1 from prazgaitis/fixes
Add private challenges with invitation-only access
2 parents 751cafc + 15791cd commit b30ba9a

70 files changed

Lines changed: 1429 additions & 1747 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.env.example

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Database
2-
DATABASE_URL="postgresql://username:password@host:port/database"
3-
TEST_DATABASE_URL="postgresql://username:password@host:port/test_database" # Optional: override database used in tests
4-
51
# Better Auth
62
BETTER_AUTH_SECRET="generate-a-long-secret"
73
BETTER_AUTH_URL="http://localhost:3000"
@@ -11,14 +7,9 @@ NEXT_PUBLIC_BETTER_AUTH_URL="http://localhost:3000/api/auth"
117
GOOGLE_CLIENT_ID="your-google-client-id"
128
GOOGLE_CLIENT_SECRET="your-google-client-secret"
139

14-
# Convex (hosted)
15-
NEXT_PUBLIC_CONVEX_URL="https://your-project.convex.cloud"
16-
NEXT_PUBLIC_CONVEX_SITE_URL="https://your-project.convex.site"
17-
CONVEX_DEPLOY_KEY="prod:your-project|your-deploy-key" # For CI/CD deployments
18-
19-
# Convex (local Docker - optional, for dev:local)
20-
# CONVEX_SELF_HOSTED_URL="http://127.0.0.1:3210"
21-
# CONVEX_SELF_HOSTED_ADMIN_KEY="local-dev|01e5f753250a1fe22c9ff160b4a610060943bc2cf0e75c6c4d559484660548843bded7168d8eee5b454c255adda9e1d942"
10+
# Convex (local Docker)
11+
CONVEX_SELF_HOSTED_URL="http://127.0.0.1:3210"
12+
CONVEX_SELF_HOSTED_ADMIN_KEY="local-dev|01e5f753250a1fe22c9ff160b4a610060943bc2cf0e75c6c4d559484660548843bded7168d8eee5b454c255adda9e1d942"
2213

2314
# App URLs
2415
NEXT_PUBLIC_APP_URL="http://localhost:3000"

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ node_modules/
55
# Environment variables
66
.env
77
.env.local
8+
.env.production
89
.env.development.local
910
.env.test.local
1011
.env.production.local
@@ -53,6 +54,9 @@ packages/backend/.env.local
5354
packages/backend/.env
5455
packages/backend/.env.local.self-hosted
5556

57+
# Admin tools (local-only scripts, not open-sourced)
58+
admin-tools/
59+
5660
# Misc
5761
coverage/
5862
.nyc_output/

.husky/pre-commit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pnpm precommit

AGENTS.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Instructions for AI code agents (OpenAI Codex, Claude Code, etc.) working on thi
77
This is a fitness challenge platform with:
88
- **Frontend**: Next.js 15 app in `apps/web/`
99
- **Backend**: Convex serverless functions in `packages/backend/`
10-
- **Auth**: Currently Clerk, migrating to Better Auth
10+
- **Auth**: Better Auth via `@convex-dev/better-auth`
1111

1212
## Development Process
1313

@@ -188,24 +188,6 @@ await t.run(async (ctx) => {
188188

189189
convex-test is a mock - always manually test against real Convex before shipping.
190190

191-
## Better Auth Migration
192-
193-
### Current State
194-
- Toggle: `NEXT_PUBLIC_AUTH_PROVIDER` (clerk | better-auth)
195-
- Clerk is default, Better Auth is opt-in
196-
197-
### Key Files
198-
- `apps/web/lib/auth-config.ts` - Provider detection
199-
- `apps/web/lib/better-auth/client.ts` - Better Auth client
200-
- `apps/web/components/providers/auth-provider.tsx` - Auth context
201-
- `apps/web/components/providers/convex-provider.tsx` - Convex + auth
202-
203-
### Migration Tasks
204-
1. Implement Better Auth server endpoints in `apps/web/app/api/auth/`
205-
2. Add user sync from Better Auth to Convex
206-
3. Update Convex functions to work with Better Auth tokens
207-
4. Test both auth flows
208-
209191
## Environment Setup
210192

211193
```bash

CLAUDE.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ Start by adding a new markdown file in the top level /tasks directory. The file
88

99
## Development Commands
1010

11-
**Start development server (uses hosted Convex):**
11+
**Start development server (defaults to self-hosted Convex):**
1212
```bash
1313
pnpm dev
1414
```
1515

16-
**Start development server (fully local with Docker):**
16+
**Self-hosted Convex setup (Docker):**
1717
```bash
1818
# First time setup (one-time GitHub auth for Docker images):
1919
gh auth token | docker login ghcr.io -u YOUR_USERNAME --password-stdin
2020
pnpm convex:start # Start local Convex Docker containers
21-
pnpm convex:admin-key # Generate admin key, copy to packages/backend/.env.local.self-hosted
21+
pnpm convex:admin-key # Generate admin key, copy to root .env.local as CONVEX_SELF_HOSTED_ADMIN_KEY
2222

23-
# Then run:
24-
pnpm dev:local # Runs Next.js + Convex against local Docker
23+
# Then run (or just pnpm dev):
24+
pnpm dev # Runs Next.js + Convex against local Docker
2525

2626
# Other local Convex commands:
2727
pnpm convex:stop # Stop local Convex containers
2828
pnpm convex:logs # View Convex container logs
29-
pnpm -F backend seed:local # Seed local Convex database
29+
pnpm -F backend seed # Seed local Convex database
3030
```
3131

3232
**Local Convex endpoints:**
@@ -68,18 +68,8 @@ npx convex data <table> --prod
6868

6969
**Testing:**
7070
```bash
71-
# Setup local test database (first time)
72-
pnpm test:setup
73-
cd packages/database && DATABASE_URL=postgresql://test:test@localhost:5433/test_db pnpm db:push
74-
75-
# Run tests (local)
76-
pnpm test:local --run
77-
78-
# Run tests (force Neon branches)
79-
pnpm test:integration --run
80-
81-
# Cleanup
82-
pnpm test:teardown
71+
# Run tests
72+
pnpm test -- --run
8373
```
8474

8575
**Install shadcn components (run from `apps/web`):**

0 commit comments

Comments
 (0)