Skip to content
Merged
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
6 changes: 3 additions & 3 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ DB_USER=
DB_PASSWORD=
DB_NAME=
DB_HOST=
DB_PORT=
DB_PORT=19010
DATABASE_URL=

WEB_APP_URL=

# REDIS
REDIS_HOST=
REDIS_PORT=
REDIS_PORT=19011
REDIS_PASSWORD=

# TYPESENSE
TYPESENSE_HOST=
TYPESENSE_PORT=
TYPESENSE_PORT=19012
TYPESENSE_PROTOCOL=
TYPESENSE_API_KEY=

Expand Down
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,28 @@ cp .env.template .env.local
bun run start
```

### Local ports

Everything in development lives in **19000-19019**, so the repo can run alongside other
projects without colliding on 3000, 6379 or 8108. The host ports come from `.env`; the
container ports behind them are untouched, as are the defaults the deployed images use.

| Port | Service | Set in |
| ----- | -------------- | --------------------------------------- |
| 19000 | web | `apps/web/project.json` (`next dev -p`) |
| 19001 | api | `apps/api/.env` |
| 19002 | notify | `apps/notify/.env` |
| 19003 | worker | `apps/worker/.env` |
| 19004 | mobile (Metro) | `apps/mobile/project.json` |
| 19010 | postgres | `.env` (`DB_PORT`) |
| 19011 | redis | `.env` (`REDIS_PORT`) |
| 19012 | typesense | `.env` (`TYPESENSE_PORT`) |
| 19013 | s3 (rustfs) | `.env` (`S3_PORT`) |
| 19014 | s3 console | `.env` (`S3_CONSOLE_PORT`) |

Mobile needs its port pinned explicitly: `@nx/expo:start` defaults Metro to 19000, which
is the web app's port here, while `expo run:ios` and `expo run:android` default to 8081.

## 🤝 Contributing

Contributions are welcome! See [CONTRIBUTING.md](./CONTRIBUTING.md) for how to submit issues and pull requests.
Expand Down
2 changes: 1 addition & 1 deletion apps/api/.env.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PORT=9000
PORT=19001
HOST=0.0.0.0

API_URL=
Expand Down
4 changes: 2 additions & 2 deletions apps/api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@
"continuous": true,
"executor": "nx:run-commands",
"options": {
"command": "HOST=localhost bunx @modelcontextprotocol/inspector --web --transport http --server-url http://localhost:9000/mcp"
"command": "HOST=localhost bunx @modelcontextprotocol/inspector --web --transport http --server-url http://localhost:19001/mcp"
},
"configurations": {
"cli": {
"command": "HOST=localhost bunx @modelcontextprotocol/inspector --cli --transport http --server-url http://localhost:9000/mcp"
"command": "HOST=localhost bunx @modelcontextprotocol/inspector --cli --transport http --server-url http://localhost:19001/mcp"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"main": "index.js",
"private": true,
"scripts": {
"android": "expo run:android",
"ios": "expo run:ios",
"android": "expo run:android --port 19004",
"ios": "expo run:ios --port 19004",
"lint": "expo lint"
},
"dependencies": {
Expand Down
7 changes: 5 additions & 2 deletions apps/mobile/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
"command": "tsc --noEmit -p apps/mobile/tsconfig.app.json"
}
},
"start": {
"options": { "port": 19004 }
},
"dev": {
"executor": "nx:run-commands",
"options": {
Expand All @@ -26,13 +29,13 @@
"dev-ios": {
"executor": "nx:run-commands",
"options": {
"command": "APP_VARIANT=development nx run-ios mobile"
"command": "APP_VARIANT=development nx run-ios mobile --port 19004"
}
},
"dev-android": {
"executor": "nx:run-commands",
"options": {
"command": "APP_VARIANT=development nx run-android mobile"
"command": "APP_VARIANT=development nx run-android mobile --port 19004"
}
},
"prebuild": {
Expand Down
2 changes: 1 addition & 1 deletion apps/notify/.env.template
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PORT=9001
PORT=19002
HOST=0.0.0.0

ASSETS_BASE_URL=
Expand Down
2 changes: 1 addition & 1 deletion apps/web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"serve": {
"dependsOn": ["^build", "api:serve"],
"options": {
"command": "bun --bun next dev"
"command": "bun --bun next dev -p 19000"
}
},
"start": {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/lib/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ describe('getURL', () => {
NEXT_PUBLIC_VERCEL_URL: undefined,
NODE_ENV: 'development',
}),
).toBe('http://localhost:3000');
).toBe('http://localhost:19000');
});
});
2 changes: 1 addition & 1 deletion apps/web/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function toISO8601Duration(minutes: number): string {
}

const PRODUCTION_URL = 'https://recomend.app';
const DEVELOPMENT_URL = 'http://localhost:3000';
const DEVELOPMENT_URL = 'http://localhost:19000';

/**
* The site's own origin, never with a trailing slash.
Expand Down
2 changes: 1 addition & 1 deletion apps/worker/.env.template
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PORT=9002
PORT=19003
HOST=0.0.0.0
4 changes: 2 additions & 2 deletions libs/assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ it explicitly, e.g. `apps/notify/project.json`:
}
```

Locally, `${ASSETS_BASE_URL}` resolves to `http://localhost:9900/medias/static`,
so the example above resolves to `http://localhost:9900/medias/static/app/icon.png`.
Locally, `${ASSETS_BASE_URL}` resolves to `http://localhost:19013/medias/static`,
so the example above resolves to `http://localhost:19013/medias/static/app/icon.png`.

## Local dev

Expand Down
2 changes: 1 addition & 1 deletion libs/env/src/lib/env.validation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('commonSchema', () => {
const result = commonSchema.parse({});
expect(result.NODE_ENV).toBe('development');
expect(result.LOG_LEVEL).toBe('info');
expect(result.WEB_APP_URL).toBe('http://localhost:3000');
expect(result.WEB_APP_URL).toBe('http://localhost:19000');
});

it('rejects an unsupported NODE_ENV', () => {
Expand Down
2 changes: 1 addition & 1 deletion libs/env/src/lib/env.validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const extensionSchema = redisSchema;
export const commonSchema = extensionSchema.extend({
NODE_ENV: z.enum(['development', 'production', 'test']).default('development'),
LOG_LEVEL: z.enum(['debug', 'info', 'warn', 'error']).default('info'),
WEB_APP_URL: z.url().default('http://localhost:3000'),
WEB_APP_URL: z.url().default('http://localhost:19000'),
});

// Static assets served from RustFS/S3 (see libs/assets)
Expand Down