Highly ambitious ATProtocol AppView service and sdks
TypeScript 47.8%
Rust 47.4%
JavaScript 3.2%
PLpgSQL 0.5%
Shell 0.5%
Nix 0.5%
Dockerfile 0.1%
204 1 2

Clone this repository

https://tangled.org/slices.network/slices
git@tangled.org:slices.network/slices

For self-hosted knots, clone URLs may differ based on your setup.

README.md

Slices#

An open-source platform for building AT Protocol appviews with custom data schemas, automatic SDK generation, and built-in sync capabilities.

Overview#

Slices enables developers to create "slices" - custom appviews within the AT Protocol ecosystem. Each slice can define its own lexicons (schemas), sync data from other AT Protocol services, and automatically generate type-safe SDKs. Think of it as your own customizable view into the AT Protocol network.

Key Features#

  • Custom Lexicons: Define your own data schemas using AT Protocol lexicons
  • Automatic SDK Generation: Get type-safe TypeScript clients generated from your lexicons
  • Data Synchronization: Import and index data from Bluesky and other AT Protocol services
  • OAuth Integration: Built-in AT Protocol authentication
  • Multi-tenant Architecture: Each slice operates independently with its own data validated against its lexicons
  • Dynamic API Endpoints: CRUD operations automatically created for each lexicon record type (collection)

Documentation#

Quick Start#

Prerequisites#

  • Docker and Docker Compose
  • PostgreSQL
  • Rust (for API development)
  • Deno (for frontend)

Installation#

  1. Clone the repository:
git clone https://tangled.sh/justslices.net/core
cd core
  1. Set up environment variables:

Create .env files in both /api and /frontend directories (see Getting Started for details).

  1. Start the services:
# Start the API
cd api
cargo run

# In another terminal, start the frontend
cd frontend
deno task dev
  1. Visit http://localhost:8000 to access the web interface.

Project Structure#

API (/api)#

The backend is built in Rust and serves as the core AT Protocol integration layer. It provides:

  • AT Protocol XRPC Handlers: Dynamic endpoints for slice-specific collections with full CRUD operations
  • Sync Engine: Bulk synchronization from AT Protocol repositories
  • Jetstream Integration: Real-time data streaming from AT Protocol firehose
  • Database Layer: PostgreSQL integration with slice-aware queries
  • SDK Generation: Automatically generates type-safe TypeScript clients and OpenAPI specifications
  • OAuth Integration: Handles AT Protocol OAuth flows and token management

Frontend (/frontend)#

A server-side rendered web application built with Deno that provides:

  • User Interface: Web-based slice management, records browsing, and sync controls
  • Authentication: OAuth integration with session management
  • Server-Side Rendering: HTMX-powered interactive UI with minimal client-side JavaScript
  • Generated Client Integration: Uses auto-generated TypeScript clients for API communication

Development#

Running Tests#

# API tests
cd api
cargo test

# Frontend tests
cd frontend
deno test

Database Migrations#

cd api
sqlx migrate run

# If you modify database queries, update the query cache
cargo sqlx prepare

Building for Production#

# Build the API
cd api
cargo build --release

Contributing#

How to Contribute#

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines#

  • Follow Rust conventions for API code
  • Use Deno formatting for TypeScript/JavaScript
  • Write tests for new features following existing patterns
  • Update documentation as needed
  • Keep commits focused and descriptive

Areas for Contribution#

  • Lexicon validation and verification
  • UI/UX improvements
  • Documentation and examples
  • Bug fixes and performance improvements

Deployment#

The service can be deployed using Docker containers. We provide:

  • Docker Compose configuration for local development
  • Nix flakes for reproducible builds
  • Fly.io configuration for cloud deployment

See the deployment guide for detailed instructions.

Environment Variables#

API Configuration#

Variable Description Required
DATABASE_URL PostgreSQL connection string Yes
AUTH_BASE_URL AIP OAuth service URL Yes
PORT Server port (default: 3000) No

Frontend Configuration#

Variable Description Required
OAUTH_CLIENT_ID OAuth application client ID Yes
OAUTH_CLIENT_SECRET OAuth application client secret Yes
OAUTH_REDIRECT_URI OAuth callback URL Yes
OAUTH_AIP_BASE_URL AIP OAuth service URL Yes
API_URL Backend API base URL Yes
SLICE_URI Default slice URI for queries Yes

Roadmap#

In Progress#

  • Documentation
  • Frontend UX improvements/social features
  • Support more search and filtering params in collection xrpx handlers and SDK
  • Surface jetstream and sync logs in the UI
  • Improve sync and jetstream reliability
  • Monitor api container performance and resource usage

Planned Features#

  • Labeler service integration
  • CLI tool
  • API rate limiting
  • Enhanced lexicon management UI
  • Lexicon discovery and sharing

Community#

Support#

License#

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments#

  • Built on the AT Protocol
  • Inspired by the AT Protocol community
  • Thanks to all contributors

Status#

This project is in active development. APIs may change as we approach v1.0.


Made with love for the AT Protocol ecosystem ❤️