# Projects and environments

An **organization** (`acct_...`) owns **projects** (`prj_...`). A project is
one app: a private git repository plus the environments it runs in.

## Create a project

```bash
spaceboy projects create --name notes --template full-stack --json
spaceboy projects list --json
spaceboy projects show prj_...
```

`projects create` provisions the repository from a starter.
`--template full-stack` is the full-stack starter (sign-in, Postgres,
email); without `--template` the project is a client-only site. What each
starter deploys:
[What a project provisions](https://spaceboy.ai/docs/agents/what-a-project-provisions.md).

The plan's project limit applies (`spaceboy whoami --json` shows
`projectCount` and `maxProjects`).

`spaceboy init --project prj_...` downloads the repository into an empty
folder; `spaceboy push` ships committed changes back (see
[Bring your own code](https://spaceboy.ai/docs/agents/bring-your-own-code.md)).
The repository lives in Spaceboy's GitHub organization unless the
organization connected its own GitHub before creating the
project, in which case it is created there and you can also clone and push
it directly.

```bash
spaceboy projects delete prj_... --yes
```

Permanently deletes the project: its repository, every deployed
environment with its database and users, and its drafts.

## Environments

| Mode | What it is | Who has it |
| --- | --- | --- |
| `SANDBOX` | A hosted workspace left from Spaceboy's earlier product; unused when your agent works locally | Every project |
| `DEVELOPMENT` | A deployed copy for testing, at `https://<site>.dev-sites.spaceboy.ai` | One per user per project, created on the first development deploy |
| `PRODUCTION` | The live app | One per project, created on the first production deploy |

Each deployed environment has its own Postgres database, its own users,
its own secrets and its own functions. Nothing is shared between
development and production.

`spaceboy deploys --project prj_... --json` lists deploys with their
`environmentId`; commands such as `logs` and `db` take `--project` with
`--target development|production` and find the environment from its latest
deploy, or `--environment env_...` directly.

## Deleting

```bash
spaceboy undeploy --project prj_... --target development --force
```

Permanently deletes one environment, its database and its users; the
project and its other environments stay. To delete the whole project, use
`spaceboy projects delete` (above).

## Costs

Building and one development environment are free. $10 a month per published project. Need more room? Add capacity for $10 a month. What each
published project includes:
[What a project provisions](https://spaceboy.ai/docs/agents/what-a-project-provisions.md).
