Public sharing for Codex chats.
apps/web: Next.js App Router public viewer with OG metadata and image previewsapps/api: Hono API for create, update, read, and revokepackages/cli: Node CLI for one-off shares, live tracking, and session monitoringpackages/shared: session resolution, parsing, redaction, hashing, and shared typespackages/db: Drizzle schema plus repository implementations for Postgres and in-memory tests
- Node
22 pnpm- Postgres compatible with Neon
Copy .env.example and set the values you need.
DATABASE_URL: required by the API in Postgres mode and by Drizzle toolingSITE_URL: public site root used by the API and web metadataAPI_BASE_URL: web app target for share fetchesCODEXLINK_API_URL: CLI target for uploads and revokesCODEX_HOME: optional override for the Codex local data directoryCODEXLINK_STATE_DIR: optional override for CLI tracking state
pnpm install
pnpm typecheck
pnpm testApply the generated Drizzle migration before starting the API against Neon:
pnpm --filter @codexlink/db migrateRun the API and web app in separate terminals:
pnpm --filter @codexlink/api dev
pnpm --filter @codexlink/web devBuild everything:
pnpm buildThis repo deploys as two Railway services:
apps/api: Hono API, plus the pre-deploy migration stepapps/web: Next.js public viewer
Each service has its own config:
Recommended setup:
- Import the monorepo into Railway and create two services from it.
- Leave each service
Root Directoryset to the repository root/. - Point the API service config file at apps/api/railway.json using the absolute repo path
/apps/api/railway.json. - Point the web service config file at apps/web/railway.json using the absolute repo path
/apps/web/railway.json. - Give the API service a public domain only if you want direct public API access.
- Attach your custom domain, such as
codexl.ink, to the web service.
Important:
- Railway auto-import for JavaScript monorepos may treat
apps/apiandapps/webas package roots for config detection. - Because Railway automatically uses a file literally named
Dockerfileat the package root, these services are configured to use Railpack instead. - The example Dockerfiles are intentionally renamed to
Dockerfile.railwayso Railway does not auto-detect them and build with the wrong context. - Leave the service root directory at
/unless you are intentionally deploying an isolated subdirectory service.
Environment variables:
- API service:
DATABASE_URL: your Neon Postgres connection stringSITE_URL: the public web origin, for examplehttps://codexl.ink
- Web service:
SITE_URL: the public web origin, for examplehttps://codexl.inkAPI_BASE_URL: internal API URL, for examplehttp://api.railway.internal:8787if the API service is namedapi
The API service runs pnpm migrate:deploy as a Railway pre-deploy command, which executes packages/db/src/migrate.ts against the drizzle SQL files before the new deployment starts serving traffic.
Examples:
npx codex-link share <session-id>
npx codex-link track <session-id>
npx codex-link monitor
npx codex-link unshare <share-id>The CLI reads sessions from ~/.codex/session_index.jsonl and ~/.codex/sessions/**, uploads a redacted public snapshot, and stores local tracking state under the platform app-state directory.
For local workspace development, run the CLI directly with:
pnpm --filter codex-link dev share <session-id>To publish the npm package from the workspace:
pnpm publish:cli -- --dry-run
pnpm publish:cli
pnpm publish:cli -- minorThe publish script stages a clean package, forces production defaults for API_BASE_URL, CODEXLINK_API_URL, and SITE_URL, bumps the CLI package version before publish, and refuses to publish if the packed output contains unexpected files or obvious secrets. It defaults to a patch bump, and you can pass minor, major, prerelease, or an explicit semver version as the first argument.