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` can contain multiple keys. The first key in the array is 41> the most recent one, and it will be used to sign new tokens. When a key is 42> removed, all 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 should use 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> 61> You can use services like [ngrok](https://ngrok.com/) to expose your local 62> server to the internet for testing purposes. Just set the `PUBLIC_URL` to the 63> ngrok URL.