Flake to setup a local env for atproto development
Nix 96.7%
Shell 3.3%
10 1 0

Clone this repository

https://tangled.org/edouard.paris/atproto-nix-env
git@knot.edouard.paris:edouard.paris/atproto-nix-env

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

README.md

AT Protocol Development Environment#

A Nix-based development environment for running AT Protocol services (PDS, PLC, Caddy proxy, and MailHog).

Quick Start#

  1. Enter the development environment:

    nix develop
    
  2. Start all services in tmux:

    nix run .#all
    

    This will start all services in a 2x2 tmux pane layout:

    • Top-left: PLC server
    • Bottom-left: MailHog server
    • Top-right: PDS server
    • Bottom-right: Caddy proxy
  3. Create an invite code:

    scripts/create-invite.sh
    
  4. Create a user account:

    goat account create \
      --pds-host=https://pds.example.org:8443 \
      --password=password \
      --email=hello@example.org \
      --invite-code=pds-example-org:8443-xyldq-yrhxc \
      --handle=edouard.pds.example.org
    

    Expected output:

    Success!
    DID: did:plc:pzvsc3jwfjwidojtpbxv4rdd
    Handle: edouard.pds.example.org
    
  5. Verify the DID is registered:

    goat --plc-host=https://plc.example.org data did:plc:pzvsc3jwfjwidojtpbxv4rdd
    

Services#

Available Tools#

  • goat - AT Protocol CLI tool
  • curl, jq - HTTP and JSON utilities
  • tmux - Terminal multiplexer

Management Commands#

  • tmux attach -t atproto - Attach to the services session
  • tmux kill-session -t atproto - Stop all services
  • nix run .#generate-certs - Generate SSL certificates

Prerequisites#

Make sure to add these lines to your /etc/hosts file:

127.0.0.1 pds.example.org
127.0.0.1 plc.example.org

Generate SSL certificates before first use:

nix run .#generate-certs