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:- Using nvm (recommended)
- Direct download
- Package managers
Install or update Node.js using nvm:
Installing the SDK
Create or navigate to your project
If you’re starting a new project:Or navigate to your existing project:
Install @atproto/api
Install the main AT Protocol API client:This installs the
@atproto/api package, which includes:AgentandAtpAgentclasses for API callsCredentialSessionfor authenticationRichTextfor text processing- All TypeScript type definitions
- Content moderation utilities
Environment-specific setup
The AT Protocol SDK works in multiple JavaScript environments. Here’s how to set it up for each:- Node.js
- Browser
- React
- Next.js
Node.js setup
Node.js (18.7.0+) has built-in support for everything the SDK needs:tsconfig.json:tsconfig.json
Additional packages
The AT Protocol SDK is split into multiple packages. Install additional packages as needed:@atproto/oauth-client-* (OAuth authentication)
@atproto/oauth-client-* (OAuth authentication)
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.
@atproto/identity (DID and handle resolution)
@atproto/identity (DID and handle resolution)
For advanced identity operations:
@atproto/crypto (Cryptographic operations)
@atproto/crypto (Cryptographic operations)
For signing and key management:
@atproto/repo (Repository management)
@atproto/repo (Repository management)
For advanced repository operations:
@atproto/lexicon (Schema validation)
@atproto/lexicon (Schema validation)
For working with Lexicon schemas:
TypeScript configuration
For the best TypeScript experience, configure yourtsconfig.json:
tsconfig.json
Custom fetch implementation
If you need to provide a customfetch implementation (for logging, proxying, etc.):
Verification
After installation, verify everything is working:verify.ts
Troubleshooting
Module not found errors
Module not found errors
If you see “Cannot find module ‘@atproto/api’”:
- Make sure you ran
npm install - Check that
@atproto/apiis in yourpackage.jsondependencies - Delete
node_modulesand reinstall: - If using TypeScript, ensure
moduleResolutionis set to"node"intsconfig.json
Node.js version errors
Node.js version errors
If you see errors about Node.js version:
- Check your current version:
node --version - Upgrade to Node.js 18.7.0 or higher
- Use nvm to manage versions:
nvm install 22 && nvm use 22 - Add an
.nvmrcfile to your project:
Fetch is not defined
Fetch is not defined
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
TypeScript errors
TypeScript errors
If you’re getting TypeScript errors:
- Make sure you have TypeScript installed:
npm install -D typescript - Check your
tsconfig.jsonhas correct settings (see above) - Try setting
"skipLibCheck": trueintsconfig.json - Update your TypeScript version:
npm install -D typescript@latest
ESM/CommonJS issues
ESM/CommonJS issues
If you have module system issues:For ESM (recommended):
- Add
"type": "module"to yourpackage.json - Use
.mjsextension or set"type": "module" - Use
importstatements
- 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.