Conversation
- Refined `string.url` type - Updated port and host type definitions - Simplified logging in examples - Standardized VITE_* variable types
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis pull request updates environment variable validation schemas across multiple playground and example directories. Changes include switching validation types (e.g., string to string.url, string.host to string.ip | 'localhost'), refactoring logging code by removing intermediate variable bindings in favor of direct env property access, and simplifying validator method calls for functional parity. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 inconclusive)
✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
- Use z.url() for direct URL validation - Remove redundant variable declarations - Streamline console.log for environment variables
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
apps/playgrounds/node/index.ts (1)
4-5: Same validator change as examples/basic/index.ts.This file has the same change from built-in validators to explicit types. See the comment in
examples/basic/index.ts(lines 4-5) for the verification request regarding this pattern.
🧹 Nitpick comments (1)
apps/playgrounds/vite-legacy/vite.config.ts (1)
13-13: Recommend using a more specific type thanunknownfor the example.The
unknowntype provides no validation constraint and doesn't demonstrate best practices for environment variable schemas. Consider using"string", a string literal union (e.g.,"'dev' | 'prod'"), or a built-in validator to make this example more useful.Based on learnings, environment schemas should use built-in validators and descriptive types where possible.
🔎 Example alternatives
- VITE_MY_VAR: "unknown", + VITE_MY_VAR: "string",Or if demonstrating string literals:
- VITE_MY_VAR: "unknown", + VITE_MY_VAR: "'development' | 'production'",Or if demonstrating a built-in validator:
- VITE_MY_VAR: "unknown", + VITE_MY_VAR: "string.url",
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (9)
apps/playgrounds/bun-react/src/env.tsapps/playgrounds/bun/index.tsapps/playgrounds/node/index.tsapps/playgrounds/standard-schema/index.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/basic/index.tsexamples/with-bun-react/src/env.tsexamples/with-bun/index.tsexamples/with-standard-schema/index.ts
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)
**/*.{ts,tsx}: Prefertypeoverinterfacefor type definitions in TypeScript
Use TypeScript 5.1+ features when appropriate
Leverageconsttype parameters for better inference in TypeScript
Use JSDoc comments for public APIs
Use tabs for indentation (configured in Biome)
Use double quotes for strings (configured in Biome)
Organize imports automatically (Biome handles this)
Avoid explicit types when TypeScript can infer them (noInferrableTypeserror)
Useas constwhere appropriate for immutable values (useAsConstAssertionerror)
Don't reassign function parameters (noParameterAssignerror)
Place default parameters last in function signatures (useDefaultParameterLasterror)
Always initialize enum values (useEnumInitializerserror)
Declare one variable per statement (useSingleVarDeclaratorerror)
Avoid unnecessary template literals (noUnusedTemplateLiteralerror)
PreferNumber.parseIntover globalparseInt(useNumberNamespaceerror)
Use kebab-case for TypeScript filenames (e.g.,create-env.ts)
Use camelCase for function names (e.g.,createEnv)
Use PascalCase for type names (e.g.,ArkEnvError)
Use UPPER_SNAKE_CASE for environment variables and constants
Include examples in JSDoc comments when helpful for public APIs
Document complex type logic with JSDoc comments
UseArkEnvErrorfor environment variable validation errors
Provide clear, actionable error messages that include the variable name and expected type
**/*.{ts,tsx}: UsecreateEnv(schema)as the main function for validated environment objects, available as the default export
Use built-in validators (host, port, url, email) fromsrc/types.tswhen available instead of custom validation
UseArkEnvErrorfor environment variable errors, not generic errors
Environment schema definitions should use built-in validators, ArkType string literals, and support default values in the schema pattern
Use logical grouping for related environment variables in schemas
Use descriptive env...
Files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
{bin,examples,playgrounds}/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)
Console usage is allowed in
bin/and example/playground directories, otherwise treated as warning
Files:
examples/with-bun-react/src/env.tsexamples/with-standard-schema/index.tsexamples/with-bun/index.tsexamples/basic/index.ts
examples/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
examples/**/*.{ts,tsx}: Ensure examples demonstrate secure default practices
Add examples in theexamples/directory for new functionality, demonstrating real-world usage patterns
Files:
examples/with-bun-react/src/env.tsexamples/with-standard-schema/index.tsexamples/with-bun/index.tsexamples/basic/index.ts
**/*.{ts,tsx,json,md}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Use Biome for linting and formatting instead of ESLint and Prettier
Files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx}: Usebun <file>instead ofnode <file>orts-node <file>for running TypeScript and JavaScript files
Bun automatically loads .env files, so don't use the dotenv package
UseBun.serve()with built-in WebSocket, HTTPS, and route support instead ofexpress
Usebun:sqlitefor SQLite database operations instead ofbetter-sqlite3
UseBun.redisfor Redis operations instead ofioredis
UseBun.sqlfor Postgres database operations instead ofpgorpostgres.js
Use built-inWebSocketinstead of thewspackage
PreferBun.fileovernode:fsreadFile/writeFile methods for file operations
UseBun.$template literal syntax for shell commands instead ofexeca
Files:
apps/playgrounds/bun-react/src/env.ts
apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css}
📄 CodeRabbit inference engine (apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
Use
bun build <file.html|file.ts|file.css>instead ofwebpackoresbuildfor bundling
Files:
apps/playgrounds/bun-react/src/env.ts
apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html}
📄 CodeRabbit inference engine (apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
CSS files can be imported directly in TypeScript/JavaScript or referenced in HTML
<link>tags, and Bun will automatically bundle them
Files:
apps/playgrounds/bun-react/src/env.ts
apps/playgrounds/bun-react/**/*.ts
📄 CodeRabbit inference engine (apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
Use
bun --hotto run TypeScript entry files with hot module reloading enabled
Files:
apps/playgrounds/bun-react/src/env.ts
**/index.ts
📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)
Use barrel exports (
index.ts) for package entry points
Files:
examples/with-standard-schema/index.tsapps/playgrounds/node/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
apps/playgrounds/bun/**/*.{ts,js}
📄 CodeRabbit inference engine (apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
Use
bun <file>instead ofnode <file>orts-node <file>for running scripts
Files:
apps/playgrounds/bun/index.ts
apps/playgrounds/bun/**/*.{html,ts,tsx,css}
📄 CodeRabbit inference engine (apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
Use
bun build <file.html|file.ts|file.css>instead ofwebpackoresbuildfor bundling
Files:
apps/playgrounds/bun/index.ts
apps/playgrounds/bun/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
apps/playgrounds/bun/**/*.{ts,tsx,js,jsx}: Bun automatically loads .env files, so don't usedotenvlibrary
UseBun.serve()with built-in WebSocket, HTTPS, and route support instead ofexpress
Usebun:sqlitefor SQLite database operations instead ofbetter-sqlite3
UseBun.redisfor Redis operations instead ofioredis
UseBun.sqlfor Postgres operations instead ofpgorpostgres.js
Use built-inWebSocketinstead ofwslibrary
PreferBun.fileovernode:fsreadFile/writeFile for file operations
UseBun.$\command`for shell execution instead ofexeca`
Files:
apps/playgrounds/bun/index.ts
apps/playgrounds/bun/**/index.ts
📄 CodeRabbit inference engine (apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc)
Run frontend development with
bun --hot ./index.tsfor hot module reloading
Files:
apps/playgrounds/bun/index.ts
🧠 Learnings (30)
📓 Common learnings
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Learnt from: yamcodes
Repo: yamcodes/arkenv PR: 132
File: packages/arkenv/README.md:13-14
Timestamp: 2025-09-09T17:37:19.650Z
Learning: For yamcodes/arkenv project: Runtime support documentation should link to specific examples: Node.js (examples/basic), Bun (examples/with-bun), Vite (examples/with-vite-react-ts).
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.{ts,tsx} : Environment schema definitions should use built-in validators, ArkType string literals, and support default values in the schema pattern
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.{ts,tsx} : Use built-in validators (host, port, url, email) from `src/types.ts` when available instead of custom validation
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.{ts,tsx} : Use logical grouping for related environment variables in schemas
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use the dotenv package
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Bun automatically loads .env files, so don't use `dotenv` library
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.ts : Use `bun --hot` to run TypeScript entry files with hot module reloading enabled
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use UPPER_SNAKE_CASE for environment variables and constants
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.{ts,tsx} : Use descriptive environment variable names that indicate purpose and format
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsapps/playgrounds/node/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Use `Bun.redis` for Redis operations instead of `ioredis`
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Keep environment variable schemas readable and TypeScript-like using ArkType syntax
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Use `Bun.serve()` with built-in WebSocket, HTTPS, and route support instead of `express`
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx,html,css} : Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild` for bundling
Applied to files:
examples/with-bun-react/src/env.ts
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Use `Bun.redis` for Redis operations instead of `ioredis`
Applied to files:
examples/with-bun-react/src/env.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use ArkType's `type()` function to define schemas in environment variable definitions
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's built-in types (e.g., `string.host`, `number.port`) where possible in environment schemas
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Use union types for enums in ArkType schemas (e.g., `"'dev' | 'prod'"`) instead of separate enum definitions
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/node/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Convert ArkType validation errors to `ArkEnvError` for user-friendly error messages that include variable name and expected type
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/node/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:04:00.957Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-24T16:04:00.957Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable validation errors
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: Applies to packages/arkenv/**/*.ts : Leverage ArkType's type inference for TypeScript types instead of manual type definitions
Applied to files:
examples/with-bun-react/src/env.tsapps/playgrounds/bun-react/src/env.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.{ts,tsx} : Use `createEnv(schema)` as the main function for validated environment objects, available as the default export
Applied to files:
apps/playgrounds/bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.tsapps/playgrounds/standard-schema/index.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.{ts,tsx} : Environment schema definitions should use built-in validators, ArkType string literals, and support default values in the schema pattern
Applied to files:
apps/playgrounds/bun-react/src/env.tsapps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,tsx,js,jsx} : Use `Bun.serve()` with built-in WebSocket, HTTPS, and route support instead of `express`
Applied to files:
apps/playgrounds/bun-react/src/env.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.{ts,tsx} : Use logical grouping for related environment variables in schemas
Applied to files:
apps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.test.{ts,tsx} : Test edge cases including invalid and missing environment variable values
Applied to files:
apps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/standard-schema/index.ts
📚 Learning: 2025-12-12T13:20:01.954Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/test-patterns.mdc:0-0
Timestamp: 2025-12-12T13:20:01.954Z
Learning: Applies to packages/vite-plugin/src/**/*.test.ts : Test the Vite plugin using the with-vite-react example as a fixture and validate that the plugin works with real Vite projects
Applied to files:
apps/playgrounds/vite-legacy/vite.config.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.{ts,tsx} : Use `ArkEnvError` for environment variable errors, not generic errors
Applied to files:
apps/playgrounds/vite-legacy/vite.config.tsexamples/with-standard-schema/index.tsapps/playgrounds/node/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.{ts,tsx} : Use built-in validators (host, port, url, email) from `src/types.ts` when available instead of custom validation
Applied to files:
examples/with-standard-schema/index.tsexamples/with-bun/index.tsapps/playgrounds/bun/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:03:45.295Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .cursor/rules/arktype.mdc:0-0
Timestamp: 2025-11-24T16:03:45.295Z
Learning: ArkType validates environment variables at runtime and TypeScript types are inferred from the schema definition
Applied to files:
examples/with-standard-schema/index.tsapps/playgrounds/node/index.tsapps/playgrounds/standard-schema/index.tsexamples/basic/index.ts
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/*.{ts,js} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running scripts
Applied to files:
examples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-24T16:04:47.583Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun-react/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:47.583Z
Learning: Applies to apps/playgrounds/bun-react/**/*.{ts,tsx,js,jsx} : Use `bun <file>` instead of `node <file>` or `ts-node <file>` for running TypeScript and JavaScript files
Applied to files:
examples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-24T16:04:58.629Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: apps/playgrounds/bun/.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc:0-0
Timestamp: 2025-11-24T16:04:58.629Z
Learning: Applies to apps/playgrounds/bun/**/index.ts : Run frontend development with `bun --hot ./index.ts` for hot module reloading
Applied to files:
examples/with-bun/index.tsapps/playgrounds/bun/index.ts
📚 Learning: 2025-11-29T22:11:39.931Z
Learnt from: CR
Repo: yamcodes/arkenv PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-29T22:11:39.931Z
Learning: Applies to **/*.test.{ts,tsx} : Mock `process.env` in tests for different scenarios and save/restore original env in `beforeEach`/`afterEach` hooks
Applied to files:
examples/with-bun/index.tsapps/playgrounds/bun/index.ts
🧬 Code graph analysis (2)
examples/with-standard-schema/index.ts (3)
packages/arkenv/src/type.ts (1)
type(3-3)apps/playgrounds/js/index.js (1)
env(3-7)examples/basic-js/index.js (1)
env(3-7)
apps/playgrounds/standard-schema/index.ts (3)
packages/arkenv/src/type.ts (1)
type(3-3)apps/playgrounds/js/index.js (1)
env(3-7)examples/basic-js/index.js (1)
env(3-7)
🔇 Additional comments (9)
examples/with-bun-react/src/env.ts (1)
4-4: LGTM! Enhanced validation for API URL.The change from
"string"to"string.url"adds proper URL validation, ensuring the environment variable contains a valid URL format at runtime.apps/playgrounds/bun-react/src/env.ts (1)
4-4: LGTM! Consistent URL validation.The upgrade to
"string.url"ensures runtime validation of the API URL format.apps/playgrounds/bun/index.ts (1)
11-11: LGTM! Cleaner inline property access.The refactor from intermediate variables to direct
envproperty access simplifies the logging code without changing functionality.examples/with-bun/index.ts (1)
11-11: LGTM! Simplified logging with inline access.The refactor to use direct
envproperty access in logging maintains the same output while reducing code verbosity.apps/playgrounds/standard-schema/index.ts (3)
12-12: LGTM! More idiomatic Zod URL validation.The change from
z.string().url()toz.url()is the preferred Zod pattern for URL validation.
26-26: LGTM! Consistent validator simplification.The update to use
z.url()directly within the array aligns with the idiomatic Zod pattern used forDATABASE_URL.
33-44: LGTM! Streamlined logging.The refactor to access
envproperties directly in the console.log removes unnecessary intermediate variables while maintaining identical output.examples/with-standard-schema/index.ts (1)
12-12: LGTM! Consistent changes with apps/playgrounds/standard-schema/index.ts.These changes mirror the validator simplification and logging refactor in
apps/playgrounds/standard-schema/index.ts, maintaining consistency across standard-schema examples.Also applies to: 26-26, 33-44
apps/playgrounds/vite-legacy/vite.config.ts (1)
14-15: LGTM! Direct type coercion aligns with the PR objectives.The use of
"number"and"boolean"types demonstrates ArkType's runtime coercion from string environment variables to these native types, which aligns with the coercion examples goal of this PR.
Closes #568
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.