Basic Game Setup

Set up Network Storage in your s&box game from scratch. Install the library, create a project, configure collections, and implement basic data operations.

YAML Source is the Network Storage authoring standard.
Use the s&box Library Manager install for auto-updates. GitHub is best for agents, source review, contributions, and manual installs.
3

Create Collections

Collections are where your game data lives. You can create them on the dashboard or use the Sync Tool to push schemas from the editor.

## Option A: Use the Sync Tool (Recommended)

After configuring credentials in **Network Storage > Setup**, open **Network Storage > Sync Tool** from the editor menu bar.

The library scaffolds a sample `players` collection for you on first install at `Editor/Network Storage/collections/players.collection.yml`. Prefer `.yml` for YAML Source files. Existing `.yaml` files still sync and are treated the same. You can edit this file or create new ones, then push them to the server with the Sync Tool.

A collection file looks like this:

```yaml
sourceVersion: "1"
kind: collection
name: players
collectionType: per-steamid
accessMode: endpoint
schema:
type: object
properties:
playerName:
type: string
xp:
type: number
default: 0
gold:
type: number
default: 0
inventory:
type: array
items:
type: object
```

Click **Push** in the Sync Tool to create or update the collection on the server.

## Option B: Create on the Dashboard

1. Open your project on the [Network Storage dashboard](/tools/network-storage)
2. Click **New Collection**
3. Fill in:

| Field | Value | Why |
|-------|-------|-----|
| **Name** | `players` | Stores per-player data |
| **Type** | Per-Player | Each player gets their own document |
| **Access Mode** | Endpoint controlled | Prevents clients from writing directly |

4. Paste this schema:

```yaml
type: object
properties:
playerName:
type: string
xp:
type: number
min: 0
gold:
type: number
min: 0
inventory:
type: array
items:
type: object
```

5. Click **Create Collection**.

## Use Example Templates

If you are not sure what schema to use, start with the example templates on the dashboard:

- **Player Profile** -- name, XP, level, stats
- **Inventory** -- item storage with quantities
- **Leaderboard** -- global score tracking

## Schema Tips

- Use `min: 0` on currency and XP fields to prevent negative values
- Add `_ledger: true` to track every change for audit purposes
- Use `default: 0` to initialize fields automatically
Tips & Troubleshooting

> **Tip:** The Sync Tool keeps your local collection files in sync with the server. Edit locally, push to deploy. Pull to download the latest server state. This is the fastest workflow for iterating on schemas.