This project adapts the Statusphere example app to a Next.js application.
It demonstrates how to build an AT Protocol application using the app router, API routes and server components.
- OAuth sign in via the AT Protocol
- Firehose ingestion of custom
xyz.statusphere.statusrecords - In-memory storage of status updates and OAuth sessions
- Example pages for logging in and setting a status
Install dependencies and start the development server:
npm install
npm run devThe app will start on http://localhost:3000.
When you change or add lexicon schemas, regenerate the TypeScript types using:
npm run lexgenCopy .env.template to .env and adjust values as needed. Important settings are:
COOKIE_SECRET– secret used for session cookies
src/lib– core server utilities including OAuth client, firehose ingestion and in-memory storessrc/app– Next.js routes and React pagessrc/app/api– API route handlers replacing the original Express routessrc/lexicon– generated lexicon types used by the AT Protocol libraries
This project follows the AT Protocol applications guide and uses Lexicon to define record collections.
To add your own schema:
- Write a Lexicon JSON file describing the collection you want to store on the network. See
lexicons/xyz.statusphere.status.jsonfor an example. - Place the file in the
lexiconsdirectory. - Regenerate the TypeScript types and schema dictionary:
npm run lexgen- Commit the updated files in
src/lexicon. They are imported by API routes and server components.
npm run buildMIT