scaffold

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmbedFS embed.FS
View Source
var Registry = []Template{
	{
		ID:          "go-api",
		Name:        "Go REST API",
		Description: "Production-ready Go HTTP API — Chi router, PostgreSQL, migrations, Docker, CI",
		Language:    "go",
		HasDatabase: true,
		DBEngine:    "postgres",
	},
	{
		ID:          "go-cli",
		Name:        "Go CLI Tool",
		Description: "Go CLI tool — Cobra, GoReleaser, cross-platform CI pipeline",
		Language:    "go",
		HasDatabase: false,
	},
	{
		ID:          "node-api",
		Name:        "Node.js REST API",
		Description: "TypeScript Express API — Prisma ORM, PostgreSQL, Jest, Docker, CI",
		Language:    "node",
		HasDatabase: true,
		DBEngine:    "postgres",
	},
	{
		ID:          "next-app",
		Name:        "Next.js Full-Stack App",
		Description: "Next.js 14 App Router — TypeScript, Prisma, PostgreSQL, Tailwind, CI",
		Language:    "node",
		HasDatabase: true,
		DBEngine:    "postgres",
	},
	{
		ID:          "python-api",
		Name:        "Python FastAPI",
		Description: "FastAPI — SQLAlchemy, Alembic migrations, PostgreSQL, Docker, CI",
		Language:    "python",
		HasDatabase: true,
		DBEngine:    "postgres",
	},
	{
		ID:          "empty",
		Name:        "Empty (devx-only)",
		Description: "Bare-minimum devx.yaml + .gitignore + README — bring your own stack",
		Language:    "",
		HasDatabase: false,
	},
}

Registry contains all built-in templates.

Functions

func GitAuthor

func GitAuthor() string

GitAuthor returns the user's configured git name, falling back to the OS user.

func PostScaffold

func PostScaffold(templateID, targetDir string) error

PostScaffold runs git init and language-specific setup in targetDir.

Types

type Result

type Result struct {
	Written []string // files that were created or updated
	Skipped []string // files that already existed and were preserved
}

Result contains a per-file breakdown of the scaffold operation.

func Scaffold

func Scaffold(templateID, targetDir string, vars Vars, force bool) (Result, error)

Scaffold renders the template with id into targetDir using the provided vars. Files ending in .tmpl are rendered; all other files are copied verbatim. Existing files are skipped unless force is true.

type Template

type Template struct {
	ID          string // matches the directory name under templates/
	Name        string // human-readable display name
	Description string // shown in the interactive picker
	Language    string // "go", "node", "python", ""
	HasDatabase bool   // whether this template provisions a DB
	DBEngine    string // default DB engine for this template
}

Template describes a single embedded scaffold template.

func Find

func Find(id string) (Template, bool)

Find returns the Template with the given ID.

type Vars

type Vars struct {
	ProjectName string // e.g. "my-service"
	ProjectSlug string // snake_case version, e.g. "my_service"
	ModulePath  string // Go module path, e.g. "github.com/acme/go-my-service"
	Author      string // e.g. "James Nguyen"
	Year        string // e.g. "2026"
	Domain      string // e.g. "ipv1337.dev"
	GoVersion   string // e.g. "1.22"
	Description string // one-line project description
	HasDatabase bool   // whether the template provisions a database
	DBEngine    string // e.g. "postgres"
}

Vars holds all substitution variables available inside every .tmpl file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL