Scratch space for learning atproto app development
1# AT Protocol "Statusphere" Example App 2 3An example application covering: 4 5- Signin via OAuth 6- Fetch information about users (profiles) 7- Listen to the network firehose for new data 8- Publish data on the user's account using a custom schema 9 10See https://atproto.com/guides/applications for a guide through the codebase. 11 12## Getting Started 13 14```sh 15git clone https://github.com/bluesky-social/statusphere-example-app.git 16cd statusphere-example-app 17cp .env.template .env 18npm install 19npm run dev 20# Navigate to http://localhost:8080 21``` 22 23## Deploying 24 25In production, you will need a private key to sign OAuth tokens request. Use the 26following command to generate a new private key: 27 28```sh 29./bin/gen-jwk 30``` 31 32The generated key must be added to the environment variables (`.env` file) in `PRIVATE_KEYS`. 33 34```env 35PRIVATE_KEYS='[{"kty":"EC","kid":"12",...}]' 36``` 37 38> [!NOTE] 39> 40> The `PRIVATE_KEYS` is an array of keys. Make sure to use single 41> quotes, and square brackets around the keys `PRIVATE_KEYS='[<key here>]'`. If 42> you generate multiple keys, add new keys at the beginning of the array, so 43> that the first key is always the most recent one. When a key is removed, all 44> associated sessions will be invalidated. 45 46Make sure to also set the `COOKIE_SECRET`, which is used to sign session 47cookies, in your environment variables (`.env` file). You can generate a random 48string for this: 49 50```sh 51openssl rand -base64 33 52``` 53 54Finally, set the `PUBLIC_URL` to the URL where your app will be accessible. This 55will allow the authorization servers to download the app's public keys. 56 57```env 58PUBLIC_URL="https://your-app-url.com" 59``` 60 61> [!NOTE] 62> 63> You can use services like [ngrok](https://ngrok.com/) to expose your local 64> server to the internet for testing purposes. Just set the `PUBLIC_URL` to the 65> ngrok URL.