Skip to content

Latest commit

 

History

History
169 lines (119 loc) · 4 KB

README.md

File metadata and controls

169 lines (119 loc) · 4 KB

curate.fun backend

Node.js/Hono.js backend service for the curate.fun platform

Table of Contents

Architecture Overview

Tech Stack

  • Runtime: Node.js with Bun for development
  • Framework: Hono.js
  • Language: TypeScript
  • Database: File-based with DB service abstraction

Service Architecture

The backend follows a service-oriented architecture with clear boundaries:

graph TD
    Server["Server Layer (Hono.js)"] --> Services["Service Layer"]
    Services --> SubmissionService["Submission Service"]
    Services --> ProcessorService["Processor Service"]
    Services --> TransformationService["Transformation Service"]
    Services --> DistributionService["Distribution Service"]
    Services --> ConfigService["Configuration Service"]
    Services --> PluginLoader["Plugin Loader Service"]
    
    style Server color:white
    style Services color:white
    style SubmissionService color:white
    style ProcessorService color:white
    style TransformationService color:white
    style DistributionService color:white
    style ConfigService color:white
    style PluginLoader color:white
Loading

Plugin System

The backend features a powerful plugin system with:

  • Runtime module federation for dynamic loading
  • Hot-reloading support
  • Type-safe plugin configuration
  • Custom endpoint registration
  • Scheduled task integration

Supported plugin types:

  • Source plugins (Twitter, Telegram, etc.)
  • Transformer plugins (AI Transform, Simple Transform)
  • Distributor plugins (Telegram, RSS, Notion, Supabase)

Development

Prerequisites

  • Bun runtime installed (for development)
  • Node.js 18+ (for production)
  • Twitter API credentials (for content source)

Setup & Running

  1. Install dependencies:
bun install
  1. Configure environment:
cp .env.example .env
  1. Start development server:
bun run dev

Testing

Run the test suite:

bun test

Run tests in watch mode during development:

bun test --watch

API documentation is available at /swagger when running the development server.

Plugin Development

To develop new plugins for curate.fun, see the Plugin Development Guide.

Plugins can extend the platform in various ways:

  • Add new content sources
  • Create custom transformations
  • Implement new distribution channels

The plugin system provides a standardized interface with type safety and comprehensive testing support.

Database Backup (Temporary)

AWS has been configured inside of the container, in order to take manual back-ups to Tigris object storage. These backups can be installed and replace .db/submissions.sqlite for local development, or for testing migration scripts.

  1. SSH into container
fly ssh console
  1. Export a backup, and then gzip it
litefs export -name db ./backups/MONTH-DAY
gzip ./backups MONTH-DAY
  1. Save to S3 bucket (environment is preconfigured with S3 secrets)
aws s3 cp ./MONTH-DAY.gz s3://curatedotfun-backups/MONTH-DAY.gz --endpoint-url https://fly.storage.tigris.dev
  1. Download from Tigris, unzip, and replace .db/submissions.sqlite