SShortSingh.
Back to feed

CtroEnv Lets Libraries Ship Typed Env Schemas for Safer Config Sharing

0
·1 views

A developer-focused pattern using the CtroEnv library allows packages to export their environment variable requirements as typed schemas, replacing error-prone README documentation. The defineSchema() function acts as an identity at runtime but preserves validator types for TypeScript composition. Teams can extend base schemas using extendSchema(), which merges variables automatically and lets extension-level definitions override conflicting keys. For custom formats like hex colors or IP addresses, CtroEnv provides a createValidator() API that supports chainable methods such as .optional(), .default(), and .secret(). The approach is designed for monorepos, where a shared package defines common variables and individual services extend them with their own specific requirements.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingHacker News ·

VoidZero Launches Vite+ Beta for Enhanced Web Development

VoidZero has announced the beta release of Vite+, an evolution of the popular Vite front-end build tool. The beta is now available for developers to test and provide feedback. Vite+ aims to build upon the existing Vite ecosystem with additional capabilities and improvements. The announcement was made via VoidZero's official blog at voidzero.dev. Details about specific new features are outlined in the official release post.

0
ProgrammingDEV Community ·

How AI coding agents rack up costs through small, reasonable-seeming decisions

Agentic coding tools can become surprisingly expensive not through obvious mistakes but through many individually justifiable micro-decisions that accumulate over time. A developer analyzing their own billing identified five key cost drivers: keeping too many files in the main agent's context, reading more files than necessary, using powerful frontier models for simple lookup tasks, generating long outputs inline instead of delegating to cheaper sub-agents, and allowing context bloat that silently inflates costs on every subsequent turn. Because each decision feels harmless in the moment, the author argues that personal discipline alone cannot solve the problem. Instead, they built a structural solution comprising a per-tool-call spending hook, a model router, and a parent-child agent delegation system. Notably, the cost-cutting measures also improved output quality by keeping the main agent more focused and accurate.

0
ProgrammingDEV Community ·

Open-Source Blazor JWT Starter Template Released for .NET 10 with Radzen UI

A developer has published a production-ready open-source starter template that demonstrates secure JWT authentication in Blazor applications built on .NET 10. The template combines JWT Bearer authentication for API communication with cookie-based authentication for the Blazor front end, alongside Radzen UI components. It follows a clean layered architecture separating Domain, Application, Infrastructure, and Shared concerns. The project includes a WebAPI acting as a JWT token authority and a Blazor Server app handling user sessions via secure HttpOnly cookies. The template is aimed at developers looking to skip repetitive authentication boilerplate when building enterprise or experimental Blazor applications.

0
ProgrammingDEV Community ·

How Durable Execution with DBOS Delivers Exactly-Once Automation in TypeScript

A developer migrated 34 production automations from a no-code visual platform to TypeScript, citing durable execution with exactly-once semantics as the key motivation. Traditional automation tools typically offer retry-on-failure, which risks re-executing side effects like sending messages or writing records when a process crashes mid-workflow. DBOS addresses this by checkpointing each completed step in Postgres, so if a workflow crashes between steps, it resumes from where it left off rather than restarting entirely. The framework uses TypeScript decorators to distinguish workflow orchestration logic from individual steps, enforcing a rule that steps are never re-executed once recorded as complete. This approach eliminates the need for manual idempotency keys and progress-tracking boilerplate, reducing automation code to pure business logic.

CtroEnv Lets Libraries Ship Typed Env Schemas for Safer Config Sharing · ShortSingh