LiorCohen/sdd / plugin/fullstack-typescript/skills/components/backend/backend-scaffolding
backend-scaffolding
VerifiedScaffolds Node.js/TypeScript backend components with CMDO architecture, driven by component settings.
templates/src/config/load_config.ts
View on GitHubimport { readFileSync, existsSync } from 'node:fs';
import { parse } from 'yaml';
import Ajv2020 from 'ajv/dist/2020.js';
// Config type - components should define their own specific types in @{project}/config/types
// and import them via workspace dependency
export type Config = Readonly<{
readonly port?: number;
readonly probesPort?: number;
readonly logLevel?: string;
readonly database?: Readonly<{
readonly host?: string;
readonly port?: number;
readonly name?: string;
readonly user?: string;
readonly passwordSecret?: string;
readonly pool?: number;
}>;
}>;
export const loadConfig = (): Config => {
const configPath = process.env.SDD_CONFIG_PATH;
if (!configPath) {
throw new Error('SDD_CONFIG_PATH environment variable is required');
}
if (!existsSync(configPath)) {
throw new Error(`Config file not found: ${configPath}`);
}
const config = parse(readFileSync(configPath, 'utf-8')) as Config;
// Validate against schema if present (schema placed alongside config by the system CLI)
const schemaPath = configPath.replace(/\.yaml$/, '.schema.json');
if (existsSync(schemaPath)) {
const schema = JSON.parse(readFileSync(schemaPath, 'utf-8')) as object;
const ajv = new Ajv2020();
const validate = ajv.compile(schema);
if (!validate(config)) {
throw new Error(`Config validation failed: ${JSON.stringify(validate.errors)}`);
}
}
return config;
};
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |