Skip to main content
This guide covers everything you need to install and configure the AT Protocol SDK in your development environment.

System requirements

Node.js

Version 18.7.0 or higherThe AT Protocol SDK requires Node.js 18.7.0+. Use nvm for easy version management.

Package manager

npm, yarn, or pnpmAny modern package manager works. The examples use npm, but commands are provided for all three.
The SDK is built with TypeScript and includes complete type definitions. While TypeScript is recommended, you can use the SDK with plain JavaScript.

Installing Node.js

If you don’t have Node.js installed, or need to upgrade:

Installing the SDK

1

Create or navigate to your project

If you’re starting a new project:
Or navigate to your existing project:
2

Install @atproto/api

Install the main AT Protocol API client:
This installs the @atproto/api package, which includes:
  • Agent and AtpAgent classes for API calls
  • CredentialSession for authentication
  • RichText for text processing
  • All TypeScript type definitions
  • Content moderation utilities
3

Verify installation

Create a test file to verify everything is working:
test.ts
Run it:
You should see:

Environment-specific setup

The AT Protocol SDK works in multiple JavaScript environments. Here’s how to set it up for each:

Node.js setup

Node.js (18.7.0+) has built-in support for everything the SDK needs:
No polyfills or additional configuration needed!For TypeScript projects, add these to your tsconfig.json:
tsconfig.json

Additional packages

The AT Protocol SDK is split into multiple packages. Install additional packages as needed:
For production applications, use OAuth instead of app passwords:Browser applications:
Node.js applications:
General/custom environments:
See the OAuth authentication guide for usage details.
For advanced identity operations:
For signing and key management:
For advanced repository operations:
For working with Lexicon schemas:

TypeScript configuration

For the best TypeScript experience, configure your tsconfig.json:
tsconfig.json
The SDK provides complete TypeScript types out of the box. Enable strict mode to catch potential errors early.

Custom fetch implementation

If you need to provide a custom fetch implementation (for logging, proxying, etc.):

Verification

After installation, verify everything is working:
verify.ts
Run with:

Troubleshooting

If you see “Cannot find module ‘@atproto/api’”:
  1. Make sure you ran npm install
  2. Check that @atproto/api is in your package.json dependencies
  3. Delete node_modules and reinstall:
  4. If using TypeScript, ensure moduleResolution is set to "node" in tsconfig.json
If you see errors about Node.js version:
  1. Check your current version: node --version
  2. Upgrade to Node.js 18.7.0 or higher
  3. Use nvm to manage versions: nvm install 22 && nvm use 22
  4. Add an .nvmrc file to your project:
If you see “fetch is not defined” in older Node.js versions:
  • Upgrade to Node.js 18.7.0+ (has native fetch)
  • Or install a polyfill: npm install node-fetch
For environments without fetch, provide a custom fetch implementation:
If you’re getting TypeScript errors:
  1. Make sure you have TypeScript installed: npm install -D typescript
  2. Check your tsconfig.json has correct settings (see above)
  3. Try setting "skipLibCheck": true in tsconfig.json
  4. Update your TypeScript version: npm install -D typescript@latest
If you have module system issues:For ESM (recommended):
  • Add "type": "module" to your package.json
  • Use .mjs extension or set "type": "module"
  • Use import statements
For CommonJS:
  • Use require() statements
  • You may need to use dynamic imports:

Next steps

Now that you have the SDK installed:

Quickstart guide

Make your first API call and create a post

Authentication

Learn about authentication options and session management

API reference

Explore the complete API documentation

OAuth setup

Set up OAuth for production applications
Need help? Join the AT Protocol discussion forum or check the GitHub repository.