A high-performance Bitcoin transaction processing and social features API built with Bun, Elysia, MongoDB, and Redis.
The BMAP API provides comprehensive Bitcoin SV transaction processing capabilities combined with social networking features. It processes blockchain data in real-time, offers analytics insights, and enables social interactions through BAP (Bitcoin Attestation Protocol) identities.
- Real-time Transaction Processing: Process and store Bitcoin transactions using bmapjs
- Social Network Features: Friends, channels, direct messaging, posts, and likes
- Analytics Dashboard: Network statistics, trending content, and growth metrics
- Identity Management: BAP identity integration and search
- Chart Data Generation: Time-series data for visualization
- MongoDB Query Interface: Flexible database querying with real-time subscriptions
- High Performance: Built on Bun runtime with Redis caching
POST /ingest
- Process and store raw Bitcoin transactionGET /tx/:tx/:format?
- Get transaction details in various formats (bmap, bob, raw, signer, json)
GET /q/:collectionName/:base64Query
- Execute MongoDB queries with text search supportGET /s/:collectionName/:base64Query
- Subscribe to real-time query updates (SSE)
GET /chart-data/:name?
- Generate time series chart data
Channel Communication
GET /social/channels
- List all channelsGET /social/channels/:channelId/messages
- Get channel messages
Identity & Search
GET /social/autofill
- Autocomplete search (identities + posts)GET /social/identity/search
- Search identitiesGET /social/identities
- List all identities with pagination
Posts & Content
GET /social/post/:txid
- Get post with metadataGET /social/post/:txid/reply
- Get replies to a postGET /social/post/:txid/like
- Get likes for a postGET /social/post/search
- Search postsGET /social/post/address/:address
- Posts by Bitcoin addressGET /social/post/bap/:bapId
- Posts by BAP identityGET /social/feed/:bapId?
- Get user feed
Social Graph
GET /social/friend/:bapId
- Friend relationshipsGET /social/bap/:bapId/like
- User's likesPOST /social/likes
- Get likes for transactions or messages
Direct Messages
GET /social/@/:bapId/messages
- User's DM conversationsGET /social/@/:bapId/messages/:targetBapId
- Specific conversation
Network Overview
GET /analytics/network/overview
- Global network statisticsGET /analytics/network/activity
- Real-time activity feedGET /analytics/network/growth
- Time-series growth data
Trending Analysis
GET /analytics/trending/channels
- Most active channelsGET /analytics/trending/users
- Top users by engagement
Content Analytics
GET /analytics/content/analytics
- Content overview and metricsGET /analytics/content/trending
- Trending content analysis
User Insights
GET /analytics/user/:userId/metrics
- Comprehensive user analytics
Administrative
GET /analytics/admin/stats
- Administrative dashboard statisticsGET /analytics/export
- Export analytics data (CSV, JSON, XLSX)POST /analytics/alerts/check
- Check alert thresholds
Real-time Streams
GET /analytics/stream/:stream
- Live analytics data streams
GET /health/network/status
- System health and status indicators
Standard Success Response:
{
"status": "OK",
"result": { ... }
}
Paginated Response:
{
"page": 1,
"limit": 100,
"count": 250,
"results": [...],
"signers": [...]
}
Error Response:
{
"error": {
"code": "NOT_FOUND",
"message": "Resource not found"
}
}
# Clone the repository
git clone <repository-url>
cd bmap-api
# Install dependencies
bun install
# Set up environment variables
cp .env.example .env
# Edit .env with your configuration
# Start the development server
bun run dev
# View API documentation
open http://localhost:3000/docs
API_HOST=0.0.0.0
API_PORT=3000
REDIS_PRIVATE_URL=redis://localhost:6379
BMAP_MONGO_URL=mongodb://localhost:27017/bmap
- Swagger/OpenAPI: Available at
/docs
when running - Schema Types: Published as
@bmap/types
npm package - Project Documentation: See CLAUDE.md
# Type checking
bun run typecheck
# Linting
bun run lint
bun run lint:fix
# Build types package
bun run build:types
# Run tests
bun test
- Runtime: Bun for high-performance JavaScript/TypeScript execution
- Framework: Elysia.js for type-safe web framework
- Database: MongoDB for transaction storage and querying
- Cache: Redis for high-performance caching
- Validation: TypeBox for runtime schema validation
- Identity: BAP (Bitcoin Attestation Protocol) integration
- Total API Endpoints: 35
- Route Categories: 6 (Transactions, Social, Analytics, Health, Queries, Charts)
- TypeBox Schemas: Comprehensive runtime validation
- Caching Strategy: Redis with optimized TTLs
- Performance: Sub-100ms response times for cached endpoints
- Follow TypeScript best practices
- Use TypeBox for all schema definitions
- Add comprehensive tests for new endpoints
- Update documentation when adding routes
- Run linting and type checking before commits
MIT