This repo is a Bun + Turborepo monorepo.
apps/cli: published CLI (create-better-t-stack), with source inapps/cli/srcand tests inapps/cli/test.apps/web: Next.js docs/site (apps/web/src,apps/web/content/docs,apps/web/public).packages/template-generator: template generation engine used by the CLI.packages/types: shared schemas/types.packages/backend: Convex backend used by web features.
bun install: install workspace dependencies.bun dev:cli: watch-build CLI package.bun dev:web: run web app locally (next dev --port 3333).bun build: build all packages/apps through Turbo.bun build:cli: build only the CLI target.bun run check: format + lint (oxfmt . && oxlint .).cd apps/cli && bun run test: run CLI tests.
- Language: TypeScript (strict mode enabled across projects).
- Modules: ESM-first (
"type": "module"where applicable). - Formatting/linting:
oxfmtandoxlint; runbun run checkbefore committing. - File naming: prefer kebab-case files (for example
database-setup.ts). - Symbols:
camelCasefor functions/variables,PascalCasefor types/components. - Keep feature logic near domain folders (
helpers,utils,template-handlers).
- In CLI code, prefer
better-resultover ad-hoctry/catchfor recoverable flows. - Return typed
Result<T, E>and useResult.ok,Result.err,Result.try, andResult.tryPromise. - Reuse domain errors from
apps/cli/src/utils/errors.ts(CLIError,ProjectCreationError,UserCancelledError) and convert thrown prompt errors at boundaries.
- Templates live in
packages/template-generator/templatesand use helpers frompackages/template-generator/src/core/template-processor.ts(eq,ne,and,or,includes). - For conditional ORM-specific output, use helper form with quoted values:
{{#if (eq orm "prisma")}}{{else if (eq orm "drizzle")}}{{/if}}- Example:
packages/template-generator/templates/packages/infra/alchemy.run.ts.hbs.
- When files must contain literal
{{ ... }}(Vue/JSX/template syntax), escape opening braces as\{{in.hbsfiles so Handlebars does not evaluate them.- Example:
packages/template-generator/templates/frontend/nuxt/app/pages/index.vue.hbs.
- Example:
- Framework:
bun:test. - Test files use
*.test.tsnaming (seeapps/cli/testandpackages/template-generator/test). - Add or update tests with behavior changes, especially prompt flows, template output, and config validation.
- Keep tests deterministic; reuse shared setup utilities in
apps/cli/test/setup.ts.
- Use Conventional Commits with scope, matching history:
feat(cli): ...,fix(web): ...,docs(cli): ...
- Open an issue/discussion before major feature work.
- PRs should include:
- clear summary,
- linked issue (if applicable),
- verification steps run (
bun run check, relevant tests), - screenshots/GIFs for web UI changes.