> For the complete documentation index, see [llms.txt](https://docs.baas.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.baas.sh/baas-sdk/sdk.md).

# Introduction

The **BaaS SDK** (`@baas/sdk`) lets your web app authenticate end-users and interact with the blockchain. Users sign in with a **passkey** (the default) or with an **external wallet** like MetaMask, then your app can call smart contracts and run native wallet operations.

```ts
import { createBaasClient } from '@baas/sdk';

const baas = createBaasClient({
  projectId:      'my-baas-project',
  publishableKey: 'sb_publishable_xxx',
  apiUrl:         'https://my-project-api.baas.sh',
});

const session = await baas.auth.signIn();
//  → { address, accessToken, expiresAt }
```

## What the SDK does

The SDK covers authentication, identity, and on-chain interactions for your end-users:

* Sign up and sign in with a passkey or an external wallet
* Manage the session (read it, listen for changes, refresh, sign out)
* Let users pick a network for passkey sign-in
* Read and update the signed-in user's profile (email, push tokens)
* Read and write smart contracts without ABI imports
* Send transactions, sign messages, and read balances

## If you know Firebase or Supabase, you already know BaaS SDK

The patterns are familiar: sign-in and sign-up methods, a session you read with `getSession()`, and an `onAuthStateChange` listener. The only blockchain-specific difference is the identity: a wallet address instead of an email.

{% hint style="info" %}
**Prerequisites**

* A modern browser (Chrome, Firefox, Safari) — the SDK is **browser-only**.
* Your page must be served over **HTTPS**. `localhost` is exempt, so local development just works.
  {% endhint %}

## Start here

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Quickstart</strong></td><td>Install the SDK and sign in your first user in a few minutes.</td><td><a href="/pages/XtuQGN9Ntc04eiwFNNlw">/pages/XtuQGN9Ntc04eiwFNNlw</a></td></tr><tr><td><strong>Authentication</strong></td><td>Passkeys vs wallets, sign up vs sign in, and how to choose.</td><td><a href="/pages/f0kFN583tRSVnXa7wuan">/pages/f0kFN583tRSVnXa7wuan</a></td></tr><tr><td><strong>API reference</strong></td><td>Every method, option, type, and error code in one place.</td><td><a href="/pages/AwEJ90lZud7nXwXibKrW">/pages/AwEJ90lZud7nXwXibKrW</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.baas.sh/baas-sdk/sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
