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] The `PRIVATE_KEYS` is an array of keys. Make sure to use single 39> quotes, and square brackets around the keys `PRIVATE_KEYS='[<key here>]'`. If 40> you generate multiple keys, add new keys at the beginning of the array, so 41> that the first key is always the most recent one. When a key is removed, all 42> associated sessions will be invalidated. 43 44Make sure to also set the `COOKIE_SECRET`, which is used to sign session 45cookies, in your environment variables (`.env` file). You can generate a random 46string for this: 47 48```sh 49openssl rand -base64 33 50``` 51 52Finally, set the `PUBLIC_URL` to the URL where your app will be accessible. This 53will allow the authorization servers to download the app's public keys. 54 55```env 56PUBLIC_URL="https://your-app-url.com" 57``` 58 59> [!NOTE] 60> You can use services like [ngrok](https://ngrok.com/) to expose your local server to the internet for testing purposes. Just set the `PUBLIC_URL` to the ngrok URL.