Select the types of activity you want to include in your feed.
Demonstration bridge between ATproto and GraphQL. Generate schema types and interface with the ATmosphere via GraphQL queries. Includes a TypeScript server with IDE.
···55**Installation:**
6677```
88-git submodule update --init --recursive
98npm install
109```
11101211## Schema Generation
13121414-This folder contains scripts to generate a GraphQL schema from Lexicon. Standard ATProto definitions are initialized in the `deps/atproto` folder.
1313+This project uses [@atproto/lex](https://www.npmjs.com/package/@atproto/lex-cli) to download Lexicons and generate xRPC calls that are used in the backend.
15141615Example usage:
17161817```
1919-ts-lex install app.bsky.actor.getProfile \
2020- com.atproto.server.getSession
2121-npx tsx src/bin/main.ts \
2222- app.bsky.actor.getProfile \
2323- com.atproto.server.getSession \
2424- -o schema-generated.graphql
1818+ts-lex install app.bsky.actor.getProfile com.atproto.server.getSession
1919+npm run generate
2520```
26212722This will generate schema definitions for the `getProfile` and `getSession` procedures and recursively import all their referenced types, e.g.
···6459This repo also contains a Rust GraphQL server that can bridge an exported schema to the AT protocol. You can use this as a reference or even expand it to include non-AT GraphQL types.
65606661- GraphQL API endpoint at `/graphql`
6767-- Interactive GraphiQL interface for development
6262+- Interactive GraphiQL interface for development at `/graphiql`
68636964### Building
7065···7267npm run server
7368```
74697575-The server will start on `http://localhost:8000`.
7070+The server will start on `http://localhost:8000`. An example query and variables:
7171+7272+```
7373+# Query
7474+query ($actor: ID!) {
7575+ lexicon {
7676+ app {
7777+ bsky {
7878+ actor {
7979+ getProfile(actor: $actor) {
8080+ avatar
8181+ postsCount
8282+ description
8383+ displayName
8484+ }
8585+ }
8686+ }
8787+ }
8888+ }
8989+}
9090+9191+# Variables
9292+{
9393+ "actor": "did:plc:olka44iewlycp4vxa6srsabp"
9494+}
9595+9696+# Response
9797+{
9898+ "data": {
9999+ "lexicon": {
100100+ "app": {
101101+ "bsky": {
102102+ "actor": {
103103+ "getProfile": {
104104+ "avatar": "https://cdn.bsky.app/img/avatar/plain/did:plc:olka44iewlycp4vxa6srsabp/bafkreicozgr2pxfq5cdnfxlhrc6si3sunraekbp2pccqukvh6dapr4en5i",
105105+ "postsCount": 374,
106106+ "description": "browser tab collector\nnon-recurring engineer\nsomerville, ma",
107107+ "displayName": "tim ryan"
108108+ }
109109+ }
110110+ }
111111+ }
112112+ }
113113+ }
114114+}
115115+```
7611677117## License
78118