--- title: Quick Start description: This guide takes you from zero to a running Stacks application in a few minutes. --- # Quick Start This guide takes you from zero to a running Stacks application in a few minutes. ## Prerequisites - [Pantry](https://pantry.dev) - install with `curl -fsSL https://pantry.dev | bash`, then run `pantry bootstrap` - macOS, Linux, or Windows through WSL2 Pantry provisions the Bun 1.4.4 workspace runtime, Git, SQLite, and the rest of the project toolchain from the versioned Stacks dependency manifest. Stacks pins the upstream Pantry behavior it relies on; consult the source-linked [package-manager](https://whitepaper.stacksjs.com/reference/package-manager) and [registry](https://whitepaper.stacksjs.com/reference/registry) contracts for resolution, integrity, authentication, storage, and failure semantics. ## Create a New Project ```bash panx buddy new my-app ``` The installer downloads the project template. Buddy and Pantry then install the declared machine and project dependencies, create your `.env` file, and generate an application key. The framework itself lives in `node_modules`, not in your repository. `storage/framework/defaults` (the built-in models, actions, views, routes and dashboard) is a gitignored link to `node_modules/@stacksjs/defaults`, so it upgrades with the `stacks` dependency and your first commit is your app, a few hundred files rather than a few thousand. Override any default by creating the same path under `app/` or `resources/`. To commit a copy of the defaults instead, pass `--vendor-defaults` to `buddy new`, or run `./buddy publish:defaults` later (`./buddy unpublish:defaults` goes back). System dependencies are declared in `config/deps.ts`; `deps.yaml` is generated from it for Pantry. ## Start Developing ```bash cd my-app ./buddy dev ``` This starts: - **API server** at `http://localhost:3000` - **Frontend dev server** with hot module replacement - **File watchers** for automatic rebuilds If anything looks off, run `./buddy doctor` - it checks your Bun version, environment file, application key, database connectivity, and more. ## Your First Action Actions hold your business logic. Create `app/Actions/SubscribeAction.ts`: ```ts import { Action } from '@stacksjs/actions' import { response } from '@stacksjs/router' import { schema } from '@stacksjs/validation' export default new Action({ name: 'SubscribeAction', description: 'Handle newsletter subscription', method: 'POST', // Validation rules validations: { email: { rule: schema.string().email(), message: 'Please provide a valid email address.', }, name: { rule: schema.string().min(2).max(100), message: 'Name must be between 2 and 100 characters.', }, }, async handle(request) { const email = request.get('email') const name = request.get('name') // Your business logic here // e.g., save to database, send confirmation email return response.json({ success: true, message: `Thanks for subscribing, ${name}!`, }) }, }) ``` ## Your First Component Stacks uses `.stx` files for components, which combine HTML with minimal JavaScript in an intuitive syntax. Create a new component in `resources/components/WelcomeCard.stx`: ```html
{{ description }}
@if(showButton) @endif