How manish-9245/hackpack works
Purpose and Entry Points
Hackpack is a deterministic project scaffolder: it composes a framework base, optional feature packs, and pages/CRUD scaffolds into deployable TypeScript or Python projects. The production CLI is Node/npm, launched by cli/bin/hackpack.js and dispatched through cli/src/index.ts; its command surface is implemented under cli/src/commands/. An experimental standalone Go implementation starts at go-cli/cmd/hackpack/main.go.
CLI Command Layer
Commands define user-facing lifecycle operations: create (new), layer a feature (add), generate CRUD (page add), reapply/update, manage registries, and deploy. The TypeScript implementations are cli/src/commands/new.ts, cli/src/commands/add.ts, and cli/src/commands/pageAdd.ts; deployment is isolated in cli/src/commands/deploy.ts. Commands orchestrate composition and filesystem effects rather than embedding framework-specific templates.
Registry and Template Contract
The registry is the core extension boundary: a registry supplies bases/, features/, and pages/ folders, locally or from a Git source. Resolution and registry management live in cli/src/registry.ts and cli/src/commands/registry.ts. Each template pack declares metadata and compatibility through colocated template.config.json, for example templates/bases/ts-nextjs/template.config.json and templates/features/db-d1-drizzle/template.config.json.
Composition Pipeline
new selects a base, then overlays compatible features and requested pages into the target project. Composition and rendering are centralized in cli/src/compose.ts and cli/src/generate.ts; file operations are bounded in cli/src/fsutil.ts. The base establishes runtime, scripts, and deployment configuration; feature overlays add dependencies, environment requirements, source files, and integration wiring. Template material is data-driven Handlebars/filesystem content, notably templates/bases/ and templates/features/.
Page and CRUD Generation
Prebuilt pages are applied from templates/pages/, with variants selected by installed capabilities such as auth: templates/pages/login/variants/auth-better-auth/ and templates/pages/dashboard/variants/. Dynamic CRUD generation parses explicit fields or local natural-language descriptions, then renders stack-specific scaffold templates and inserts code at declared anchors. This stage is implemented by cli/src/commands/pageAdd.ts, cli/src/nlp.ts, and templates/pages/_scaffold/; it may update UI routes, API handlers, schemas, migrations, and dashboard navigation without arbitrary code execution.
Target Runtimes and External Services
Generated targets include Next.js, Vite/React, SvelteKit, Hono, FastAPI/Pyodide, and Nuxt/Svelte variants, defined in templates/bases/. Cloudflare Workers is the primary deployment target, configured per base through files such as templates/bases/ts-nextjs/wrangler.jsonc.hbs; D1 integrations are supplied by templates/features/db-d1-drizzle/ and templates/features/db-d1-sqlmodel/. Optional packs integrate Better Auth/JWT and AI frameworks including LangChain, Mastra, Pydantic AI, and Vercel AI SDK.
Parallel Distributions and Marketing Site
The Go CLI mirrors the composition architecture through go-cli/internal/compose/compose.go, go-cli/internal/generate/generate.go, and go-cli/internal/registry/registry.go, but is explicitly experimental and lacks the Node CLI’s NLP capability. Separately, landing/ is a Next.js/Vercel showcase application, entered at landing/pages/index.tsx; it is not part of the scaffolding runtime.
Main entry points: compose.ts Composition engine · registry.ts Registry resolution · new.ts Project creation · add.ts Feature layering
Components 21
Production Node CLI
npm-distributed scaffolding runtime.
- CLI launcher
cli/bin/hackpack.js - Command dispatcher
cli/src/index.ts - Lifecycle commands · New, add, update, registry, and deploy operations.
- Project creation
cli/src/commands/new.ts - Feature layering
cli/src/commands/add.ts - Pages and CRUD
cli/src/commands/pageAdd.ts - Deployment
cli/src/commands/deploy.ts - Registry resolution · Resolves local or Git template registries.
cli/src/registry.ts - Composition engine · Overlays compatible bases, features, and pages.
cli/src/compose.ts - Renderer and writer · Renders Handlebars content and writes target files.
cli/src/generate.ts - Field description parser · Turns local descriptions into explicit CRUD fields.
cli/src/nlp.ts
Registry Templates
Composable base, feature, and page packs.
- Pack metadata · Declares pack metadata and compatibility.
templates/bases/ts-nextjs/template.config.json - Framework bases · Establish runtime, scripts, and deployment configuration.
- Feature packs · Add dependencies, integrations, and environment requirements.
- Page packs and scaffolds · Includes variants and stack-specific CRUD scaffolds.
Experimental Go CLI
Standalone mirror without NLP generation.
- Go CLI entrypoint
go-cli/cmd/hackpack/main.go - Go composition pipeline · Experimental mirror of registry, compose, and generate stages.
go-cli/internal/compose/compose.go
Generated Projects
Deployable target applications and services.
- Generated application · Next.js, Vite, SvelteKit, Hono, FastAPI, Nuxt, or Svelte target.
- Cloudflare Workers · Primary deployment target configured by bases.
templates/bases/ts-nextjs/wrangler.jsonc.hbs - Cloudflare D1 · Optional Drizzle or SQLModel data layer.
Other components
- Marketing site · Separate Vercel application, not part of scaffolding.
landing/pages/index.tsx
Connections 25
- CLI launcher → Command dispatcher: launches
- Command dispatcher → Lifecycle commands: dispatches
- Lifecycle commands → Project creation: create
- Lifecycle commands → Feature layering: add
- Lifecycle commands → Pages and CRUD: page add
- Lifecycle commands → Deployment: deploy
- Project creation → Registry resolution: selects packs
- Feature layering → Registry resolution: resolves feature
- Pages and CRUD → Field description parser: parses descriptions
- Pages and CRUD → Composition engine: applies pages
- Registry resolution → Pack metadata: validates
- Registry resolution → Framework bases: resolves
- Registry resolution → Feature packs: resolves
- Registry resolution → Page packs and scaffolds: resolves
- Project creation → Composition engine: composes
- Feature layering → Composition engine: overlays
- Composition engine → Renderer and writer: render plan
- Framework bases → Composition engine: base layer
- Feature packs → Composition engine: feature overlays
- Page packs and scaffolds → Composition engine: pages and CRUD templates
- Renderer and writer → Generated application: writes
- Generated application → Cloudflare Workers: deploys to
- Feature packs → Cloudflare D1: optional integration
- Go CLI entrypoint → Go composition pipeline: runs
- Go composition pipeline → Generated application: experimental generation