
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@ty-ras-extras/config-zod
Advanced tools
Utility methods to acquire application configurations from strings which are serialized JSON, with runtime validation of `zod` library.
This folder contains library which exposes few utility functions which can be used by both backend and frontend applications to read configurations from strings (e.g. environment variables).
The strings are parsed as necessary and then validated at runtime using zod library.
import * as t from "zod";
import { configuration } from "@ty-ras-extras/frontend-zod";
// Or, if not using bundled libraries: import * as configuration from "@ty-ras-extras/config-zod/string";
// Define runtime validation of configuration
const validation = t.object({
someStringProperty: t.string,
});
// Acquire configuration
export const config = configuration.validateFromStringifiedJSONOrThrow(
validation,
import.meta.env["MY_FE_CONFIG"], // Or, if webpack: process.env["MY_FE_CONFIG"]),
);
// The compile-time type of 'config' is now:
// {
// someStringProperty: string
// }
For situations where environment variable is always serialized JSON:
import * as t from "zod";
import { configuration } from "@ty-ras-extras/backend-zod";
// Or, if not using bundled libraries: import * as configuration from "@ty-ras-extras/config-zod";
// Define runtime validation of configuration
const validation = t.object({
someStringProperty: t.string,
});
// Acquire configuration
export const config = configuration.validateFromStringifiedJSONOrThrow(
validation,
process.env["MY_BE_CONFIG"],
);
// The compile-time type of 'config' is now:
// {
// someStringProperty: string
// }
For situations where environment variable is either serialized JSON or a path to file containing serialized JSON:
import * as t from "zod";
import { configuration } from "@ty-ras-extras/backend-zod";
// Or, if not using bundled libraries: import * as configuration from "@ty-ras-extras/config-zod";
// Define runtime validation of configuration
const validation = t.object({
someStringProperty: t.string,
});
// Acquire configuration
export const acquireConfiguration = async () => configuration.validateFromStringifiedJSONOrThrow(
validation,
await configuration.getJSONStringValueFromStringWhichIsJSONOrFilename(
process.env["MY_BE_CONFIG"]
)
);
// The compile-time type of 'acquireConfiguration' is now:
// () => Promise<{
// someStringProperty: string
// }>
FAQs
Utility methods to acquire application configurations from strings which are serialized JSON, with runtime validation of `zod` library.
We found that @ty-ras-extras/config-zod demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.