# Build your first Block

Create and import a tested JavaScript Block in a few commands.

## Prerequisites
Download and extract the [SDK 0.1.0](/block-sdk/stillmade-sdk-0.1.0.zip). Install Node.js 22 or later. Run commands from the extracted SDK folder. The runtime and its dependencies are bundled; the following example needs no account, API key, npm install, or network request.

## Create a Block
```sh
node packages/block-cli/cli.js create ./my-block javascript
```
The scaffold creates these editable files:
```text
my-block/
  stillmade.block.json
  src/run.js
  tests/fixtures.json
```

## Understand the source
The manifest declares the contract. The source is a synchronous function body receiving validated inputs through `input`:
```js
const text = input.text.trim();
return { text, words: text ? text.split(/\s+/).length : 0 };
```
The exact input/output names come from the [manifest](/docs/reference/manifest). There is no server to configure and no hidden credential to supply.

## Validate and test
```sh
node packages/block-cli/cli.js validate ./my-block
node packages/block-cli/cli.js test ./my-block
node packages/block-cli/cli.js preview ./my-block
```
Validation checks package structure. Tests execute every fixture through the isolated runtime and compare the entire returned output with its expected value. Preview executes the first fixture and prints its outputs. A failed test must be corrected before packaging.

## Import the finished folder
Open [Create import](/create/import), choose **Choose folder**, and select `my-block`. Its manifest, implementation, fixtures and optional `src/view.html`, `src/view.css`, `src/view.js` interface load unchanged. Review checks and the actual preview, then confirm import after the required source-rights and device review. The SDK contracts are the foundation from the first development step; there is no source adaptation phase.

## Package an alternate delivery file
For an original implementation, retain complete license notices and at least two fixtures (normal and edge cases), then run:
```sh
node packages/block-cli/cli.js pack ./my-block ./my-block.stillmade-block --original
```
Select that file with **Choose package** for the same source and interface. Packaging adds retained source evidence and reruns applicable checks; it does not rewrite the implementation. Output files are never silently overwritten. Use repository evidence instead of `--original` when reusing third-party code.

## Photo-editor folder example
The extracted SDK contains `examples/original-photo-editor/`, including its actual custom interface, pixel processing and fixtures. Select that folder directly or try [its packaged original](/block-sdk/examples/original-photo-editor.stillmade-block). This bounded example adjusts brightness/color and rotates pixels with transparency. See [the supported original-authoring contract](/docs/build/original-blocks).

## Use and iterate
Add the Block to a Project Type, configure its inputs, and run it. Keep source changes in checkpoints; publish a new release version when the behavior changes. See [versioning and remixing](/docs/distribute/versioning).
