Table of Contents
The backend is built with modern technologies chosen for their performance, developer experience, and ecosystem:
-
Runtime: Bun
- Chosen for its exceptional performance and built-in TypeScript support
- Provides native testing capabilities and package management
- Offers excellent developer experience with fast startup times
-
Language: TypeScript
- Ensures type safety and better developer experience
- Enables better code organization and maintainability
- Provides excellent IDE support and code navigation
The backend follows a modular service-based architecture:
src/
├── config/ # Configuration management
├── services/ # Core service implementations
├── types/ # TypeScript type definitions
└── utils/ # Shared utilities
Located in src/services/db
, handles:
- Data persistence
- Caching layer
- Query optimization
Twitter integration (src/services/twitter
) manages:
- Authentication
- Tweet interactions
- Rate limiting
- User management
Located in src/services/exports
, manages content distribution to external platforms:
- Generates RSS feed of approved submissions
- Configurable feed title and description
- Customizable maximum items limit
- Automatic XML escaping and feed updates
- Posts approved submissions to Telegram channel
- Formatted messages with submission details
- Automatic error handling and retries
- Real-time channel updates
This is extendible by registering a new export type in exports/types.
- Bun runtime installed
- Node.js 18+ (for some dev tools)
- Twitter API credentials
- Install dependencies:
bun install
- Configure environment:
cp .env.example .env
Required environment variables:
# Twitter API Credentials
TWITTER_USERNAME=your_twitter_username
TWITTER_PASSWORD=your_twitter_password
TWITTER_EMAIL=your_twitter_email
# Export Services Configuration
# Telegram
TELEGRAM_ENABLED=false
TELEGRAM_BOT_TOKEN=your_bot_token
TELEGRAM_CHANNEL_ID=your_channel_id
# RSS
RSS_ENABLED=false
RSS_TITLE=Curation Bot
RSS_DESCRIPTION=Latest approved submissions
RSS_FEED_PATH=public/feed.xml
RSS_MAX_ITEMS=100
- Start development server:
bun run dev
The backend exposes several endpoints for frontend interaction:
POST /submit
: Submit new contentGET /submissions
: Retrieve submission listPOST /moderate
: Handle moderation actions
See the Frontend README for integration details.