> ## Documentation Index
> Fetch the complete documentation index at: https://craftspace.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Local development

> Clone, install, run. Nothing else has to be running.

```sh theme={null}
git clone https://github.com/abuaboud/craftspace.git
cd craftspace
npm install
npm run dev
```

That builds `shared`, then runs three things together:

| Process  | Where                                                                         |
| -------- | ----------------------------------------------------------------------------- |
| `shared` | tsc in watch mode                                                             |
| `server` | [http://localhost:8080](http://localhost:8080), with `node --watch`           |
| `web`    | [http://localhost:5173](http://localhost:5173), proxying `/api` to the server |

The connection gateway runs inside the server process on loopback `8081`.

## The database needs nothing

The server starts its own Postgres (PGlite) in-process under `~/.craftspace`. It lives outside the
checkout on purpose, so a `rm -rf` on the repo takes no data with it and a fresh clone keeps your local
org.

## Signing in locally

With no `RESEND_API_KEY`, the sign-in code prints to the server log instead of being emailed. The sign-in
screen says so. Copy it from the terminal.

## Tests

```sh theme={null}
npm test                       # dependency rules, structure check, integration suite
npm -w @craftspace/server test # just the integration suite
```

Each worker brings up its own throwaway PGlite, so tests need no database and do not touch your dev one.

## Scripts

| Command                   | What it does                                 |
| ------------------------- | -------------------------------------------- |
| `npm run build`           | Production build of shared, server and web   |
| `npm run build:binary`    | The single executable for this platform      |
| `npm run lint:deps`       | Dependency-direction rules                   |
| `npm run check:structure` | Group folders must hold no code of their own |
