···11+# Slices Social - A social app for sharing/creating AT Protocol Appviews
22+33+Slices Social is an AT Protocol appview that allows users to create and share
44+slices (appviews).
55+66+## Architecture
77+88+- **API** (`/api`) - Rust backend with AT Protocol integration, PostgreSQL
99+ database, and dynamic XRPC handlers
1010+- **Frontend** (`/frontend`) - Deno server-side rendered application with OAuth
1111+ authentication
1212+1313+## ✅ Completed Features
1414+1515+### Core Infrastructure
1616+1717+- [x] AT Protocol OAuth integration with AIP server
1818+- [x] PostgreSQL database with slice-aware queries
1919+- [x] Docker containerization with Nix flakes
2020+- [x] Production deployment pipeline
2121+2222+### Slice Management
2323+2424+- [x] Create and manage slice records
2525+- [x] Define custom lexicons for slices (appviews)
2626+- [x] Slice-specific data filtering
2727+- [x] Slice statistics (records, collections, actors)
2828+2929+### Data Synchronization
3030+3131+- [x] Bulk sync from AT Protocol repositories based on domain specific lexicons
3232+- [x] Collection-specific sync with repo filtering
3333+- [x] Indexing of records into local database
3434+- [x] Slice-aware record filtering during sync
3535+3636+### TypeScript Client Generation
3737+3838+- [x] Dynamic TypeScript client generation from lexicons
3939+- [x] Nested collection structure (e.g.,
4040+ `client.social.slices.slice.listRecords()`)
4141+- [x] CRUD operations (create, read, update, delete)
4242+- [x] OAuth client with PKCE authentication flow
4343+- [x] Slice-aware collection operations
4444+- [x] Optional authentication for read-only operations (e.g., listRecords,
4545+ getRecord)
4646+4747+### Frontend
4848+4949+- [x] Server-side rendered pages with HTMX
5050+- [x] User authentication and session management
5151+- [x] Slice overview with index statistics
5252+- [x] Records browser with collection/author filtering
5353+- [x] Sync interface with collection prefilling from lexicons
5454+- [x] Settings page to edit profile
5555+- [x] Encrypted cookie-based sessions
5656+5757+### API Endpoints
5858+5959+- [x] `/xrpc/social.slices.slice.sync` - Bulk synchronization
6060+- [x] `/xrpc/social.slices.slice.stats` - Slice statistics
6161+- [x] `/xrpc/social.slices.slice.records` - Slice records with filtering
6262+- [x] `/xrpc/social.slices.slice.codegen` - Client code generation (currently
6363+ TypeScript only, but designed for extensibility)
6464+- [x] Dynamic collection XRPC endpoints (`*.list`, `*.get`, `*.create`, etc.)
6565+- [x] OAuth endpoints for authentication flow
6666+6767+## 🚧 In Progress/Next Up
6868+6969+- [ ] Connect to Jetstream
7070+- [ ] Add search and filtering functionality to records browser, and generated
7171+ client
7272+- [ ] Support more complex lexicon types (e.g., unions, arrays, refs)
7373+- [ ] Lexicon validation
7474+- [ ] Lexicon verification
7575+- [ ] SDK examples and tutorials, implement Statusphere Slice
7676+- [ ] Pagination for large record sets, maybe even a table view would be cool
7777+- [ ] Slice timeline and user profile pages
7878+- [ ] Display xprc docs for dynamic endpoints (looking at
7979+ [Scalar](https://github.com/scalar/scalar))
8080+8181+## ❌ The Future
8282+8383+- [ ] Integrated labeler service for basic moderation
8484+- [ ] Auto view hydration strategies, maybe configureable in the UI
8585+- [ ] Add pre-defined lexicons straight from Lexicon Community or other sources
8686+- [ ] Support more languages for client code generation (e.g., Python,
8787+ Flutter/Dart, Swift)
8888+- [ ] Integrate/interop with various Microcosm services
8989+- [ ] Cli tool for codegen and other utilities
9090+- [ ] Background job processing queue for syncs
9191+- [ ] Rate limiting and API quotas
9292+- [ ] API docs
9393+- [ ] Appview bug tracking, waitlists, feature flags, analytics, etc.
9494+- [ ] Fork a slice!
9595+- [ ] Strategies for managing/migrating lexicon changes over time
9696+9797+## 🛠️ Development
9898+9999+### Prerequisites
100100+101101+- Nix with flakes enabled (not required, used for deployment)
102102+- Docker
103103+- PostgreSQL
104104+105105+### Getting Started
106106+107107+```bash
108108+# Start API development
109109+cd api
110110+cargo run
111111+112112+# Start frontend development
113113+cd frontend
114114+deno task dev
115115+```
116116+117117+### Useful Scripts
118118+119119+- `api/scripts/test_sync.sh` - Test local sync endpoint (pre-seed all slices
120120+ from the atmosphere)
121121+- `frontend/scripts/register-oauth-client.sh` - Register OAuth client with AIP
122122+123123+## 🚀 Deployment
124124+125125+The service is deployed using Nix-built Docker containers with:
126126+127127+- Fly.io for hosting (move to Upscale?)
128128+- PostgreSQL for data storage
129129+- Environment-based configuration
130130+131131+## 📝 Environment Variables
132132+133133+### API
134134+135135+- `DATABASE_URL` - PostgreSQL connection string
136136+- `AUTH_BASE_URL` - AIP OAuth service URL
137137+- `PORT` - Server port (default: 3000)
138138+139139+### Frontend
140140+141141+- `OAUTH_CLIENT_ID` - OAuth application client ID
142142+- `OAUTH_CLIENT_SECRET` - OAuth application client secret
143143+- `OAUTH_REDIRECT_URI` - OAuth callback URL
144144+- `OAUTH_AIP_BASE_URL` - AIP OAuth service URL
145145+- `SESSION_ENCRYPTION_KEY` - Session cookie encryption key
146146+- `API_URL` - Backend API base URL
147147+- `SLICE_URI` - Filters collection based queries by slice