open-index/open-npm huggingface dataset:
npm package: @spatial-os/web-sdk
Description: Web SDK for Spatial OS - Planet-scale geospatial infrastructure
Author: Spatial OS Community
Latest version: 1.0.0

# 🌐 Spatial OS Web SDK

[![License](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![npm](https://img.shields.io/npm/v/@spatial-os/web.svg)](https://www.npmjs.com/package/@spatial-os/web)

**JavaScript/TypeScript SDK for Spatial OS** - Build WebXR applications with persistent spatial anchors.

## Features

- 📍 **Spatial Anchors** - Create and resolve world-locked content
- 🔄 **WebXR Integration** - Browser-based AR/VR support
- 👥 **Real-time Presence** - Track users in shared spaces via WebSocket
- 📦 **Zero Dependencies** - Lightweight and tree-shakeable

## Installation

```bash
npm install @spatial-os/web
# or
yarn add @spatial-os/web
```

### CDN

```html
<script src="https://unpkg.com/@spatial-os/web@latest/dist/spatial-os.min.js"></script>
```

## Quick Start

```typescript
import { SpatialOS } from '@spatial-os/web';

const spatial = new SpatialOS({ apiKey: 'YOUR_API_KEY' });

// Login
await spatial.login('user@example.com', 'password');

// Create anchor
const anchor = await spatial.createAnchor({
  spaceId: 'my-space',
  anchorType: 'GPS',
  position: { x: 0, y: 0, z: 0 },
  rotation: { x: 0, y: 0, z: 0, w: 1 },
  payload: 'my-content-id',
});

// Find nearby anchors
const nearby = await spatial.getNearbyAnchors(37.7749, -122.4194, 1.0);

// Real-time presence
spatial.presence.connect('my-space');
spatial.presence.on('userJoined', (user) => {
  console.log('User joined:', user.id);
});
```

## TypeScript

Full TypeScript support included:

```typescript
import { SpatialOS, Anchor, Space, Vector3 } from '@spatial-os/web';
```

## Browser Support

- Chrome 79+ (WebXR)
- Edge 79+
- Safari 15+ (AR Quick Look)
- Firefox (VR only)

## Support

If you find Spatial OS useful, consider supporting the project:

[![Ko-fi](https://img.shields.io/badge/Ko--fi-Support%20Us-ff5e5b?logo=ko-fi&logoColor=white)](https://ko-fi.com/nirmalbrj7)
[![GitHub Sponsors](https://img.shields.io/badge/GitHub-Sponsor-ea4aaa?logo=github&logoColor=white)](https://github.com/sponsors/nirmalbrj7)

## License

MIT License - see [LICENSE](LICENSE)