Library API
newt can be imported programmatically for use in custom tooling, CI pipelines, or higher-level generators.
import {
generate,
languages,
getLanguage,
getFramework
} from "@linuxctrl/newt";languages
The full registry of languages, frameworks, and dependencies as an array of LanguageEntry objects.
console.log(languages.map(l => l.name));
// ['TypeScript', 'Python', 'Rust', 'Go', 'Zig']getLanguage(language)
Look up a language entry by its identifier.
const ts = getLanguage("typescript");
console.log(ts.frameworks.map(f => f.name));
// ['React (Vite)', 'Next.js', 'Vue (Vite)', 'Nuxt', ...]getFramework(language, frameworkId)
Look up a specific framework within a language.
const fastapi = getFramework("python", "fastapi");
console.log(fastapi.deps.map(d => d.name));
// ['SQLAlchemy', 'Alembic', 'Pydantic', 'Pytest', ...]generate(answers, options?)
Generate a full project. This is the core function — it creates the directory, runs the framework scaffold, and installs dependencies.
Parameters
| Property | Type | Description |
|---|---|---|
language | Language | "typescript" | "python" | "rust" | "go" | "zig" |
framework | Framework | The framework object from the registry |
deps | Dep[] | Selected dependencies to install |
name | string | Project name (used as directory name) |
directory | string | Parent directory path (relative to cwd) |
Options
| Option | Type | Default | Description |
|---|---|---|---|
cwd | string | process.cwd() | Working directory for project creation |
dryRun | boolean | false | If true, only print what would be done |
Example
import { generate, getFramework, getLanguage } from "@linuxctrl/newt";
const lang = getLanguage("typescript");
const express = getFramework("typescript", "express");
await generate({
language: "typescript",
framework: express!,
deps: [],
name: "my-api",
directory: "",
});Types
Language
type Language = 'typescript' | 'python' | 'rust' | 'go' | 'zig';LanguageEntry
interface LanguageEntry {
id: Language;
name: string;
icon: string;
frameworks: Framework[];
}Framework
interface Framework {
id: string;
name: string;
description: string;
create: string | null; // CLI template with {name} placeholder
deps: Dep[];
}Dep
interface Dep {
id: string;
name: string;
description: string;
category: string; // e.g. "database", "testing", "styling"
install: string; // install command (empty string = no-op)
}ProjectAnswers
interface ProjectAnswers {
language: Language;
framework: Framework;
deps: Dep[];
name: string;
directory: string;
}