the statusphere demo reworked into a vite/react app in a monorepo
at main 64 lines 1.6 kB view raw view rendered
1# Statusphere AppView 2 3This is the backend API for the Statusphere application. It provides REST endpoints for the React frontend to consume. 4 5## Development 6 7```bash 8# Install dependencies 9pnpm install 10 11# Start development server 12pnpm dev 13 14# Build for production 15pnpm build 16 17# Start production server 18pnpm start 19``` 20 21## Environment Variables 22 23Create a `.env` file in the root of this package with the following variables: 24 25``` 26NODE_ENV=development 27HOST=localhost 28PORT=3001 29DB_PATH=./data.sqlite 30COOKIE_SECRET=your_secret_here_at_least_32_characters_long 31ATPROTO_SERVER=https://bsky.social 32PUBLIC_URL=http://localhost:3001 33NGROK_URL=your_ngrok_url_here 34``` 35 36## Using ngrok for OAuth Development 37 38Due to OAuth requirements, we need to use HTTPS for development. The easiest way to do this is with ngrok: 39 401. Install ngrok: https://ngrok.com/download 412. Run ngrok to create a tunnel to your local server: 42 ```bash 43 ngrok http 3001 44 ``` 453. Copy the HTTPS URL provided by ngrok (e.g., `https://abcd-123-45-678-90.ngrok.io`) 464. Add it to your `.env` file: 47 ``` 48 NGROK_URL=https://abcd-123-45-678-90.ngrok.io 49 ``` 505. Also update the API URL in the client package: 51 ``` 52 # In packages/client/src/services/api.ts 53 const API_URL = 'https://abcd-123-45-678-90.ngrok.io'; 54 ``` 55 56## API Endpoints 57 58- `GET /oauth-client-metadata.json` - OAuth client metadata 59- `GET /oauth/callback` - OAuth callback endpoint 60- `POST /login` - Login with handle 61- `POST /logout` - Logout current user 62- `GET /user` - Get current user info 63- `GET /statuses` - Get recent statuses 64- `POST /status` - Create a new status