# Quickstart: Sypnia Cloud

> Create a bucket, write a rule, upload a file from your app and show a resized image.

Applies to: Sypnia Cloud (paid service).  
Source: https://files.docs.sypnia.com/start/quickstart-cloud/

For agents: Files Cloud quickstart: npx @sypnia/files login; buckets create avatars --public --max-size 5MB --types …; SQL policy on sypnia_files.objects for insert to authenticated with check bucket_id and foldername()[1] = auth.uid(); upload with createFiles(…/client) session from @sypnia/data; url() with width/height/resize/format → <ref>.files.sypnia.app WebP.

At the end, your app uploads a profile photo for the signed-in user and shows it at 256 px.

### 1. Create a bucket

```bash
npx @sypnia/files login
npx @sypnia/files buckets create avatars --public --max-size 5MB --types image/jpeg,image/png,image/webp
```

**You should see:**`Bucket avatars created (public).`

### 2. Allow each user to write their own folder

```sql
create policy "own avatar" on sypnia_files.objects for insert to authenticated
  with check (bucket_id = 'avatars' and (sypnia_files.foldername(name))[1] = auth.uid()::text);
```

Run it in the SQL editor of the console, or with `npx @sypnia/files policies apply policies.sql`.

### 3. Upload from your app

```ts
import { createFiles } from '@sypnia/files/client';

const files = createFiles('https://<ref>.files.sypnia.com', { session: sypnia.auth }); // sypnia: your @sypnia/data client
await files.bucket('avatars').upload(`${user.id}/photo.jpg`, file, { upsert: true });
```

### 4. Show it resized

```ts
const src = files.bucket('avatars').url(`${user.id}/photo.jpg`, { width: 256, height: 256, resize: 'cover', format: 'webp' });
```

**You should see:**An address on `<ref>.files.sypnia.app` that returns a 256 × 256 WebP.
