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 JWK (JSON Web Key):
27
28```sh
29./bin/gen-jwk
30```
31
32The generated key must be added to the environment variables (`.env` file) as `PRIVATE_KEY`.
33
34```env
35PRIVATE_KEYS='[{"kty":"EC","kid":"12",...}]'
36```
37
38Note that you can have multiple keys. Always add new keys at the beginning of
39the array, so that the first key is always the most recent one. When a key is
40removed, all associated sessions will be invalidated.
41
42Make sure to also set the `COOKIE_SECRET` in your environment variables (`.env` file), which is used to sign session cookies. You can generate a random string for this:
43
44```sh
45openssl rand -base64 33
46```
47
48Finally, set the `PUBLIC_URL` to the URL where your app will be accessible. This is used for OAuth client ID and other configurations.
49
50```env
51PUBLIC_URL="https://your-app-url.com"
52```
53
54> [!NOTE]
55> 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.