Skip to content

Commit 9177cf6

Browse files
committed
chore: add portless support for easier dev
1 parent c4da164 commit 9177cf6

11 files changed

Lines changed: 38 additions & 21 deletions

File tree

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ cd refref
5555
docker-compose up
5656
```
5757

58-
That's it! 🎉 The webapp portal will be available at http://localhost:3000
58+
That's it! 🎉 The webapp portal will be available at http://localhost:3000.
5959

6060
Docker Compose automatically handles:
6161

@@ -73,6 +73,7 @@ If you prefer running RefRef locally without Docker:
7373
- Node.js 20+
7474
- pnpm 10.15.0
7575
- PostgreSQL database
76+
- [portless](https://github.com/vercel-labs/portless) (`npm install -g portless`)
7677

7778
#### Installation
7879

@@ -96,7 +97,17 @@ pnpm -F @refref/webapp db:seed
9697
pnpm dev
9798
```
9899

99-
The webapp will be available at http://localhost:3000
100+
Each app gets a stable `.localhost` URL via [portless](https://github.com/vercel-labs/portless):
101+
102+
| App | URL |
103+
| ------ | ----------------------------------- |
104+
| Webapp | http://refref-webapp.localhost:1355 |
105+
| WWW | http://refref-www.localhost:1355 |
106+
| API | http://refref-api.localhost:1355 |
107+
| Refer | http://refref-refer.localhost:1355 |
108+
| Acme | http://refref-acme.localhost:1355 |
109+
110+
> Portless is a global CLI tool (`npm install -g portless`). The proxy auto-starts when you run `pnpm dev`. To bypass portless, set `PORTLESS=0 pnpm dev`.
100111
101112
### Environment Variables
102113

@@ -109,7 +120,7 @@ The webapp will be available at http://localhost:3000
109120

110121
- `GOOGLE_CLIENT_ID` & `GOOGLE_CLIENT_SECRET` - For Google OAuth authentication
111122
- `RESEND_API_KEY` - For sending emails via Resend
112-
- `BETTER_AUTH_URL` - Authentication URL (defaults to http://localhost:3000)
123+
- `BETTER_AUTH_URL` - Authentication URL (defaults to http://refref-webapp.localhost:1355)
113124

114125
### Development Commands
115126

apps/acme/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"description": "Test application for RefRef integration testing and demos",
66
"scripts": {
7-
"dev": "next dev --port 3003",
7+
"dev": "portless refref-acme -- next dev",
88
"build": "next build",
99
"start": "next start --port 3003"
1010
},

apps/api/.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ LOG_LEVEL=info
88
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/refref"
99

1010
# Referral Configuration
11-
REFERRAL_HOST_URL="http://localhost:3002"
11+
# With portless: http://refref-refer.localhost:1355 | Without: http://localhost:3002
12+
REFERRAL_HOST_URL="http://refref-refer.localhost:1355"

apps/api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"dev": "infisical run --env=dev -- tsx watch src/index.ts || tsx watch src/index.ts",
7+
"dev": "portless refref-api -- infisical run --env=dev -- tsx watch src/index.ts || portless refref-api -- tsx watch src/index.ts",
88
"build": "tsc",
99
"start": "node dist/index.js",
1010
"test": "infisical run --env=dev -- vitest run || vitest run",

apps/e2e/.env.example

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ TEST_PREFIX=e2e_test_ # Prefix for all test data
55
CLEANUP_ON_FAILURE=false # Clean up test data even on failure
66
VIDEO_ON_FAILURE=true # Record video on test failure
77

8-
# Server URLs
9-
WEBAPP_URL=http://localhost:3000
10-
API_URL=http://localhost:3001
11-
REFER_URL=http://localhost:3002
12-
ACME_URL=http://localhost:3003
8+
# Server URLs (portless)
9+
WEBAPP_URL=http://refref-webapp.localhost:1355
10+
API_URL=http://refref-api.localhost:1355
11+
REFER_URL=http://refref-refer.localhost:1355
12+
ACME_URL=http://refref-acme.localhost:1355
1313
ASSETS_URL=http://localhost:8787
1414

1515
# Database (already set up locally, will be seeded as needed)
@@ -33,7 +33,7 @@ REFEREE_EMAIL=jane.smith@example.com
3333

3434
# Better Auth (for test user creation)
3535
BETTER_AUTH_SECRET=test-auth-secret-for-e2e
36-
BETTER_AUTH_URL=http://localhost:3000
36+
BETTER_AUTH_URL=http://refref-webapp.localhost:1355
3737

3838
# Safety Flags
3939
DRY_RUN=false # Run in dry-run mode (no actual changes)

apps/refer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"dev": "infisical run --env=dev -- tsx watch src/index.ts || tsx watch src/index.ts",
7+
"dev": "portless refref-refer -- infisical run --env=dev -- tsx watch src/index.ts || portless refref-refer -- tsx watch src/index.ts",
88
"build": "tsc",
99
"start": "node dist/index.js",
1010
"test": "infisical run --env=dev -- vitest run || vitest run",

apps/webapp/.env.example

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,14 @@ DATABASE_URL="postgresql://postgres:postgres@localhost:5432/refref"
1313
BETTER_AUTH_SECRET="your-secret-key-here-change-in-production"
1414

1515
# Authentication URL (OPTIONAL)
16-
# The URL where Better Auth is hosted (defaults to http://localhost:3000)
17-
BETTER_AUTH_URL="http://localhost:3000"
16+
# The URL where Better Auth is hosted
17+
# With portless: http://refref-webapp.localhost:1355 | Without: http://localhost:3000
18+
BETTER_AUTH_URL="http://refref-webapp.localhost:1355"
1819

1920
# Application URL (OPTIONAL)
2021
# The public URL of your application
21-
NEXT_PUBLIC_APP_URL="http://localhost:3000"
22+
# With portless: http://refref-webapp.localhost:1355 | Without: http://localhost:3000
23+
NEXT_PUBLIC_APP_URL="http://refref-webapp.localhost:1355"
2224

2325
# Google OAuth (OPTIONAL)
2426
# Required only if you want to enable Google sign-in
@@ -49,6 +51,6 @@ NEXT_PUBLIC_POSTHOG_ENABLED="true"
4951

5052
# External Services (OPTIONAL)
5153
# URL of the assets CDN for loading widget and attribution scripts
52-
# In development: http://localhost:3002 (refer server serves scripts dynamically)
54+
# In development: http://refref-refer.localhost:1355 (refer server serves scripts dynamically)
5355
# In production: https://assets.refref.ai (Cloudflare Pages CDN)
54-
NEXT_PUBLIC_ASSETS_URL="http://localhost:3002"
56+
NEXT_PUBLIC_ASSETS_URL="http://refref-refer.localhost:1355"

apps/webapp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"db:push": "pnpm -F @refref/coredb db:push",
1212
"db:studio": "pnpm -F @refref/coredb db:studio",
1313
"db:seed": "pnpm -F @refref/coredb db:seed",
14-
"dev": "infisical run --env=dev -- next dev --turbo || next dev --turbo",
14+
"dev": "portless refref-webapp -- infisical run --env=dev -- next dev --turbo || portless refref-webapp -- next dev --turbo",
1515
"format:check": "prettier --check \"**/*.{ts,tsx,js,jsx,mdx}\" --cache",
1616
"format:write": "prettier --write \"**/*.{ts,tsx,js,jsx,mdx}\" --cache",
1717
"lint": "next lint",

apps/www/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"build": "pnpm fetch-content && pnpm build:docs && pnpm lint && next build && pnpm build:sitemap",
77
"build:sitemap": "pnpm exec tsx ./scripts/generate-sitemap.mts",
88
"build:docs": "node ./scripts/generate-docs.mjs",
9-
"dev": "infisical run --env=dev -- next dev || next dev",
9+
"dev": "portless refref-www -- infisical run --env=dev -- next dev || portless refref-www -- next dev",
1010
"start": "next start",
1111
"postinstall": "fumadocs-mdx",
1212
"serve": "serve out -p 3000",

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
"scripts": {
55
"build": "turbo run build",
66
"dev": "infisical run --env=dev -- turbo run dev || turbo run dev",
7+
"portless:list": "portless list",
8+
"portless:proxy": "portless proxy start",
79
"lint": "turbo run lint",
810
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
911
"type:check": "turbo run type:check",

0 commit comments

Comments
 (0)