···1122## git repo contents
3344-Commands (run with, eg, `go run ./cmd/bigsky`):
44+Run with, eg, `go run ./cmd/bigsky`):
5566- `cmd/bigsky`: BGS+indexer daemon
77- `cmd/palomar`: search indexer and query servcie (OpenSearch)
88- `cmd/gosky`: client CLI for talking to a PDS
99- `cmd/lexgen`: codegen tool for lexicons (Lexicon JSON to Go package)
1010-- `cmd/laputa`: PDS daemon
1010+- `cmd/laputa`: partial PDS daemon (not usable or under development)
1111- `cmd/stress`: connects to local/default PDS and creates a ton of random posts
1212- `cmd/beemo`: slack bot for moderation reporting (Bluesky Moderation Observer)
1313- `cmd/fakermaker`: helper to generate fake accounts and content for testing
1414+- `cmd/supercollider`: event stream load generation tool
1515+- `cmd/sonar`: event stream monitoring tool
1416- `gen`: dev tool to run CBOR type codegen
15171618Packages:
17191820- `api`: mostly output of lexgen (codegen) for lexicons: structs, CBOR marshaling. some higher-level code, and a PLC client (may rename)
1919- - `api/atprot`: generated types for `com.atproto` lexicon
2121+ - `api/atproto`: generated types for `com.atproto` lexicon
2022 - `api/bsky`: generated types for `app.bsky` lexicon
2323+- `atproto/crypto`: crytographic helpers (signing, key generation and serialization)
2424+- `atproto/syntax`: string types and parsers for identifiers, datetimes, etc
2525+- `atproto/identity`: DID and handle resolution
2126- `bgs`: server implementation for crawling, etc
2227- `carstore`: library for storing repo data in CAR files on disk, plus a metadata SQL db
2328- `events`: types, codegen CBOR helpers, and persistence for event feeds
···3540- `util`: a few common definitions (may rename)
3641- `xrpc`: XRPC client (not server) helpers
37423838-Other:
3939-4040-- `testscripts`: shell scripts that run gosky (CLI client) against local PDS
41434242-4343-## jargon
4444+## Jargon
44454546- BGS: Big Graph Service (or Server), which centrals crawls/consumes content from "all" PDSs and re-broadcasts as a firehose
4647- PDS: Personal Data Server (or Service), which stores user atproto repositories and acts as a user agent in the network
4748- CLI: Command Line Tool
4849- CBOR: a binary serialization format, smilar to JSON
4949-- PLC: "placeholder" DID provider
5050-- DID: Decentralized IDentifier, a flexible W3C specification for persistent identifiers in URI form (eg, "did:plc:abcd1234")
5050+- PLC: "placeholder" DID provider, see <https://web.plc.directory>
5151+- DID: Decentralized IDentifier, a flexible W3C specification for persistent identifiers in URI form (eg, `did:plc:abcd1234`)
5152- XRPC: atproto convention for HTTP GET and POST endpoints specified by namespaced Lexicon schemas
5253- CAR: simple file format for storing binary content-addressed blocks/blobs, sort of like .tar files
5354- CID: content identifier for binary blobs, basically a flexible encoding of hash values
5455- MST: Merkle Search Tree, a key/value map data structure using content addressed nodes
555656575757-## lexicon and CBOR marshaling code generation
5858+## Lexicon and CBOR code generation
58595960`gen/main.go` has a list of types internal to packages in this repo which need CBOR helper codegen. If you edit those types, or update the listed types/packages, re-run codegen like:
6061···6465 # then generate
6566 go run ./gen
66676767-To run codegen for new or updated Lexicons, using lexgen, first place (or git
6868-checkout) the JSON lexicon files at `../atproto/`.
6969-Then, in *this* repository (indigo), run commands like:
6868+To run codegen for new or updated Lexicons, using lexgen, first place (or git checkout) the JSON lexicon files at `../atproto/`. Then, in *this* repository (indigo), run commands like:
70697170 go run ./cmd/lexgen/ --package bsky --prefix app.bsky --outdir api/bsky ../atproto/lexicons/app/bsky/
7271 go run ./cmd/lexgen/ --package atproto --prefix com.atproto --outdir api/atproto ../atproto/lexicons/com/atproto/
73727473You may want to delete all the codegen files before re-generating, to detect deleted files.
75747676-It can require some manual munging between the lexgen step and a later `go run ./gen` to make sure things compile at least temporarily; otherwise the `gen` will not run.
7777-In some cases, you might also need to add new types to ./gen/main.go.
7575+It can require some manual munging between the lexgen step and a later `go run ./gen` to make sure things compile at least temporarily; otherwise the `gen` will not run. In some cases, you might also need to add new types to `./gen/main.go`.
78767979-To generate server stubs and handlers, push them in a temporary directory
8080-first, then merge changes in to the actual PDS code:
7777+To generate server stubs and handlers, push them in a temporary directory first, then merge changes in to the actual PDS code:
81788279 mkdir tmppds
8380 go run ./cmd/lexgen/ --package pds --gen-server --types-import com.atproto:github.com/bluesky-social/indigo/api/atproto --types-import app.bsky:github.com/bluesky-social/indigo/api/bsky --outdir tmppds --gen-handlers ../atproto/lexicons
848185828686-## tips and tricks
8383+## Tips and Tricks
87848885When debugging websocket streams, the `websocat` tool (rust) can be helpful. CBOR binary is sort of mangled in to text by default. Eg:
8986···103100 GOLOG_LOG_LEVEL=info go run ./cmd/pds
104101105102106106-## gosky basic usage
103103+## `gosky` basic usage
107104108105Running against local typescript PDS in `dev-env` mode:
109106110107 # as "alice" user
111108 go run ./cmd/gosky/ --pds http://localhost:2583 createSession alice.test hunter2 > bsky.auth
112109113113-The `bsky.auth` file is the default place that `gosky` and other client
114114-commands will look for auth info.
110110+The `bsky.auth` file is the default place that `gosky` and other client commands will look for auth info.
115111116112117117-## slack report bot basic usage
113113+## Integrated Development
118114119119-You need an admin token, slack webhook URL, and auth file (see gosky above).
120120-The auth file isn't actually used, only the admin token.
115115+Sometimes it is helpful to run a PLC, PDS, BGS, labelmaker, and other components, all locally on your laptop, across languages. This section describes one setup for this.
121116122122- # configure a slack webhook
123123- export SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T028K87/B04NBDB/oWbsHasdf23r2d
124124-125125- # example pulling admin token out of `pass` password manager
126126- export ATP_AUTH_ADMIN_PASSWORD=`pass bsky/pds-admin-staging | head -n1`
127127-128128- # example just setting admin token directly
129129- export ATP_AUTH_ADMIN_PASSWORD="someinsecurething123"
130130-131131- # run the bot
132132- GOLOG_LOG_LEVEL=debug go run ./cmd/beemo/ --pds https://pds.staging.example.com --auth bsky.auth notify-reports
133133-134134-## integrated development
135135-136136-Sometimes it is helpful to run a PLC, PDS, BGS, labelmaker, and other
137137-components, all locally on your laptop, across languages. This section
138138-describes one setup for this.
139139-140140-First, you need PostgreSQL running locally. This could be via docker, or the
141141-following commands assume some kind of debian/ubuntu setup with a postgres
142142-server package installed and running.
117117+First, you need PostgreSQL running locally. This could be via docker, or the following commands assume some kind of debian/ubuntu setup with a postgres server package installed and running.
143118144119Create a user and databases for PLC+PDS:
145120
+31-17
README.md
···1122
3344-indigo: golang code for Bluesky's atproto services
55-==================================================
44+indigo: atproto libraries and services in golang
55+================================================
6677Some Bluesky software is developed in Typescript, and lives in the [bluesky-social/atproto](https://github.com/bluesky-social/atproto) repository. Some is developed in Go, and lives here.
8899-<p align="center"><img src="https://static.bnewbold.net/tmp/under_construction_bar.gif" /></p>
99+Services implemented in this repository:
10101111-Everything in this repository is an work in progress. Features and "Lexicons" may be removed or updated, software interfaces broken, etc.
1111+* **`bigsky`** ([README](./cmd/bigsky/README.md)): "Big Graph Service" (BGS) reference implementation, running at `bsky.network`
1212+* **`palomar`** ([README](./cmd/palomar/README.md)): fulltext search service for <https://bsky.app>
12131313-We are developing in the open, but not ready to accept or review significant contributions. Keep checking back!
1414+1515+## Development Quickstart
1616+1717+All the packages in this repository are under active development. Features and software interfaces have not stabilized and may break or be removed.
14181519<p align="center"><img src="https://static.bnewbold.net/tmp/under_construction_bar.gif" /></p>
16202121+First, you will need the Go toolchain installed. We develop using the latest stable version of the language.
2222+2323+The Makefile provides wrapper commands for basic development:
2424+2525+ make build
2626+ make test
2727+ make fmt
2828+ make lint
2929+3030+Individual commands can be run like:
3131+3232+ go run ./cmd/bigsky
3333+3434+The [HACKING](./HACKING.md) file has a list of commands and packages in this repository and some other development tips.
3535+17361837## What is atproto?
1938···21402241The Authenticated Transfer Protocol ("ATP" or "atproto") is a decentralized social media protocol, developed by [Bluesky PBC](https://blueskyweb.xyz). Learn more at:
23422424-- [Protocol Documentation](https://atproto.com/docs)
2525-- [Overview Guide](https://atproto.com/guides/overview) 👈 Good place to start
4343+- [Overview and Guides](https://atproto.com/guides/overview) 👈 Best starting point
4444+- [Github Discussions](https://github.com/bluesky-social/atproto/discussions) 👈 Great place to ask questions
4545+- [Protocol Specifications](https://atproto.com/specs/atp)
2646- [Blogpost on self-authenticating data structures](https://blueskyweb.xyz/blog/3-6-2022-a-self-authenticating-social-protocol)
27472828-2929-## Development
4848+The Bluesky Social application encompasses a set of schemas and APIs built in the overall AT Protocol framework. The namespace for these "Lexicons" is `app.bsky.*`.
30493131-First, you will need the Go toolchain installed. We develop using the latest stable version of the language.
32503333-The Makefile provides wrapper commands for basic development:
5151+## Contributions
34523535- make build
3636- make test
3737- make fmt
3838- make lint
5353+We are working in the open, but not ready to actively collaborate on larger contributions to this codebase.
39544040-Individual commands can be run like:
5555+Please at least open an issue ahead of time, *before* starting any non-trivial work that you hope to get reviewed or merged to this repo.
41564242- go run ./cmd/bigsky
43574458## Are you a developer interested in building on atproto?
4559
+17
cmd/beemo/README.md
···11+22+## beemo: Slack notification bot for moderation reports
33+44+You need an admin token, slack webhook URL, and auth file (see gosky docs).
55+The auth file isn't actually used, only the admin token.
66+77+ # configure a slack webhook
88+ export SLACK_WEBHOOK_URL=https://hooks.slack.com/services/T028K87/B04NBDB/oWbsHasdf23r2d
99+1010+ # example pulling admin token out of `pass` password manager
1111+ export ATP_AUTH_ADMIN_PASSWORD=`pass bsky/pds-admin-staging | head -n1`
1212+1313+ # example just setting admin token directly
1414+ export ATP_AUTH_ADMIN_PASSWORD="someinsecurething123"
1515+1616+ # run the bot
1717+ GOLOG_LOG_LEVEL=debug go run ./cmd/beemo/ --pds https://pds.staging.example.com --auth bsky.auth notify-reports