---
title: Organisations, projects and environments
description: How Luna arranges your work, from the organisation your team shares down to the environment an app runs in.
sidebar:
  label: Projects and environments
related:
  - /concepts/keys-and-tokens
  - /concepts/the-life-of-a-luna
---

Everything you make on Luna belongs to an organisation. An organisation holds projects, and each project holds the environments its app runs in.

```mermaid
flowchart TD
  A[Your account] --> O[Organisation: Acme]
  O --> P1[Project: notes]
  O --> P2[Project: billing]
  P1 --> E1[Environment: production]
  P1 --> E2[Environment: dev]
  P1 --> E3[Environment: staging]
  E2 --> L[Your app's lunas and their data]
```

## Your account

Your account is you. You make it once with `luna signup`, and each machine you work on logs in to it with `luna login`.

An account can belong to up to 20 organisations. Your role is set in each organisation, not on the account.

## Organisations

An organisation is your team. It holds the people, what each of them may do, the bill and a record of every change.

| Held by the organisation | Command |
| --- | --- |
| Members and their roles | `luna orgs members`, `luna orgs invite` |
| Plan, credit and spending limits | `luna billing` |
| What was used and what it cost | `luna usage` |
| Who changed what | `luna audit` |

Every member has one of five roles. A role applies to every project in the organisation.

| Role | What it may do |
| --- | --- |
| Owner | Everything, including deleting the organisation and managing other owners |
| Admin | Everything an owner may do, apart from deleting the organisation and managing owners |
| Developer | Create projects, deploy, manage environments, secrets, keys, data and API tokens, and read logs, traces, usage and members |
| Viewer | Read logs, traces, usage, members, keys and the names of secrets |
| Billing | Manage billing and read usage |

An organisation always keeps at least one owner.

## Projects

A project is one app. It holds that app's environments and nothing else.

Every project starts with an environment called `production`. It holds nothing until your first deploy to it, and it is deleted only with its project.

## Environments

An environment is one running copy of your app. Each environment has its own URL, its own deployed code, its own lunas and data, its own keys and its own secrets.

Nothing in one environment reaches another. A bug you deploy to `dev` cannot touch the data in `production`.

You make one with `luna env create`. It starts empty. With `--from`, it starts with another environment's code and settings, but never its secrets. Add `--data` to copy that environment's data as well.

A common setup is one environment for each developer, one for staging and `production`. `luna dev` deploys every save to your own environment, and it never runs in `production`.

:::note
Every environment has a default tenant, where your app runs. Platforms that run the same app for many customers add more tenants, each with data of its own. Most apps never add one.
:::

## Which ones a command uses

You rarely name an organisation, project or environment on a command. The CLI already knows them.

- The organisation is saved with this machine's login. `luna orgs use` changes it.
- The project and environment are saved in the folder's `.env.local`. `luna projects use` and `luna env use` change them.
- Creating an organisation, project or environment selects it.

Pass `--project` or `--env` to act on another one for a single command. `luna whoami` shows what commands act on in the current folder.

## Names

A name only has to be unique where it lives. Two people can each have an organisation called Acme, and two organisations can each have a project called `notes`.

An environment name is lowercase letters, digits and single dashes, such as `dev-ann` or `pr-42`.
