mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
190 lines
5.1 KiB
Plaintext
190 lines
5.1 KiB
Plaintext
---
|
|
title: Commands
|
|
description: Complete reference for all CLI commands
|
|
---
|
|
|
|
## Overview
|
|
|
|
The Better-T-Stack CLI provides several commands to manage your TypeScript projects.
|
|
|
|
## `init` (Default Command)
|
|
|
|
Creates a new Better-T-Stack project.
|
|
|
|
```bash
|
|
create-better-t-stack [project-directory] [options]
|
|
```
|
|
|
|
### Parameters
|
|
|
|
- `project-directory` (optional): Name or path for your project directory
|
|
|
|
### Key Options
|
|
|
|
- `--yes, -y`: Use default configuration (skips prompts)
|
|
- `--verbose`: Show detailed result information as JSON
|
|
- `--yolo`: Bypass validations and compatibility checks
|
|
- `--package-manager <pm>`: `npm`, `pnpm`, `bun`
|
|
- `--install / --no-install`: Install dependencies after creation
|
|
- `--git / --no-git`: Initialize Git repository
|
|
- `--frontend <types...>`: Web and/or native frameworks (see [Options](/docs/cli/options#frontend))
|
|
- `--backend <framework>`: `hono`, `express`, `fastify`, `elysia`, `next`, `convex`, `none`
|
|
- `--runtime <runtime>`: `bun`, `node`, `workers` (`none` only with `--backend convex` or `--backend none`)
|
|
- `--database <type>`: `none`, `sqlite`, `postgres`, `mysql`, `mongodb`
|
|
- `--orm <type>`: `none`, `drizzle`, `prisma`, `mongoose`
|
|
- `--api <type>`: `none`, `trpc`, `orpc`
|
|
- `--auth <provider>`: `better-auth`, `clerk`, `none` (see [Options](/docs/cli/options#authentication))
|
|
- `--db-setup <setup>`: `none`, `turso`, `d1`, `neon`, `supabase`, `prisma-postgres`, `mongodb-atlas`, `docker`
|
|
- `--examples <types...>`: `none`, `todo`, `ai`
|
|
- `--web-deploy <setup>`: `none`, `wrangler`, `alchemy`
|
|
- `--server-deploy <setup>`: `none`, `wrangler`, `alchemy`
|
|
- `--directory-conflict <strategy>`: `merge`, `overwrite`, `increment`, `error`
|
|
- `--render-title / --no-render-title`: Show/hide ASCII art title
|
|
- `--disable-analytics / --no-disable-analytics`: Control analytics collection
|
|
|
|
See the full reference in [Options](/docs/cli/options).
|
|
|
|
### Examples
|
|
|
|
```bash
|
|
# Default setup with prompts
|
|
create-better-t-stack
|
|
|
|
# Quick setup with defaults
|
|
create-better-t-stack --yes
|
|
|
|
# Specific configuration
|
|
create-better-t-stack --database postgres --backend hono --frontend tanstack-router
|
|
```
|
|
|
|
## `add`
|
|
|
|
Adds addons or deployment configurations to an existing Better-T-Stack project.
|
|
|
|
```bash
|
|
create-better-t-stack add [options]
|
|
```
|
|
|
|
### Options
|
|
|
|
- `--addons <types...>`: Addons to add (see [Addons](/docs/cli/options#addons))
|
|
- `--web-deploy <setup>`: Web deployment setup (`none`, `wrangler`, `alchemy`)
|
|
- `--server-deploy <setup>`: Server deployment setup (`none`, `wrangler`, `alchemy`)
|
|
- `--project-dir <path>`: Project directory (defaults to current directory)
|
|
- `--install`: Install dependencies after adding
|
|
- `--package-manager <pm>`: Package manager to use
|
|
|
|
### Examples
|
|
|
|
```bash
|
|
# Add addons interactively
|
|
create-better-t-stack add
|
|
|
|
# Add specific addons
|
|
create-better-t-stack add --addons pwa tauri --install
|
|
|
|
# Add deployment setup
|
|
create-better-t-stack add --web-deploy wrangler
|
|
```
|
|
|
|
## `sponsors`
|
|
|
|
Displays Better-T-Stack sponsors.
|
|
|
|
```bash
|
|
create-better-t-stack sponsors
|
|
```
|
|
|
|
Shows a list of project sponsors and supporters.
|
|
|
|
## `docs`
|
|
|
|
Opens the Better-T-Stack documentation in your default browser.
|
|
|
|
```bash
|
|
create-better-t-stack docs
|
|
```
|
|
|
|
Opens `https://better-t-stack.dev/docs` in your browser.
|
|
|
|
## `builder`
|
|
|
|
Opens the web-based stack builder in your default browser.
|
|
|
|
```bash
|
|
create-better-t-stack builder
|
|
```
|
|
|
|
Opens `https://better-t-stack.dev/new` where you can configure your stack visually.
|
|
|
|
## Global Options
|
|
|
|
These options work with any command:
|
|
|
|
- `--help, -h`: Display help information
|
|
- `--version, -V`: Display CLI version
|
|
|
|
## Command Examples
|
|
|
|
### Create a Full-Stack App
|
|
|
|
```bash
|
|
create-better-t-stack \
|
|
--database postgres \
|
|
--orm drizzle \
|
|
--backend hono \
|
|
--frontend tanstack-router \
|
|
--auth \
|
|
--addons pwa biome
|
|
```
|
|
|
|
### Create a Backend-Only Project
|
|
|
|
```bash
|
|
create-better-t-stack api-server \
|
|
--frontend none \
|
|
--backend hono \
|
|
--database postgres \
|
|
--orm drizzle \
|
|
--api trpc
|
|
```
|
|
|
|
### Add Features to Existing Project
|
|
|
|
```bash
|
|
cd my-existing-project
|
|
create-better-t-stack add --addons tauri starlight --install
|
|
```
|
|
|
|
## Programmatic Usage
|
|
|
|
For advanced use cases, automation, or integration with other tools, you can use the [Programmatic API](/docs/cli/programmatic-api) to create projects from Node.js code:
|
|
|
|
```typescript
|
|
import { init } from "create-better-t-stack";
|
|
|
|
// Create multiple projects programmatically
|
|
const projects = [
|
|
{ name: "api", config: { frontend: ["none"], backend: "hono" } },
|
|
{ name: "web", config: { frontend: ["next"], backend: "none" } }
|
|
];
|
|
|
|
for (const { name, config } of projects) {
|
|
const result = await init(name, {
|
|
yes: true,
|
|
...config,
|
|
directoryConflict: "increment"
|
|
});
|
|
|
|
console.log(result.success ? `✅ ${name}` : `❌ ${name}: ${result.error}`);
|
|
}
|
|
```
|
|
|
|
This is useful for:
|
|
- **Build tools and generators** - Create projects from templates
|
|
- **CI/CD pipelines** - Generate test projects automatically
|
|
- **Development workflows** - Batch create related projects
|
|
- **Custom tooling** - Integrate with your existing development setup
|
|
|
|
See the [Programmatic API documentation](/docs/cli/programmatic-api) for complete examples and API reference.
|