convex-env 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Shawn Rodgers
3
+ Copyright (c) 2026 Shawn Rodgers
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -19,6 +19,7 @@ Validators currently supported:
19
19
  You can use `v.optional()` on _any_ supported validator, see [examples](#usage) below
20
20
 
21
21
  <span style="color: red;"><strong>IMPORTANT</strong></span>: The <code>env</code> object from <code>createEnv</code> should only be used in the Convex runtime, the values on it will not be accessible client-side.
22
+ MA
22
23
 
23
24
  ### Installation
24
25
 
@@ -48,15 +49,16 @@ yarn add convex-env
48
49
  // convex/convex.env.ts
49
50
 
50
51
  import { createEnv } from "convex-env";
52
+ import { betterAuth, oAuth } from "convex-env/presets";
51
53
  import { v } from "convex/values";
52
54
 
53
55
  export const env = createEnv({
56
+ ...betterAuth,
57
+ ...oAuth.google,
54
58
  ENVIRONMENT: v.union(v.literal("development"), v.literal("production")),
55
- CONVEX_SITE_URL: v.string(),
56
- BETTER_AUTH_SECRET: v.string(),
57
- GOOGLE_CLIENT_ID: v.string(),
59
+ OPENAI_API_KEY: v.string(),
58
60
  GOOGLE_CLIENT_SECRET: v.string(),
59
- MAX_REQUESTS_PER_USER: v.number(),
61
+ FREE_REQUESTS_PER_USER: v.number(),
60
62
  DEBUG_MODE: v.optional(v.boolean()),
61
63
  });
62
64
  ```
@@ -91,14 +93,12 @@ import { v } from "convex/values";
91
93
 
92
94
  export const env = createEnv({
93
95
  schema: {
94
- CONVEX_SITE_URL: v.string(),
95
- MAX_REQUESTS_PER_USER: v.number(),
96
+ FREE_REQUESTS_PER_USER: v.number(),
96
97
  DEBUG_MODE: v.optional(v.boolean()),
97
98
  },
98
99
  // optional, defaults to process.env
99
100
  values: {
100
- CONVEX_SITE_URL: process.env.CONVEX_SITE_URL,
101
- MAX_REQUESTS_PER_USER: process.env.MAX_REQUESTS_PER_USER,
101
+ FREE_REQUESTS_PER_USER: process.env.FREE_REQUESTS_PER_USER,
102
102
  DEBUG_MODE: process.env.DEBUG_MODE,
103
103
  },
104
104
  });
@@ -113,8 +113,7 @@ import { createEnv } from "convex-env";
113
113
  import { v } from "convex/values";
114
114
 
115
115
  export const schema = {
116
- CONVEX_SITE_URL: v.string(),
117
- MAX_REQUESTS_PER_USER: v.number(),
116
+ FREE_REQUESTS_PER_USER: v.number(),
118
117
  DEBUG_MODE: v.optional(v.boolean()),
119
118
  };
120
119
 
@@ -135,6 +134,45 @@ import { verifyEnv } from "convex-env";
135
134
  verifyEnv(schema);
136
135
  ```
137
136
 
137
+ ### Presets
138
+
139
+ I wrote out some presets for commonly used pairs of variables. Below is a complete list of all exports from `convex-env/presets`.
140
+
141
+ - oAuth
142
+ - everything supported by [better-auth](https://www.better-auth.com)
143
+ - environment
144
+ - "development", "preview", or "production"
145
+ - [clerk](https://docs.convex.dev/auth/clerk)
146
+ - [workOS](https://docs.convex.dev/auth/authkit/),
147
+ - [betterAuth](https://labs.convex.dev/better-auth)
148
+ - [auth0](https://docs.convex.dev/auth/auth0)
149
+ - [resend](https://www.convex.dev/components/resend)
150
+ - [r2](https://www.convex.dev/components/cloudflare-r2)
151
+ - [stripe](https://www.convex.dev/components/stripe)
152
+ - [autumn](https://www.convex.dev/components/autumn)
153
+ - [dodo](https://www.convex.dev/components/dodopayments)
154
+ - [polar](https://www.convex.dev/components/polar)
155
+ - [uploadthing](https://docs.uploadthing.com/)
156
+ - [upstash](https://upstash.com/docs/redis)
157
+
158
+ ```typescript
159
+ // convex/convex.env.ts
160
+
161
+ import { createEnv } from "convex-env";
162
+ import { oAuth, betterAuth, polar, r2 } from "convex-env/presets";
163
+
164
+ export const env = createEnv({
165
+ ...betterAuth,
166
+ ...oAuth.google,
167
+ ...oAuth.github,
168
+ ...polar,
169
+ ...r2,
170
+ OPENAI_API_KEY: v.string(),
171
+ FREE_REQUESTS_PER_USER: v.number(),
172
+ DEBUG_MODE: v.optional(v.boolean()),
173
+ });
174
+ ```
175
+
138
176
  ### Why use it?
139
177
 
140
178
  User defined values on the `process.env` object will always be typed `string | undefined`. If you want to store anything other than a string, you have to cast it at each use and hope that you entered the value correctly in `.env`
package/dist/index.d.mts CHANGED
@@ -12,8 +12,9 @@ type Values<Schema> = Partial<Record<keyof Schema, string | undefined>>;
12
12
  type CreateEnvOptions = {
13
13
  skipValidation?: boolean;
14
14
  };
15
+ type Prettify<T> = { [K in keyof T]: T[K] } & {};
15
16
  //#endregion
16
- //#region src/index.d.ts
17
+ //#region src/env.d.ts
17
18
  /**
18
19
  *
19
20
  * WARNING: The object returned by `createEnv` should only be accessed within the Convex runtime. The values on the returned object will NOT be accessible client-side.
@@ -24,26 +25,48 @@ type CreateEnvOptions = {
24
25
  * @public
25
26
  *
26
27
  * @example
28
+ *
29
+ * import { betterAuth, oAuth, r2 } from "convex-env/presets";
30
+ * import { v } from "convex/values";
31
+ *
27
32
  * const env = createEnv({
28
- * FOO: v.string(),
29
- * BAR: v.number(),
30
- * BAZ: v.boolean(),
31
- * FIZZ: v.union(v.literal("development"), v.literal("production")),
33
+ * ...betterAuth,
34
+ * ...oAuth.google,
35
+ * ...oAuth.apple,
36
+ * ...r2,
37
+ * OPENAI_API_KEY: v.string(),
38
+ * FREE_REQUESTS_PER_USER: v.number(),
39
+ * DEBUG_MODE: v.optional(v.boolean()),
32
40
  * });
33
41
  *
34
42
  * @example
43
+ * import { v } from "convex/values";
44
+ * import { betterAuth, oAuth, r2 } from "convex-env/presets";
45
+ *
35
46
  * const env = createEnv({
47
+ * ...betterAuth,
48
+ * ...oAuth.google,
49
+ * ...oAuth.apple,
50
+ * ...r2,
36
51
  * schema: {
37
- * FOO: v.string(),
38
- * BAR: v.number(),
39
- * BAZ: v.optional(v.boolean()),
40
- * FIZZ: v.union(v.literal("development"), v.literal("production")),
52
+ * OPENAI_API_KEY: v.string(),
53
+ * FREE_REQUESTS_PER_USER: v.number(),
54
+ * DEBUG_MODE: v.optional(v.boolean()),
41
55
  * },
42
56
  * values: {
43
- * FOO: process.env.FOO,
44
- * BAR: "42",
45
- * BAZ: "true",
46
- * FIZZ: "development",
57
+ * OPENAI_API_KEY: process.env.OPENAI_API_KEY,
58
+ * FREE_REQUESTS_PER_USER: process.env.FREE_REQUESTS_PER_USER,
59
+ * DEBUG_MODE: process.env.DEBUG_MODE,
60
+ * BETTER_AUTH_SECRET: process.env.BETTER_AUTH_SECRET,
61
+ * GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID,
62
+ * GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET,
63
+ * APPLE_CLIENT_ID: process.env.APPLE_CLIENT_ID,
64
+ * APPLE_CLIENT_SECRET: process.env.APPLE_CLIENT_SECRET,
65
+ * R2_TOKEN: process.env.R2_TOKEN,
66
+ * R2_ACCESS_KEY_ID: process.env.R2_ACCESS_KEY_ID,
67
+ * R2_SECRET_ACCESS_KEY: process.env.R2_SECRET_ACCESS_KEY,
68
+ * R2_ENDPOINT: process.env.R2_ENDPOINT,
69
+ * R2_BUCKET: process.env.R2_BUCKET,
47
70
  * },
48
71
  * options: {
49
72
  * skipValidation: true,
@@ -55,10 +78,10 @@ declare const createEnv: <Schema extends Record<string, AllowedValidators>>(args
55
78
  schema: Schema;
56
79
  values?: Values<Schema>;
57
80
  options?: CreateEnvOptions;
58
- }) => { [K in keyof Schema]: InferredOuput<Schema[K]> } & {
81
+ }) => Prettify<{ [K in keyof Schema]: InferredOuput<Schema[K]> } & {
59
82
  CONVEX_SITE_URL: string;
60
83
  CONVEX_CLOUD_URL: string;
61
- };
84
+ }>;
62
85
  /**
63
86
  *
64
87
  * @description You may want to verify the existence and type of the environment variables separately from the creation of the env object. If so, use this function in convex.config.ts, and use the skipValidation option when calling createEnv.
@@ -89,4 +112,4 @@ declare const verifyEnv: <Schema extends Record<string, AllowedValidators>>(args
89
112
  values?: Values<Schema>;
90
113
  }) => void;
91
114
  //#endregion
92
- export { createEnv, verifyEnv };
115
+ export { type AllowedValidators, type CreateEnvOptions, type InferredOuput, createEnv, verifyEnv };
package/dist/index.mjs CHANGED
@@ -23,7 +23,7 @@ const validateAndTransformBoolean = (value) => {
23
23
  };
24
24
 
25
25
  //#endregion
26
- //#region src/index.ts
26
+ //#region src/env.ts
27
27
  /**
28
28
  *
29
29
  * WARNING: The object returned by `createEnv` should only be accessed within the Convex runtime. The values on the returned object will NOT be accessible client-side.
@@ -34,26 +34,48 @@ const validateAndTransformBoolean = (value) => {
34
34
  * @public
35
35
  *
36
36
  * @example
37
+ *
38
+ * import { betterAuth, oAuth, r2 } from "convex-env/presets";
39
+ * import { v } from "convex/values";
40
+ *
37
41
  * const env = createEnv({
38
- * FOO: v.string(),
39
- * BAR: v.number(),
40
- * BAZ: v.boolean(),
41
- * FIZZ: v.union(v.literal("development"), v.literal("production")),
42
+ * ...betterAuth,
43
+ * ...oAuth.google,
44
+ * ...oAuth.apple,
45
+ * ...r2,
46
+ * OPENAI_API_KEY: v.string(),
47
+ * FREE_REQUESTS_PER_USER: v.number(),
48
+ * DEBUG_MODE: v.optional(v.boolean()),
42
49
  * });
43
50
  *
44
51
  * @example
52
+ * import { v } from "convex/values";
53
+ * import { betterAuth, oAuth, r2 } from "convex-env/presets";
54
+ *
45
55
  * const env = createEnv({
56
+ * ...betterAuth,
57
+ * ...oAuth.google,
58
+ * ...oAuth.apple,
59
+ * ...r2,
46
60
  * schema: {
47
- * FOO: v.string(),
48
- * BAR: v.number(),
49
- * BAZ: v.optional(v.boolean()),
50
- * FIZZ: v.union(v.literal("development"), v.literal("production")),
61
+ * OPENAI_API_KEY: v.string(),
62
+ * FREE_REQUESTS_PER_USER: v.number(),
63
+ * DEBUG_MODE: v.optional(v.boolean()),
51
64
  * },
52
65
  * values: {
53
- * FOO: process.env.FOO,
54
- * BAR: "42",
55
- * BAZ: "true",
56
- * FIZZ: "development",
66
+ * OPENAI_API_KEY: process.env.OPENAI_API_KEY,
67
+ * FREE_REQUESTS_PER_USER: process.env.FREE_REQUESTS_PER_USER,
68
+ * DEBUG_MODE: process.env.DEBUG_MODE,
69
+ * BETTER_AUTH_SECRET: process.env.BETTER_AUTH_SECRET,
70
+ * GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID,
71
+ * GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET,
72
+ * APPLE_CLIENT_ID: process.env.APPLE_CLIENT_ID,
73
+ * APPLE_CLIENT_SECRET: process.env.APPLE_CLIENT_SECRET,
74
+ * R2_TOKEN: process.env.R2_TOKEN,
75
+ * R2_ACCESS_KEY_ID: process.env.R2_ACCESS_KEY_ID,
76
+ * R2_SECRET_ACCESS_KEY: process.env.R2_SECRET_ACCESS_KEY,
77
+ * R2_ENDPOINT: process.env.R2_ENDPOINT,
78
+ * R2_BUCKET: process.env.R2_BUCKET,
57
79
  * },
58
80
  * options: {
59
81
  * skipValidation: true,
@@ -81,7 +103,7 @@ const createEnv = (args) => {
81
103
  const envValue = values[key];
82
104
  if (validator.isOptional === "required" && envValue === void 0 && options?.skipValidation !== true) throw new Error("Variable is required but not found in env");
83
105
  const transformedValue = transformed(envValue, validator);
84
- if (validate(validator, transformedValue) === false && options?.skipValidation !== true) throw new Error(`Variable failed validation`);
106
+ if (validate(validator, transformedValue) === false && options?.skipValidation !== true) throw new Error(`Variable failed to validated as type: ${validator.kind}`);
85
107
  return [key, transformedValue];
86
108
  } catch (error) {
87
109
  const errorMessage = error instanceof Error ? error.message : String(error);
@@ -0,0 +1,382 @@
1
+ import * as convex_values0 from "convex/values";
2
+
3
+ //#region src/presets.d.ts
4
+ declare const environment: {
5
+ ENVIRONMENT: convex_values0.VUnion<"development" | "preview" | "production", [convex_values0.VLiteral<"development", "required">, convex_values0.VLiteral<"preview", "required">, convex_values0.VLiteral<"production", "required">], "required", never>;
6
+ };
7
+ /** Get started with better-auth here:
8
+ * https://labs.convex.dev/better-auth
9
+ */
10
+ declare const betterAuth: {
11
+ BETTER_AUTH_SECRET: convex_values0.VString<string, "required">;
12
+ };
13
+ /** Get started with auth0 here:
14
+ * https://docs.convex.dev/auth/auth0
15
+ */
16
+ declare const auth0: {
17
+ AUTH0_CLIENT_ID: convex_values0.VString<string, "required">;
18
+ AUTH0_DOMAIN: convex_values0.VString<string, "required">;
19
+ };
20
+ /** Get started with workOS here:
21
+ * https://docs.convex.dev/auth/authkit/
22
+ */
23
+ declare const workOS: {
24
+ base: {
25
+ WORKOS_CLIENT_ID: convex_values0.VString<string, "required">;
26
+ WORKOS_CLIENT_SECRET: convex_values0.VString<string, "required">;
27
+ };
28
+ vite: {
29
+ VITE_WORKOS_CLIENT_ID: convex_values0.VString<string, "required">;
30
+ VITE_WORKOS_CLIENT_SECRET: convex_values0.VString<string, "required">;
31
+ };
32
+ next: {
33
+ WORKOS_CLIENT_ID: convex_values0.VString<string, "required">;
34
+ WORKOS_CLIENT_SECRET: convex_values0.VString<string, "required">;
35
+ WORKOS_COOKIE_PASSWORD: convex_values0.VString<string, "required">;
36
+ };
37
+ };
38
+ /** Get started with clerk here:
39
+ * https://docs.convex.dev/auth/clerk
40
+ */
41
+ declare const clerk: {
42
+ CLERK_JWT_ISSUER_DOMAIN: convex_values0.VString<string, "required">;
43
+ };
44
+ /** Get started with resend here:
45
+ * https://www.convex.dev/components/resend
46
+ */
47
+ declare const resend: {
48
+ RESEND_API_KEY: convex_values0.VString<string, "required">;
49
+ RESEND_WEBHOOK_SECRET: convex_values0.VString<string, "required">;
50
+ };
51
+ /** Get started with r2 here:
52
+ * https://www.convex.dev/components/cloudflare-r2
53
+ */
54
+ declare const r2: {
55
+ R2_TOKEN: convex_values0.VString<string, "required">;
56
+ R2_ACCESS_KEY_ID: convex_values0.VString<string, "required">;
57
+ R2_SECRET_ACCESS_KEY: convex_values0.VString<string, "required">;
58
+ R2_ENDPOINT: convex_values0.VString<string, "required">;
59
+ R2_BUCKET: convex_values0.VString<string, "required">;
60
+ };
61
+ /** Get started with stripe here:
62
+ * https://www.convex.dev/components/stripe
63
+ */
64
+ declare const stripe: {
65
+ STRIPE_SECRET_KEY: convex_values0.VString<string, "required">;
66
+ STRIPE_WEBHOOK_SECRET: convex_values0.VString<string, "required">;
67
+ };
68
+ /** Get started with autumn here:
69
+ * https://www.convex.dev/components/autumn
70
+ */
71
+ declare const autumn: {
72
+ AUTUMN_SECRET_KEY: convex_values0.VString<string, "required">;
73
+ };
74
+ /** Get started with dodo here:
75
+ * https://www.convex.dev/components/dodopayments
76
+ */
77
+ declare const dodo: {
78
+ DODO_PAYMENTS_API_KEY: convex_values0.VString<string, "required">;
79
+ DODO_PAYMENTS_WEBHOOK_SECRET: convex_values0.VString<string, "required">;
80
+ DODO_PAYMENTS_ENVIRONMENT: convex_values0.VUnion<"test_mode" | "live_mode", [convex_values0.VLiteral<"test_mode", "required">, convex_values0.VLiteral<"live_mode", "required">], "required", never>;
81
+ };
82
+ /** Get started with polar here:
83
+ * https://www.convex.dev/components/polar
84
+ */
85
+ declare const polar: {
86
+ POLAR_ORGANIZATION_TOKEN: convex_values0.VString<string, "required">;
87
+ POLAR_SERVER: convex_values0.VString<string, "required">;
88
+ POLAR_WEBHOOK_SECRET: convex_values0.VString<string, "required">;
89
+ };
90
+ /** Get started with uploadthing here:
91
+ * https://docs.uploadthing.com/
92
+ */
93
+ declare const uploadthing: {
94
+ UPLOADTHING_TOKEN: convex_values0.VString<string, "required">;
95
+ UPLOADTHING_APP_ID: convex_values0.VString<string, "required">;
96
+ };
97
+ /** Get started with upstash here:
98
+ * https://upstash.com/docs/redis
99
+ */
100
+ declare const upstash: {
101
+ UPSTASH_REDIS_REST_URL: convex_values0.VString<string, "required">;
102
+ UPSTASH_REDIS_REST_TOKEN: convex_values0.VString<string, "required">;
103
+ };
104
+ /** All oAuth providers supported by better-auth:
105
+ * https://www.better-auth.com
106
+ */
107
+ declare const oAuth: {
108
+ /**
109
+ * For info on setting up with better auth, visit here:
110
+ * https://www.better-auth.com/docs/authentication/apple
111
+ */
112
+ apple: {
113
+ APPLE_CLIENT_ID: convex_values0.VString<string, "required">;
114
+ APPLE_CLIENT_SECRET: convex_values0.VString<string, "required">;
115
+ APPLE_APP_BUNDLE_IDENTIFIER: convex_values0.VString<string, "required">;
116
+ };
117
+ /**
118
+ * For info on setting up with better auth, visit here:
119
+ * https://www.better-auth.com/docs/authentication/atlassian
120
+ */
121
+ atlassian: {
122
+ ATLASSIAN_CLIENT_ID: convex_values0.VString<string, "required">;
123
+ ATLASSIAN_CLIENT_SECRET: convex_values0.VString<string, "required">;
124
+ };
125
+ /**
126
+ * For info on setting up with better auth, visit here:
127
+ * https://www.better-auth.com/docs/authentication/cognito
128
+ */
129
+ cognito: {
130
+ COGNITO_CLIENT_ID: convex_values0.VString<string, "required">;
131
+ COGNITO_CLIENT_SECRET: convex_values0.VString<string, "required">;
132
+ COGNITO_DOMAIN: convex_values0.VString<string, "required">;
133
+ COGNITO_REGION: convex_values0.VString<string, "required">;
134
+ COGNITO_USERPOOL_ID: convex_values0.VString<string, "required">;
135
+ };
136
+ /**
137
+ * For info on setting up with better auth, visit here:
138
+ * https://www.better-auth.com/docs/authentication/discord
139
+ */
140
+ discord: {
141
+ DISCORD_CLIENT_ID: convex_values0.VString<string, "required">;
142
+ DISCORD_CLIENT_SECRET: convex_values0.VString<string, "required">;
143
+ };
144
+ /**
145
+ * For info on setting up with better auth, visit here:
146
+ * https://www.better-auth.com/docs/authentication/dropbox
147
+ */
148
+ dropbox: {
149
+ DROPBOX_CLIENT_ID: convex_values0.VString<string, "required">;
150
+ DROPBOX_CLIENT_SECRET: convex_values0.VString<string, "required">;
151
+ };
152
+ /**
153
+ * For info on setting up with better auth, visit here:
154
+ * https://www.better-auth.com/docs/authentication/facebook
155
+ */
156
+ facebook: {
157
+ FACEBOOK_CLIENT_ID: convex_values0.VString<string, "required">;
158
+ FACEBOOK_CLIENT_SECRET: convex_values0.VString<string, "required">;
159
+ };
160
+ /**
161
+ * For info on setting up with better auth, visit here:
162
+ * https://www.better-auth.com/docs/authentication/figma
163
+ */
164
+ figma: {
165
+ FIGMA_CLIENT_ID: convex_values0.VString<string, "required">;
166
+ FIGMA_CLIENT_SECRET: convex_values0.VString<string, "required">;
167
+ FIGMA_CLIENT_KEY: convex_values0.VString<string, "required">;
168
+ };
169
+ /**
170
+ * For info on setting up with better auth, visit here:
171
+ * https://www.better-auth.com/docs/authentication/github
172
+ */
173
+ github: {
174
+ GITHUB_CLIENT_ID: convex_values0.VString<string, "required">;
175
+ GITHUB_CLIENT_SECRET: convex_values0.VString<string, "required">;
176
+ };
177
+ /**
178
+ * For info on setting up with better auth, visit here:
179
+ * https://www.better-auth.com/docs/authentication/gitlab
180
+ */
181
+ gitlab: {
182
+ GITLAB_CLIENT_ID: convex_values0.VString<string, "required">;
183
+ GITLAB_CLIENT_SECRET: convex_values0.VString<string, "required">;
184
+ GITLAB_ISSUER: convex_values0.VString<string, "required">;
185
+ };
186
+ /**
187
+ * For info on setting up with better auth, visit here:
188
+ * https://www.better-auth.com/docs/authentication/google
189
+ */
190
+ google: {
191
+ GOOGLE_CLIENT_ID: convex_values0.VString<string, "required">;
192
+ GOOGLE_CLIENT_SECRET: convex_values0.VString<string, "required">;
193
+ };
194
+ /**
195
+ * For info on setting up with better auth, visit here:
196
+ * https://www.better-auth.com/docs/authentication/huggingface
197
+ */
198
+ huggingFace: {
199
+ HUGGINGFACE_CLIENT_ID: convex_values0.VString<string, "required">;
200
+ HUGGINGFACE_CLIENT_SECRET: convex_values0.VString<string, "required">;
201
+ };
202
+ /**
203
+ * For info on setting up with better auth, visit here:
204
+ * https://www.better-auth.com/docs/authentication/kakao
205
+ */
206
+ kakao: {
207
+ KAKAO_CLIENT_ID: convex_values0.VString<string, "required">;
208
+ KAKAO_CLIENT_SECRET: convex_values0.VString<string, "required">;
209
+ };
210
+ /**
211
+ * For info on setting up with better auth, visit here:
212
+ * https://www.better-auth.com/docs/authentication/kick
213
+ */
214
+ kick: {
215
+ KICK_CLIENT_ID: convex_values0.VString<string, "required">;
216
+ KICK_CLIENT_SECRET: convex_values0.VString<string, "required">;
217
+ };
218
+ /**
219
+ * For info on setting up with better auth, visit here:
220
+ * https://www.better-auth.com/docs/authentication/line
221
+ */
222
+ line: {
223
+ LINE_CLIENT_ID: convex_values0.VString<string, "required">;
224
+ LINE_CLIENT_SECRET: convex_values0.VString<string, "required">;
225
+ };
226
+ /**
227
+ * For info on setting up with better auth, visit here:
228
+ * https://www.better-auth.com/docs/authentication/linear
229
+ */
230
+ linear: {
231
+ LINEAR_CLIENT_ID: convex_values0.VString<string, "required">;
232
+ LINEAR_CLIENT_SECRET: convex_values0.VString<string, "required">;
233
+ };
234
+ /**
235
+ * For info on setting up with better auth, visit here:
236
+ * https://www.better-auth.com/docs/authentication/linkedin
237
+ */
238
+ linkedin: {
239
+ LINKEDIN_CLIENT_ID: convex_values0.VString<string, "required">;
240
+ LINKEDIN_CLIENT_SECRET: convex_values0.VString<string, "required">;
241
+ };
242
+ /**
243
+ * For info on setting up with better auth, visit here:
244
+ * https://www.better-auth.com/docs/authentication/microsoft
245
+ */
246
+ microsoft: {
247
+ MICROSOFT_CLIENT_ID: convex_values0.VString<string, "required">;
248
+ MICROSOFT_CLIENT_SECRET: convex_values0.VString<string, "required">;
249
+ };
250
+ /**
251
+ * For info on setting up with better auth, visit here:
252
+ * https://www.better-auth.com/docs/authentication/naver
253
+ */
254
+ naver: {
255
+ NAVER_CLIENT_ID: convex_values0.VString<string, "required">;
256
+ NAVER_CLIENT_SECRET: convex_values0.VString<string, "required">;
257
+ };
258
+ /**
259
+ * For info on setting up with better auth, visit here:
260
+ * https://www.better-auth.com/docs/authentication/notion
261
+ */
262
+ notion: {
263
+ NOTION_CLIENT_ID: convex_values0.VString<string, "required">;
264
+ NOTION_CLIENT_SECRET: convex_values0.VString<string, "required">;
265
+ };
266
+ /**
267
+ * For info on setting up with better auth, visit here:
268
+ * https://www.better-auth.com/docs/authentication/paybin
269
+ */
270
+ paybin: {
271
+ PAYBIN_CLIENT_ID: convex_values0.VString<string, "required">;
272
+ PAYBIN_CLIENT_SECRET: convex_values0.VString<string, "required">;
273
+ };
274
+ /**
275
+ * For info on setting up with better auth, visit here:
276
+ * https://www.better-auth.com/docs/authentication/paypal
277
+ */
278
+ paypal: {
279
+ PAYPAL_CLIENT_ID: convex_values0.VString<string, "required">;
280
+ PAYPAL_CLIENT_SECRET: convex_values0.VString<string, "required">;
281
+ PAYPAL_ENVIRONMENT: convex_values0.VUnion<"sandbox" | "live", [convex_values0.VLiteral<"sandbox", "required">, convex_values0.VLiteral<"live", "required">], "required", never>;
282
+ };
283
+ /**
284
+ * For info on setting up with better auth, visit here:
285
+ * https://www.better-auth.com/docs/authentication/polar
286
+ */
287
+ polar: {
288
+ POLAR_CLIENT_ID: convex_values0.VString<string, "required">;
289
+ POLAR_CLIENT_SECRET: convex_values0.VString<string, "required">;
290
+ };
291
+ /**
292
+ * For info on setting up with better auth, visit here:
293
+ * https://www.better-auth.com/docs/authentication/reddit
294
+ */
295
+ reddit: {
296
+ REDDIT_CLIENT_ID: convex_values0.VString<string, "required">;
297
+ REDDIT_CLIENT_SECRET: convex_values0.VString<string, "required">;
298
+ };
299
+ /**
300
+ * For info on setting up with better auth, visit here:
301
+ * https://www.better-auth.com/docs/authentication/roblox
302
+ */
303
+ roblox: {
304
+ ROBLOX_CLIENT_ID: convex_values0.VString<string, "required">;
305
+ ROBLOX_CLIENT_SECRET: convex_values0.VString<string, "required">;
306
+ };
307
+ /**
308
+ * For info on setting up with better auth, visit here:
309
+ * https://www.better-auth.com/docs/authentication/spotify
310
+ */
311
+ spotify: {
312
+ SPOTIFY_CLIENT_ID: convex_values0.VString<string, "required">;
313
+ SPOTIFY_CLIENT_SECRET: convex_values0.VString<string, "required">;
314
+ };
315
+ /**
316
+ * For info on setting up with better auth, visit here:
317
+ * https://www.better-auth.com/docs/authentication/salesforce
318
+ */
319
+ salesforce: {
320
+ SALESFORCE_CLIENT_ID: convex_values0.VString<string, "required">;
321
+ SALESFORCE_CLIENT_SECRET: convex_values0.VString<string, "required">;
322
+ SALESFORCE_ENVIRONMENT: convex_values0.VUnion<"production" | "sandbox", [convex_values0.VLiteral<"sandbox", "required">, convex_values0.VLiteral<"production", "required">], "required", never>;
323
+ };
324
+ /**
325
+ * For info on setting up with better auth, visit here:
326
+ * https://www.better-auth.com/docs/authentication/slack
327
+ */
328
+ slack: {
329
+ SLACK_CLIENT_ID: convex_values0.VString<string, "required">;
330
+ SLACK_CLIENT_SECRET: convex_values0.VString<string, "required">;
331
+ };
332
+ /**
333
+ * For info on setting up with better auth, visit here:
334
+ * https://www.better-auth.com/docs/authentication/tiktok
335
+ */
336
+ tiktok: {
337
+ TIKTOK_CLIENT_KEY: convex_values0.VString<string, "required">;
338
+ TIKTOK_CLIENT_SECRET: convex_values0.VString<string, "required">;
339
+ };
340
+ /**
341
+ * For info on setting up with better auth, visit here:
342
+ * https://www.better-auth.com/docs/authentication/twitch
343
+ */
344
+ twitch: {
345
+ TWITCH_CLIENT_ID: convex_values0.VString<string, "required">;
346
+ TWITCH_CLIENT_SECRET: convex_values0.VString<string, "required">;
347
+ };
348
+ /**
349
+ * For info on setting up with better auth, visit here:
350
+ * https://www.better-auth.com/docs/authentication/twitter
351
+ */
352
+ twitter: {
353
+ TWITTER_CLIENT_ID: convex_values0.VString<string, "required">;
354
+ TWITTER_CLIENT_SECRET: convex_values0.VString<string, "required">;
355
+ };
356
+ /**
357
+ * For info on setting up with better auth, visit here:
358
+ * https://www.better-auth.com/docs/authentication/vercel
359
+ */
360
+ vercel: {
361
+ VERCEL_CLIENT_ID: convex_values0.VString<string, "required">;
362
+ VERCEL_CLIENT_SECRET: convex_values0.VString<string, "required">;
363
+ };
364
+ /**
365
+ * For info on setting up with better auth, visit here:
366
+ * https://www.better-auth.com/docs/authentication/vk
367
+ */
368
+ vk: {
369
+ VK_CLIENT_ID: convex_values0.VString<string, "required">;
370
+ VK_CLIENT_SECRET: convex_values0.VString<string, "required">;
371
+ };
372
+ /**
373
+ * For info on setting up with better auth, visit here:
374
+ * https://www.better-auth.com/docs/authentication/zoom
375
+ */
376
+ zoom: {
377
+ ZOOM_CLIENT_ID: convex_values0.VString<string, "required">;
378
+ ZOOM_CLIENT_SECRET: convex_values0.VString<string, "required">;
379
+ };
380
+ };
381
+ //#endregion
382
+ export { auth0, autumn, betterAuth, clerk, dodo, environment, oAuth, polar, r2, resend, stripe, uploadthing, upstash, workOS };
@@ -0,0 +1,243 @@
1
+ import { v } from "convex/values";
2
+
3
+ //#region src/presets.ts
4
+ const environment = { ENVIRONMENT: v.union(v.literal("development"), v.literal("preview"), v.literal("production")) };
5
+ /** Get started with better-auth here:
6
+ * https://labs.convex.dev/better-auth
7
+ */
8
+ const betterAuth = { BETTER_AUTH_SECRET: v.string() };
9
+ /** Get started with auth0 here:
10
+ * https://docs.convex.dev/auth/auth0
11
+ */
12
+ const auth0 = {
13
+ AUTH0_CLIENT_ID: v.string(),
14
+ AUTH0_DOMAIN: v.string()
15
+ };
16
+ /** Get started with workOS here:
17
+ * https://docs.convex.dev/auth/authkit/
18
+ */
19
+ const workOS = {
20
+ base: {
21
+ WORKOS_CLIENT_ID: v.string(),
22
+ WORKOS_CLIENT_SECRET: v.string()
23
+ },
24
+ vite: {
25
+ VITE_WORKOS_CLIENT_ID: v.string(),
26
+ VITE_WORKOS_CLIENT_SECRET: v.string()
27
+ },
28
+ next: {
29
+ WORKOS_CLIENT_ID: v.string(),
30
+ WORKOS_CLIENT_SECRET: v.string(),
31
+ WORKOS_COOKIE_PASSWORD: v.string()
32
+ }
33
+ };
34
+ /** Get started with clerk here:
35
+ * https://docs.convex.dev/auth/clerk
36
+ */
37
+ const clerk = { CLERK_JWT_ISSUER_DOMAIN: v.string() };
38
+ /** Get started with resend here:
39
+ * https://www.convex.dev/components/resend
40
+ */
41
+ const resend = {
42
+ RESEND_API_KEY: v.string(),
43
+ RESEND_WEBHOOK_SECRET: v.string()
44
+ };
45
+ /** Get started with r2 here:
46
+ * https://www.convex.dev/components/cloudflare-r2
47
+ */
48
+ const r2 = {
49
+ R2_TOKEN: v.string(),
50
+ R2_ACCESS_KEY_ID: v.string(),
51
+ R2_SECRET_ACCESS_KEY: v.string(),
52
+ R2_ENDPOINT: v.string(),
53
+ R2_BUCKET: v.string()
54
+ };
55
+ /** Get started with stripe here:
56
+ * https://www.convex.dev/components/stripe
57
+ */
58
+ const stripe = {
59
+ STRIPE_SECRET_KEY: v.string(),
60
+ STRIPE_WEBHOOK_SECRET: v.string()
61
+ };
62
+ /** Get started with autumn here:
63
+ * https://www.convex.dev/components/autumn
64
+ */
65
+ const autumn = { AUTUMN_SECRET_KEY: v.string() };
66
+ /** Get started with dodo here:
67
+ * https://www.convex.dev/components/dodopayments
68
+ */
69
+ const dodo = {
70
+ DODO_PAYMENTS_API_KEY: v.string(),
71
+ DODO_PAYMENTS_WEBHOOK_SECRET: v.string(),
72
+ DODO_PAYMENTS_ENVIRONMENT: v.union(v.literal("test_mode"), v.literal("live_mode"))
73
+ };
74
+ /** Get started with polar here:
75
+ * https://www.convex.dev/components/polar
76
+ */
77
+ const polar = {
78
+ POLAR_ORGANIZATION_TOKEN: v.string(),
79
+ POLAR_SERVER: v.string(),
80
+ POLAR_WEBHOOK_SECRET: v.string()
81
+ };
82
+ /** Get started with uploadthing here:
83
+ * https://docs.uploadthing.com/
84
+ */
85
+ const uploadthing = {
86
+ UPLOADTHING_TOKEN: v.string(),
87
+ UPLOADTHING_APP_ID: v.string()
88
+ };
89
+ /** Get started with upstash here:
90
+ * https://upstash.com/docs/redis
91
+ */
92
+ const upstash = {
93
+ UPSTASH_REDIS_REST_URL: v.string(),
94
+ UPSTASH_REDIS_REST_TOKEN: v.string()
95
+ };
96
+ /** All oAuth providers supported by better-auth:
97
+ * https://www.better-auth.com
98
+ */
99
+ const oAuth = {
100
+ apple: {
101
+ APPLE_CLIENT_ID: v.string(),
102
+ APPLE_CLIENT_SECRET: v.string(),
103
+ APPLE_APP_BUNDLE_IDENTIFIER: v.string()
104
+ },
105
+ atlassian: {
106
+ ATLASSIAN_CLIENT_ID: v.string(),
107
+ ATLASSIAN_CLIENT_SECRET: v.string()
108
+ },
109
+ cognito: {
110
+ COGNITO_CLIENT_ID: v.string(),
111
+ COGNITO_CLIENT_SECRET: v.string(),
112
+ COGNITO_DOMAIN: v.string(),
113
+ COGNITO_REGION: v.string(),
114
+ COGNITO_USERPOOL_ID: v.string()
115
+ },
116
+ discord: {
117
+ DISCORD_CLIENT_ID: v.string(),
118
+ DISCORD_CLIENT_SECRET: v.string()
119
+ },
120
+ dropbox: {
121
+ DROPBOX_CLIENT_ID: v.string(),
122
+ DROPBOX_CLIENT_SECRET: v.string()
123
+ },
124
+ facebook: {
125
+ FACEBOOK_CLIENT_ID: v.string(),
126
+ FACEBOOK_CLIENT_SECRET: v.string()
127
+ },
128
+ figma: {
129
+ FIGMA_CLIENT_ID: v.string(),
130
+ FIGMA_CLIENT_SECRET: v.string(),
131
+ FIGMA_CLIENT_KEY: v.string()
132
+ },
133
+ github: {
134
+ GITHUB_CLIENT_ID: v.string(),
135
+ GITHUB_CLIENT_SECRET: v.string()
136
+ },
137
+ gitlab: {
138
+ GITLAB_CLIENT_ID: v.string(),
139
+ GITLAB_CLIENT_SECRET: v.string(),
140
+ GITLAB_ISSUER: v.string()
141
+ },
142
+ google: {
143
+ GOOGLE_CLIENT_ID: v.string(),
144
+ GOOGLE_CLIENT_SECRET: v.string()
145
+ },
146
+ huggingFace: {
147
+ HUGGINGFACE_CLIENT_ID: v.string(),
148
+ HUGGINGFACE_CLIENT_SECRET: v.string()
149
+ },
150
+ kakao: {
151
+ KAKAO_CLIENT_ID: v.string(),
152
+ KAKAO_CLIENT_SECRET: v.string()
153
+ },
154
+ kick: {
155
+ KICK_CLIENT_ID: v.string(),
156
+ KICK_CLIENT_SECRET: v.string()
157
+ },
158
+ line: {
159
+ LINE_CLIENT_ID: v.string(),
160
+ LINE_CLIENT_SECRET: v.string()
161
+ },
162
+ linear: {
163
+ LINEAR_CLIENT_ID: v.string(),
164
+ LINEAR_CLIENT_SECRET: v.string()
165
+ },
166
+ linkedin: {
167
+ LINKEDIN_CLIENT_ID: v.string(),
168
+ LINKEDIN_CLIENT_SECRET: v.string()
169
+ },
170
+ microsoft: {
171
+ MICROSOFT_CLIENT_ID: v.string(),
172
+ MICROSOFT_CLIENT_SECRET: v.string()
173
+ },
174
+ naver: {
175
+ NAVER_CLIENT_ID: v.string(),
176
+ NAVER_CLIENT_SECRET: v.string()
177
+ },
178
+ notion: {
179
+ NOTION_CLIENT_ID: v.string(),
180
+ NOTION_CLIENT_SECRET: v.string()
181
+ },
182
+ paybin: {
183
+ PAYBIN_CLIENT_ID: v.string(),
184
+ PAYBIN_CLIENT_SECRET: v.string()
185
+ },
186
+ paypal: {
187
+ PAYPAL_CLIENT_ID: v.string(),
188
+ PAYPAL_CLIENT_SECRET: v.string(),
189
+ PAYPAL_ENVIRONMENT: v.union(v.literal("sandbox"), v.literal("live"))
190
+ },
191
+ polar: {
192
+ POLAR_CLIENT_ID: v.string(),
193
+ POLAR_CLIENT_SECRET: v.string()
194
+ },
195
+ reddit: {
196
+ REDDIT_CLIENT_ID: v.string(),
197
+ REDDIT_CLIENT_SECRET: v.string()
198
+ },
199
+ roblox: {
200
+ ROBLOX_CLIENT_ID: v.string(),
201
+ ROBLOX_CLIENT_SECRET: v.string()
202
+ },
203
+ spotify: {
204
+ SPOTIFY_CLIENT_ID: v.string(),
205
+ SPOTIFY_CLIENT_SECRET: v.string()
206
+ },
207
+ salesforce: {
208
+ SALESFORCE_CLIENT_ID: v.string(),
209
+ SALESFORCE_CLIENT_SECRET: v.string(),
210
+ SALESFORCE_ENVIRONMENT: v.union(v.literal("sandbox"), v.literal("production"))
211
+ },
212
+ slack: {
213
+ SLACK_CLIENT_ID: v.string(),
214
+ SLACK_CLIENT_SECRET: v.string()
215
+ },
216
+ tiktok: {
217
+ TIKTOK_CLIENT_KEY: v.string(),
218
+ TIKTOK_CLIENT_SECRET: v.string()
219
+ },
220
+ twitch: {
221
+ TWITCH_CLIENT_ID: v.string(),
222
+ TWITCH_CLIENT_SECRET: v.string()
223
+ },
224
+ twitter: {
225
+ TWITTER_CLIENT_ID: v.string(),
226
+ TWITTER_CLIENT_SECRET: v.string()
227
+ },
228
+ vercel: {
229
+ VERCEL_CLIENT_ID: v.string(),
230
+ VERCEL_CLIENT_SECRET: v.string()
231
+ },
232
+ vk: {
233
+ VK_CLIENT_ID: v.string(),
234
+ VK_CLIENT_SECRET: v.string()
235
+ },
236
+ zoom: {
237
+ ZOOM_CLIENT_ID: v.string(),
238
+ ZOOM_CLIENT_SECRET: v.string()
239
+ }
240
+ };
241
+
242
+ //#endregion
243
+ export { auth0, autumn, betterAuth, clerk, dodo, environment, oAuth, polar, r2, resend, stripe, uploadthing, upstash, workOS };
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "convex-env",
3
3
  "type": "module",
4
- "version": "2.2.0",
4
+ "version": "2.3.0",
5
5
  "license": "MIT",
6
6
  "description": "Type-safe access to environment variables in Convex",
7
7
  "exports": {
8
8
  ".": "./dist/index.mjs",
9
+ "./presets": "./dist/presets.mjs",
9
10
  "./package.json": "./package.json"
10
11
  },
11
12
  "keywords": [
@@ -20,6 +21,7 @@
20
21
  "main": "./dist/index.mjs",
21
22
  "module": "./dist/index.mjs",
22
23
  "types": "./dist/index.d.mts",
24
+ "sideEffects": false,
23
25
  "files": [
24
26
  "dist"
25
27
  ],