Highly ambitious ATProtocol AppView service and sdks
Getting Started with Slices#
This guide will help you set up Slices and create your first slice.
Creating Your First Slice#
1. Log In#
Click "Login" and authenticate with your AT Protocol account.
2. Create a Slice#
Click "Create Slice" and provide:
- Name: A friendly name for your slice
- Domain: Your namespace (e.g.,
com.recordcollector)
3. Define a Lexicon#
Navigate to your slice and go to the Lexicon tab. Create a lexicon for your first record type:
{
"lexicon": 1,
"id": "com.recordcollector.album",
"defs": {
"main": {
"type": "record",
"description": "A vinyl album record",
"record": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "Album title"
},
"artist": {
"type": "string",
"description": "Artist or band name"
},
"releaseDate": {
"type": "string",
"format": "datetime",
"description": "Original release date"
},
"genre": {
"type": "array",
"items": {
"type": "string"
},
"description": "Music genres"
},
"condition": {
"type": "string",
"description": "Vinyl condition (Mint, Near Mint, Very Good, etc.)"
},
"notes": {
"type": "string",
"description": "Collector notes"
}
},
"required": ["title", "artist", "releaseDate"]
}
}
}
}
4. Generate TypeScript Client#
Navigate to the Code Generation tab and click "Generate TypeScript Client". This creates a type-safe client library for your slice.
5. Use the Generated Client#
In your application:
import { AtProtoClient } from "./generated-client.ts";
const client = new AtProtoClient(
"http://localhost:3000",
"at://did:plc:your-did/network.slices.slice/your-slice-id",
);
// Get albums
const albums = await client.com.recordcollector.album.getRecords();
// Add a new album to your collection
const newAlbum = await client.com.recordcollector.album.createRecord({
title: "Nevermind",
artist: "Nirvana",
releaseDate: "1991-09-24",
genre: ["grunge", "alternative rock"],
condition: "Near Mint",
notes: "Original pressing, includes poster",
});
// Get a specific album
const album = await client.com.recordcollector.album.getRecord({
uri: newAlbum.uri,
});
Syncing External Data#
To import data from other AT Protocol repositories:
1. Navigate to Sync#
Go to your slice and click the Sync tab.
2. Configure Sync#
Choose collections to sync:
- Primary Collections: Your slice's lexicons
- External Collections: Bluesky or other AT Protocol collections
3. Start Sync#
Specify repositories (DIDs) to sync from, or leave empty to sync all available data.
4. Monitor Progress#
The sync will run in the background. Check the status in the UI or via API.
Next Steps#
- Core Concepts - Understand slices, lexicons, and collections
- API Reference - Explore available endpoints
- SDK Usage - Advanced SDK patterns
- Examples - Sample applications