Skip to content

strawberry-labs/berrypay-common

Repository files navigation

BerryPay Common Server

Backend server for the BerryPay wallet — handles push notifications, exchange rates, wallet banners, and third-party data aggregation.

Built with NestJS + Redis.

Features

  • FCM Push Notifications — Encrypted data-only notifications for incoming Nano transactions
  • Exchange Rates — XNO prices across 155+ fiat and crypto currencies
  • Wallet Banners — Admin-managed promotional banners served to the app
  • WeNano Businesses — Cached directory of businesses accepting Nano
  • Representatives — Nano representative health monitoring and scoring

Setup

npm install
cp .env.example .env   # configure your environment
npm run start:dev

Requires a running Redis instance.

Environment Variables

Variable Description Default
PORT Server port 3000
REDIS_URL Redis connection URL redis://localhost:6379
NANO_WS_URL Nano node WebSocket URL ws://localhost:8081/ws
GOOGLE_APPLICATION_CREDENTIALS Path to Firebase service account JSON
API_KEY Secret key for admin endpoints
ENABLE_RATES Enable currency rate fetching false
FOREX_API_KEY API key for forexrateapi.com
WENANO_API_KEY API key for api.wenano.net
RATE_* Rate limiting configuration See .env

API Endpoints

All routes are prefixed with /api/v1.

Public

Method Path Description
GET /banners Wallet banners sorted by position
GET /rates XNO exchange rates
GET /rates/currencies Supported currency list
GET /wenano/businesses Nano-accepting businesses
GET /representatives Representative list with scores
GET /representatives/poor Underperforming representatives

Device Registration (rate limited)

Method Path Description
PUT /fcm/active Register/update device token and active account

Admin (requires X-API-Key header)

Method Path Description
POST /fcm/test Send test notification to a token or account
POST /fcm/broadcast Broadcast notification to all devices
POST /fcm/debug-token Debug a specific FCM token
GET /fcm/tokens List all registered tokens and accounts
DELETE /fcm/tokens/:token Remove a specific FCM token
POST /banners Create or update a banner
DELETE /banners/:id Delete a banner

Authentication

Admin endpoints accept the API key via:

  • X-API-Key header
  • Authorization: Bearer <key> header
  • ?api_key=<key> query parameter

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors