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
8 changes: 4 additions & 4 deletions apps/api/.env.development
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
BASE_URL=https://api.init.localhost
ALLOWED_API_ORIGINS=https://app.init.localhost
BASE_URL=http://localhost:3000
ALLOWED_API_ORIGINS=http://localhost:3001
FILES_API_SECRET=dev-files-api-secret-change-me-1234567890
S3_ACCESS_KEY_ID=minioadmin
S3_BUCKET=assets
S3_ENDPOINT=http://localhost:8002
S3_REGION=us-east-1
S3_SECRET_ACCESS_KEY=minioadmin
AUTH_SECRET=dev-secret
AUTH_TRUSTED_ORIGINS=https://app.init.localhost,https://api.init.localhost
AUTH_TRUSTED_ORIGINS=http://localhost:3001,http://localhost:3000
GITHUB_CLIENT_ID=dev-github-client-id
GITHUB_CLIENT_SECRET=dev-github-client-secret
GOOGLE_CLIENT_ID=dev-google-client-id
GOOGLE_CLIENT_SECRET=dev-google-client-secret
DATABASE_URL=postgresql://postgres:postgres@localhost:8001/main
REDIS_URL=redis://localhost:8000
INNGEST_BASE_URL=https://workflows.init.localhost
INNGEST_BASE_URL=http://localhost:4002
INNGEST_DEV=true
INNGEST_EVENT_KEY=dev-inngest-event-key
INNGEST_SIGNING_KEY=dev-inngest-signing-key
Expand Down
4 changes: 0 additions & 4 deletions apps/api/.env.schema
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,5 @@ S3_REGION=
# Object-storage secret credential.
S3_SECRET_ACCESS_KEY=

# Optional Portless URL supplied to local commands.
# @optional @public @type=url
PORTLESS_URL=

# Arcjet security credential.
ARCJET_KEY=
7 changes: 1 addition & 6 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"codegen": "bun run --parallel \"codegen:*\"",
"codegen:env": "varlock codegen",
"codegen:i18n": "paraglide-js compile --project ../../tooling/internationalization/project.inlang --outdir ./src/shared/internationalization",
"dev": "portless",
"dev:app": "varlock run -- bun --no-env-file --hot src/index.ts",
"dev": "varlock run -- bun --no-env-file --hot src/index.ts",
"env:check": "varlock load",
"start": "varlock run -- bun --no-env-file --bun src/index.ts"
},
Expand Down Expand Up @@ -46,9 +45,5 @@
"@tooling/tsconfig": "workspace:*",
"@types/bun": "1.3.14",
"typescript": "7.0.2"
},
"portless": {
"name": "api.init",
"script": "dev:app"
}
}
6 changes: 5 additions & 1 deletion apps/api/src/shared/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
AUTH_ADVANCED_OPTIONS,
AUTH_APP_NAME,
AUTH_COOKIE_PREFIX,
AUTH_EMAIL_AND_PASSWORD_OPTIONS,
AUTH_SESSION_OPTIONS,
} from "@init/auth/constants"
Expand All @@ -13,7 +14,10 @@ import { ENV } from "#shared/env.generated.ts"
import { allowedOrigins, baseUrl } from "#shared/utils.ts"

