Highly ambitious ATProtocol AppView service and sdks
1# Introduction
2
3Slices is an open source platform for building structured data applications on
4the AT Protocol network.
5
6## What is Slices?
7
8Slices lets you define custom data schemas and build applications that store,
9query, and sync structured records across the decentralized AT Protocol network.
10Think of it as a schema-first backend that automatically handles data
11validation, indexing, and cross-network synchronization.
12
13## Quick Start
14
15Get started in under a minute:
16
17```bash
18# Install the CLI globally
19deno install -g -A jsr:@slices/cli --name slices
20
21# Initialize a new slice project
22slices init my-app
23
24# Start developing
25cd my-app
26deno task dev
27```
28
29The `slices init` command creates a full-stack Deno app with OAuth
30authentication, automatically creates your slice on the network, and generates a
31type-safe TypeScript SDK.
32
33## Simple Example
34
35Define a schema for vinyl albums:
36
37```json lexicons/com/recordcollector/album.json
38{
39 "lexicon": 1,
40 "id": "com.recordcollector.album",
41 "defs": {
42 "main": {
43 "type": "record",
44 "record": {
45 "type": "object",
46 "required": ["title", "artist", "releaseDate"],
47 "properties": {
48 "title": { "type": "string" },
49 "artist": { "type": "string" },
50 "releaseDate": { "type": "string", "format": "datetime" },
51 "genre": { "type": "array", "items": { "type": "string" } },
52 "condition": { "type": "string" }
53 }
54 }
55 }
56 }
57}
58```
59
60Push your lexicon and regenerate the SDK:
61
62```bash
63# Push your lexicon to the slice
64slices lexicon push
65
66# Regenerate TypeScript SDK
67slices codegen
68```
69
70Use the auto-generated, type-safe client:
71
72```typescript
73import { AtprotoClient } from "./generated_client.ts";
74
75const client = new AtprotoClient({
76 baseUrl: "https://api.slices.network",
77 sliceUri: "at://your-slice-uri",
78});
79
80// Get all grunge albums
81const albums = await client.com.recordcollector.album.getRecords({
82 where: { genre: { contains: "grunge" } },
83 sortBy: [{ field: "releaseDate", direction: "desc" }],
84});
85```
86
87## Key Features
88
89- **Schema Validation**: Define lexicons that enforce data structure and
90 constraints
91- **Auto-generated APIs**: REST endpoints created automatically from your
92 schemas
93- **TypeScript SDKs**: Type-safe clients generated from your lexicons
94- **Real-time Sync**: Automatic synchronization across the AT Protocol network
95- **Advanced Querying**: Filter, sort, and paginate records with a powerful
96 query API
97- **OAuth Built-in**: Authentication with any AT Protocol account
98
99## When to Use Slices
100
101Slices is ideal for:
102
103- **Social Applications**: Build specialized communities, forums, or social
104 features
105- **Content Platforms**: Create blogs, documentation sites, or media libraries
106- **SaaS Products**: Develop collaborative tools with structured data needs
107- **Web APIs**: Design REST APIs with automatic validation and documentation
108- **Decentralized Apps**: Build on AT Protocol without managing infrastructure
109
110## Next Steps
111
112- [Getting Started](./getting-started.md) - Set up your first slice
113- [Core Concepts](./concepts.md) - Understand lexicons and collections
114- [API Reference](./api-reference.md) - Explore the full API