Loading...
Loading...
Answer questions about ArkEnv and help implement environment variable validation. Use when developers: (1) Ask about environment variable validation or typesafety, (2) Want to setup ArkEnv in a project, (3) Need to define or update schemas using ArkType or Standard Schema, (4) Are integrating with Next.js, Nuxt, Vite, Bun, or Node.js runtimes. Triggers on: 'ArkEnv', 'env validation', 'typesafe env', 'createEnv', 'env.ts', 'arkenv'.
npx skill4agent add onmax/nuxt-skills arkenvimport { env } from "./env"@arkenv/core@arkenv/standard@arkenv/core@arkenv/standardstring.numericnumber.port"boolean = true"env@arkenv/vite-pluginenv.tsVITE_*@arkenv/bun-pluginenv.tsBun.buildBun.serveBUN_PUBLIC_*@arkenv/nextjs@arkenv/nuxt@arkenv/core@arkenv/standardpnpm dlx arkenv initnpx arkenv initNext.jsNuxtViteBunenv.ts--preset, -P <provider>tsconfig.json--schemaenv.tssrc/env.tspackage.json"arkenv"env/server.ts--preset vercelnetlifycloudflarerailwayrenderfly./env.ts/docs/core-concepts/hosting-presets--agentpnpm dlx arkenv init --agent--agent--yes--quiet--jsonstdoutstderrstdoutok: truecommandId: "init"resultok: false--agent--forcestdout{
"ok": false,
"commandId": "init",
"error": {
"code": "CLI.GIT_TREE_DIRTY",
"severity": "error",
"summary": "Git working tree is not clean.",
"why": "Commit or stash your changes before running arkenv init.",
"nextActions": [
{
"kind": "run-command",
"label": "Re-run with --force to bypass git working tree check",
"command": "arkenv init --force"
}
]
},
"diagnostics": [],
"nextActions": [
{
"kind": "run-command",
"label": "Re-run with --force to bypass git working tree check",
"command": "arkenv init --force"
}
]
}error.codeCLI.REQUIREMENTS_NOT_METCLI.GIT_TREE_DIRTYCLI.NON_EMPTY_DIRCLI.INTERNAL_ERRORnextActionsrun-command--forcenextActionsinit --agent--forceok: falseerror.codenextActions--forcerun-command--forceinitpnpm dlx arkenv init [options]--preset, -P <preset>--no-codegen--force, -fcheckpnpm arkenv check [options]--schema, -s <path>--verify-example [file].env.example--env-file <path>--jsonenv@arkenv/coreimport arkenv from "@arkenv/core";
export const env = arkenv({
PORT: "number.port = 3000",
DATABASE_URL: "string",
VITE_API_URL: "string",
NODE_ENV: "'development' | 'production' | 'test' = 'development'",
});@arkenv/standardimport arkenv from "@arkenv/standard";
import * as z from "zod";
export const env = arkenv({
PORT: z.number().default(3000),
DATABASE_URL: z.string(),
VITE_API_URL: z.url(),
NODE_ENV: z.enum(["development", "production", "test"]).default("development"),
});/valibot@valibot/to-json-schemaimport { arkenv } from "@arkenv/standard/valibot";
import * as v from "valibot";
export const env = arkenv({
PORT: v.optional(v.number(), 3000),
DATABASE_URL: v.pipe(v.string(), v.url()),
});envenvimport { env } from "./env";
export default function App() {
const apiUrl = env.VITE_API_URL; // string
return <div>API URL: {apiUrl}</div>;
}@arkenv/vite-pluginvite.config.tsimport { defineConfig } from "vite";
import arkenvPlugin from "@arkenv/vite-plugin";
export default defineConfig({
plugins: [arkenvPlugin()],
});vite.config.tsserver.portloadEnvimport { defineConfig, loadEnv } from "vite";
import arkenvPlugin from "@arkenv/vite-plugin";
import arkenv, { type } from "@arkenv/core";
export const Env = type({
PORT: "number.port = 5173",
VITE_API_URL: "string",
});
export default defineConfig(({ mode }) => {
const env = arkenv(Env, { env: loadEnv(mode, process.cwd(), "") });
return {
plugins: [arkenvPlugin()],
server: { port: env.PORT },
};
});@arkenv/bun-pluginbunfig.toml[serve.static]
plugins = ["@arkenv/bun-plugin"]Bun.buildimport arkenvPlugin from "@arkenv/bun-plugin";
await Bun.build({
entrypoints: ["./src/index.tsx"],
outdir: "./dist",
plugins: [arkenvPlugin],
});src/env.tsextends: [clientEnv]import "server-only"@arkenv/core--strict/client/serverimport { env } from "./env"import.meta.envprocess.env.d.tsImportMetaEnvAugmentedProcessEnvAugmentedDATABASE_URLAPI_SECRET_KEYVITE_NEXT_PUBLIC_BUN_PUBLIC_NUXT_PUBLIC_