export const auth = createAuth({
advanced: AUTH_ADVANCED_OPTIONS,
// The app's auth instance shares the localhost cookie jar during
// development, so this instance namespaces its cookies to keep the two
// sessions from clobbering each other.
advanced: { ...AUTH_ADVANCED_OPTIONS, cookiePrefix: `${AUTH_COOKIE_PREFIX}-api` },
appName: AUTH_APP_NAME,
basePath: "/auth",
baseURL: baseUrl,
Expand Down
13 changes: 3 additions & 10 deletions apps/api/src/shared/env.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ export type CoercedEnvSchema = {
*/
S3_SECRET_ACCESS_KEY: string;

/**
* **PORTLESS_URL**
* Optional Portless URL supplied to local commands.
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M24%2021V9h-2v14h8v-2zm-4-6v-4c0-1.103-.897-2-2-2h-6v14h2v-6h1.48l2.335%206h2.145l-2.333-6H18c1.103%200%202-.897%202-2m-6-4h4v4h-4zM8%2023H4c-1.103%200-2-.897-2-2V9h2v12h4V9h2v12c0%201.103-.897%202-2%202%22%2F%3E%3C%2Fsvg%3E)
*/
PORTLESS_URL?: string;

/**
* **ARCJET_KEY** 🔐 _sensitive_
* Arcjet security credential.
Expand Down Expand Up @@ -253,17 +246,17 @@ export type CoercedEnvSchema = {

};

type _CoercedEnvSchema_3b9f7a4f = CoercedEnvSchema;
type _CoercedEnvSchema_c1330bc4 = CoercedEnvSchema;

export type EnvSchemaAsStrings = {
[Property in keyof CoercedEnvSchema]:
CoercedEnvSchema[Property] extends string ? CoercedEnvSchema[Property]
: (CoercedEnvSchema[Property] extends boolean ? ('true' | 'false') : string)
};

type _EnvSchemaAsStrings_3b9f7a4f = EnvSchemaAsStrings;
type _EnvSchemaAsStrings_c1330bc4 = EnvSchemaAsStrings;

export type PublicCoercedEnvSchema = Readonly<Pick<CoercedEnvSchema, 'BASE_URL' | 'ALLOWED_API_ORIGINS' | 'PORT' | 'S3_BUCKET' | 'S3_ENDPOINT' | 'S3_REGION' | 'PORTLESS_URL' | 'AUTH_TRUSTED_ORIGINS' | 'GITHUB_CLIENT_ID' | 'GOOGLE_CLIENT_ID' | 'INNGEST_BASE_URL' | 'INNGEST_DEV' | 'SENTRY_DSN' | 'SENTRY_ORG' | 'SENTRY_PROJECT' | 'EMAIL_FROM' | 'MOCK_RESEND' | 'RUN_PRODUCTION_MIGRATIONS' | 'SENTRY_DEBUG' | 'SENTRY_SPOTLIGHT'>>;
export type PublicCoercedEnvSchema = Readonly<Pick<CoercedEnvSchema, 'BASE_URL' | 'ALLOWED_API_ORIGINS' | 'PORT' | 'S3_BUCKET' | 'S3_ENDPOINT' | 'S3_REGION' | 'AUTH_TRUSTED_ORIGINS' | 'GITHUB_CLIENT_ID' | 'GOOGLE_CLIENT_ID' | 'INNGEST_BASE_URL' | 'INNGEST_DEV' | 'SENTRY_DSN' | 'SENTRY_ORG' | 'SENTRY_PROJECT' | 'EMAIL_FROM' | 'MOCK_RESEND' | 'RUN_PRODUCTION_MIGRATIONS' | 'SENTRY_DEBUG' | 'SENTRY_SPOTLIGHT'>>;

// re-export of the runtime ENV proxy, typed to this package's schema
export const ENV = _ENV as unknown as Readonly<CoercedEnvSchema>;
12 changes: 2 additions & 10 deletions apps/api/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@ import { createFactory } from "hono/factory"
import type { AppContext } from "#shared/types.ts"
import { ENV } from "#shared/env.generated.ts"

export const baseUrl = ENV.PORTLESS_URL ?? ENV.BASE_URL
export const baseUrl = ENV.BASE_URL

export const allowedOrigins = ENV.PORTLESS_URL
? ENV.ALLOWED_API_ORIGINS.map(
(origin) =>
new URL(
ENV.PORTLESS_URL?.replace(new URL(ENV.BASE_URL).hostname, new URL(origin).hostname) ??
origin
).origin
)
: ENV.ALLOWED_API_ORIGINS
export const allowedOrigins = ENV.ALLOWED_API_ORIGINS

/**
* A utility function to create Hono apps and middlewares with the correct context type.
Expand Down
4 changes: 2 additions & 2 deletions apps/app/.env.development
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PUBLIC_BASE_URL=https://app.init.localhost
PUBLIC_BASE_URL=http://localhost:3001
AUTH_SECRET=dev-secret
AUTH_TRUSTED_ORIGINS=https://app.init.localhost
AUTH_TRUSTED_ORIGINS=http://localhost:3001
GITHUB_CLIENT_ID=dev-github-client-id
GITHUB_CLIENT_SECRET=dev-github-client-secret
GOOGLE_CLIENT_ID=dev-google-client-id
Expand Down
4 changes: 0 additions & 4 deletions apps/app/.env.schema
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ PUBLIC_BASE_URL=
# @optional @type=url(matches=/^https?:\/\//)
PUBLIC_API_URL=

# Optional Portless URL supplied to local server commands.
# @optional @dynamic @type=url
PORTLESS_URL=

# Local Vite server port.
# @dynamic @type=port
PORT=3001
7 changes: 1 addition & 6 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"codegen": "bun run --parallel \"codegen:*\"",
"codegen:env": "varlock codegen",
"codegen:i18n": "paraglide-js compile --project ../../tooling/internationalization/project.inlang --outdir ./src/shared/internationalization",
"dev": "portless",
"dev:app": "bun --bun vite dev",
"dev": "bun --bun vite dev",
"env:check": "varlock load",
"env:scan": "test -d .output/public && varlock scan --path .env.schema --path .env.development .output/public",
"env:scan:build": "bun --bun vite build",
Expand Down Expand Up @@ -62,9 +61,5 @@
"tailwindcss": "4.3.3",
"typescript": "7.0.2",
"vite": "8.1.5"
},
"portless": {
"name": "app.init",
"script": "dev:app"
}
}
6 changes: 2 additions & 4 deletions apps/app/src/features/auth/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ import { sendEmail } from "@init/email/client"
import PasswordReset from "@init/email/templates/password-reset"
import { ENV } from "#shared/env.generated.ts"

const trustedOrigins = ENV.PORTLESS_URL
? [...new Set([...ENV.AUTH_TRUSTED_ORIGINS, ENV.PORTLESS_URL])]
: ENV.AUTH_TRUSTED_ORIGINS
const trustedOrigins = ENV.AUTH_TRUSTED_ORIGINS

export const auth = createAuth({
advanced: AUTH_ADVANCED_OPTIONS,
appName: AUTH_APP_NAME,
basePath: "/api/auth",
baseURL: ENV.PORTLESS_URL ?? ENV.PUBLIC_BASE_URL,
baseURL: ENV.PUBLIC_BASE_URL,
database: databaseAdapter(database()),
emailAndPassword: {
...AUTH_EMAIL_AND_PASSWORD_OPTIONS,
Expand Down
13 changes: 3 additions & 10 deletions apps/app/src/shared/env.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@ export type CoercedEnvSchema = {
*/
PUBLIC_API_URL?: string;

/**
* **PORTLESS_URL**
* Optional Portless URL supplied to local server commands.
* ![icon](data:image/svg+xml;utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2220%22%20height%3D%2220%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cpath%20fill%3D%22%23808080%22%20d%3D%22M24%2021V9h-2v14h8v-2zm-4-6v-4c0-1.103-.897-2-2-2h-6v14h2v-6h1.48l2.335%206h2.145l-2.333-6H18c1.103%200%202-.897%202-2m-6-4h4v4h-4zM8%2023H4c-1.103%200-2-.897-2-2V9h2v12h4V9h2v12c0%201.103-.897%202-2%202%22%2F%3E%3C%2Fsvg%3E)
*/
PORTLESS_URL?: string;

/**
* **PORT**
* Local Vite server port.
Expand Down Expand Up @@ -134,17 +127,17 @@ export type CoercedEnvSchema = {

};

type _CoercedEnvSchema_8842e194 = CoercedEnvSchema;
type _CoercedEnvSchema_e8481ffe = CoercedEnvSchema;

export type EnvSchemaAsStrings = {
[Property in keyof CoercedEnvSchema]:
CoercedEnvSchema[Property] extends string ? CoercedEnvSchema[Property]
: (CoercedEnvSchema[Property] extends boolean ? ('true' | 'false') : string)
};

type _EnvSchemaAsStrings_8842e194 = EnvSchemaAsStrings;
type _EnvSchemaAsStrings_e8481ffe = EnvSchemaAsStrings;

export type PublicCoercedEnvSchema = Readonly<Pick<CoercedEnvSchema, 'PUBLIC_BASE_URL' | 'PUBLIC_API_URL' | 'PORTLESS_URL' | 'PORT' | 'AUTH_TRUSTED_ORIGINS' | 'GITHUB_CLIENT_ID' | 'GOOGLE_CLIENT_ID' | 'EMAIL_FROM' | 'MOCK_RESEND' | 'PUBLIC_SENTRY_DSN' | 'RUN_PRODUCTION_MIGRATIONS' | 'PUBLIC_SENTRY_DEBUG'>>;
export type PublicCoercedEnvSchema = Readonly<Pick<CoercedEnvSchema, 'PUBLIC_BASE_URL' | 'PUBLIC_API_URL' | 'PORT' | 'AUTH_TRUSTED_ORIGINS' | 'GITHUB_CLIENT_ID' | 'GOOGLE_CLIENT_ID' | 'EMAIL_FROM' | 'MOCK_RESEND' | 'PUBLIC_SENTRY_DSN' | 'RUN_PRODUCTION_MIGRATIONS' | 'PUBLIC_SENTRY_DEBUG'>>;

// re-export of the runtime ENV proxy, typed to this package's schema
export const ENV = _ENV as unknown as Readonly<CoercedEnvSchema>;
2 changes: 1 addition & 1 deletion apps/app/src/shared/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { hasWindow } from "@init/utils/env"
import { createUrlBuilder } from "@init/utils/url"
import { ENV } from "#shared/env.generated.ts"

const baseUrl = hasWindow ? globalThis.location.origin : (ENV.PORTLESS_URL ?? ENV.PUBLIC_BASE_URL)
const baseUrl = hasWindow ? globalThis.location.origin : ENV.PUBLIC_BASE_URL

export const buildUrl = createUrlBuilder(baseUrl, getProtocol(baseUrl))

Expand Down
7 changes: 1 addition & 6 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"codegen": "bun run --parallel \"codegen:*\"",
"codegen:env": "varlock codegen",
"codegen:i18n": "paraglide-js compile --project ../../tooling/internationalization/project.inlang --outdir ./src/shared/internationalization",
"dev": "portless",
"dev:app": "electron-forge start",
"dev": "electron-forge start",
"env:check": "varlock load",
"env:scan": "test -d dist && varlock scan --path .env.schema dist",
"env:scan:build": "bun --bun vite build --config vite.renderer.config.ts",
Expand Down Expand Up @@ -63,9 +62,5 @@
"electron": "43.4.0",
"typescript": "7.0.2",
"vite": "8.1.5"
},
"portless": {
"name": "desktop.init",
"script": "dev:app"
}
}
4 changes: 2 additions & 2 deletions apps/docs/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
PUBLIC_MARKETING_URL=https://web.init.localhost
PUBLIC_SITE_URL=https://docs.init.localhost
PUBLIC_MARKETING_URL=http://localhost:3006
PUBLIC_SITE_URL=http://localhost:3004
4 changes: 2 additions & 2 deletions apps/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ decisions do not enter public routes or search.
- Colors and component styling: `src/shared/styles/globals.css`
- Site URL: `PUBLIC_SITE_URL` in `.env.schema`, with safe development values in
`.env.development` and the production fallback in `src/shared/constants.ts`
- Marketing return URL: `PUBLIC_MARKETING_URL`; development otherwise derives the
matching `web.<project>.localhost` URL and production uses `init.now`
- Marketing return URL: `PUBLIC_MARKETING_URL`; development otherwise falls back to
the Web workspace at `http://localhost:3006` and production uses `init.now`
- Navigation, locales, edit links, and head metadata: `astro.config.ts`
- Favicon and social preview: `public/`

Expand Down
7 changes: 1 addition & 6 deletions apps/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"codegen": "bun run --parallel \"codegen:*\"",
"codegen:env": "varlock codegen",
"codegen:i18n": "paraglide-js compile --project ../../tooling/internationalization/project.inlang --outdir ./src/shared/internationalization",
"dev": "portless",
"dev:app": "astro dev",
"dev": "astro dev",
"env:check": "varlock load",
"env:scan": "test -d dist && varlock scan --path .env.schema --path .env.development dist",
"env:scan:build": "astro build",
Expand All @@ -42,9 +41,5 @@
"@varlock/astro-integration": "1.3.0",
"tailwindcss": "4.3.3",
"typescript": "7.0.2"
},
"portless": {
"name": "docs.init",
"script": "dev:app"
}
}
2 changes: 1 addition & 1 deletion apps/docs/src/shared/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const DOCS_DESCRIPTION =
"Select the workspaces you need, configure the template, and build with init."
export const DOCS_URL = "https://docs.init.now"
export const DEVELOPMENT_MARKETING_URL = "https://web.init.localhost"
export const DEVELOPMENT_MARKETING_URL = "http://localhost:3006"
export const GITHUB_URL = "https://github.com/metaideas/init"
export const MARKETING_URL = "https://init.now"
export const SITE_NAME = "init Docs"
7 changes: 1 addition & 6 deletions apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"codegen": "bun run --parallel \"codegen:*\"",
"codegen:env": "varlock codegen",
"codegen:i18n": "paraglide-js compile --project ../../tooling/internationalization/project.inlang --outdir ./src/shared/internationalization",
"dev": "portless",
"dev:app": "wxt",
"dev": "wxt",
"dev:firefox": "wxt -b firefox",
"env:check": "varlock load",
"env:scan": "test -d .output && varlock scan --path .env.schema .output",
Expand Down Expand Up @@ -48,9 +47,5 @@
"vite": "8.1.5",
"web-ext": "10.5.0",
"wxt": "0.21.1"
},
"portless": {
"name": "extension.init",
"script": "dev:app"
}
}
7 changes: 1 addition & 6 deletions apps/mobile/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
"codegen": "bun run --parallel \"codegen:*\"",
"codegen:env": "varlock codegen",
"codegen:i18n": "bun run scripts/codegen.ts",
"dev": "portless",
"dev": "varlock run -- expo start --port ${PORT:-3002}",
"dev:android": "varlock run -- expo start --android",
"dev:app": "varlock run -- expo start --port ${PORT:-3002}",
"dev:ios": "varlock run -- expo start --ios",
"doctor": "expo-doctor",
"env:check": "varlock load",
Expand Down Expand Up @@ -86,9 +85,5 @@
"typescript"
]
}
},
"portless": {
"name": "mobile.init",
"script": "dev:app"
}
}
2 changes: 1 addition & 1 deletion apps/web/.env.development
Original file line number Diff line number Diff line change
@@ -1 +1 @@
PUBLIC_SITE_URL=https://web.init.localhost
PUBLIC_SITE_URL=http://localhost:3006
7 changes: 1 addition & 6 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"codegen": "bun run --parallel \"codegen:*\"",
"codegen:env": "varlock codegen",
"codegen:i18n": "paraglide-js compile --project ../../tooling/internationalization/project.inlang --outdir ./src/shared/internationalization",
"dev": "portless",
"dev:app": "astro dev",
"dev": "astro dev",
"env:check": "varlock load",
"env:scan": "test -d dist && varlock scan --path .env.schema --path .env.development dist",
"env:scan:build": "astro build",
Expand Down Expand Up @@ -45,9 +44,5 @@
"@varlock/astro-integration": "1.3.0",
"tailwindcss": "4.3.3",
"typescript": "7.0.2"
},
"portless": {
"name": "web.init",
"script": "dev:app"
}
}
3 changes: 0 additions & 3 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading