Skip to content

About

A visual programming blogging application built with Node-RED that allows users to post messages, filter by sender, and translate content to multiple languages in real-time. Built in November 2021. A Node-RED application demonstrates visual flow-based programming to create a functional blogging system with translation capabilities using custom code

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Node Red Blog

A visual programming blogging application built with Node-RED that allows users to post messages, filter by sender, and translate content to multiple languages in real-time.

Built in November 2021. This Node-RED application demonstrates visual flow-based programming to create a functional blogging system with translation capabilities using minimal custom code.

Features

Core Capabilities

  • Real-Time Messaging: Post and view messages instantly with automatic UI updates.
  • Dynamic Filtering: Filter messages by sender name with real-time feedback.
  • Multi-Language Translation: Real-time translation to Hebrew, Spanish, and French.
  • Visual Dashboard: Fully interactive UI built with Node-RED Dashboard components.

Technical Excellence

  • Visual Programming: Logic implemented primarily through visual flows for transparency.
  • Custom Node Integration: Custom lower-case node implementation for text processing.
  • API Integration: Integration with Google Translate API for real-time localization.
  • Clean Flow Design: Organized, named, and documented visual logic paths.

Developer Experience

  • Low-Code Environment: Rapid development and prototyping with Node-RED.

  • Live Editing: Real-time deployment and testing of flow changes.

  • Interactive UI: Built-in dashboard system for immediate user feedback.

  • 📝 Post text messages with content and sender information

  • 🔍 Filter messages by sender name with real-time updates

  • 🌐 Translate messages to multiple languages (Hebrew, Spanish, French)

  • 💾 In-memory message storage

  • 🎨 Interactive dashboard UI

  • ⚡ Real-time message updates

  • 🔄 Dynamic filtering and translation

Architecture

Architecture Principles

  • Visual Logic First: Prioritize built-in nodes over custom function code.
  • Loose Coupling: UI, logic, and data processing are separated by message flows.
  • Stateless Processing: Nodes primarily process data without external side effects.
  • Event-Driven: All actions are triggered by user input or incoming API events.
graph TB
    subgraph "User Interface"
        A[Dashboard UI<br/>localhost:1880/ui]
        B[Text Input: Content]
        C[Text Input: Sender]
        D[Dropdown: Language]
        E[Filter: Sender Name]
    end

    subgraph "Node-RED Flow Engine"
        F[HTTP POST<br/>Message Input]
        G[Store Message<br/>Memory Context]
        H[Filter Logic<br/>By Sender]
        I[Translation API<br/>Google Translate]
        J[Message List<br/>Display Logic]
    end

    subgraph "Data Layer"
        K[In-Memory Storage<br/>Context Object]
    end

    subgraph "External Services"
        L[Google Translate API<br/>translate.googleapis.com]
    end

    B --> F
    C --> F
    F --> G
    G --> K
    K --> H
    E --> H
    H --> J
    D --> I
    I --> L
    L --> I
    I --> J
    J --> A

    style A fill:#e1f5ff
    style K fill:#fff4e1
    style L fill:#ffe1e1
    style F fill:#e8f5e9
    style I fill:#f3e5f5
Loading

Flow Diagram

sequenceDiagram
    participant User
    participant Dashboard
    participant NodeRED
    participant Memory
    participant TranslateAPI

    User->>Dashboard: Enter message & sender
    Dashboard->>NodeRED: POST message
    NodeRED->>Memory: Store message
    Memory-->>NodeRED: Confirm storage
    NodeRED-->>Dashboard: Return all messages
    Dashboard-->>User: Display messages

    User->>Dashboard: Select language
    Dashboard->>NodeRED: Request translation
    NodeRED->>TranslateAPI: Translate text
    TranslateAPI-->>NodeRED: Return translated text
    NodeRED-->>Dashboard: Display translated messages
    Dashboard-->>User: Show translated content

    User->>Dashboard: Filter by sender
    Dashboard->>NodeRED: Apply filter
    NodeRED->>Memory: Query messages
    Memory-->>NodeRED: Return filtered messages
    NodeRED-->>Dashboard: Display filtered results
    Dashboard-->>User: Show filtered messages
Loading

Getting Started

Prerequisites

  • Node.js (v14 or higher)
  • npm or pnpm

Installation

  1. Clone the repository:
git clone https://github.com/orassayag/node-red-blog.git
cd node-red-blog
  1. Install dependencies:
npm install

Available Scripts

Start Node-RED:

npm start

Run Tests:

npm test

Running the Application

  1. Start Node-RED:
npm start
  1. Access the applications:

Configuration

The application runs with default Node-RED settings. To customize:

  • Edit Node-RED settings in ~/.node-red/settings.js
  • Modify flow configurations in the Node-RED editor
  • Deploy changes using the "Deploy" button

Usage

Posting Messages

  1. Navigate to the dashboard UI
  2. Enter message content in the "Content" field
  3. Enter sender name in the "Sender" field
  4. Click submit to post the message
  5. View the message in the list of all messages

Filtering Messages

  1. Use the "Sender" filter dropdown or input
  2. Select or type a sender name
  3. Messages update in real-time to show only matching sender
  4. Clear filter to view all messages

Translating Messages

  1. Select target language from the "Language" dropdown:
    • Hebrew (he)
    • Spanish (es)
    • French (fr)
  2. All messages are translated automatically
  3. Change language selection to see messages in different languages

Directory Structure

node-red-blog/
├── lower-case.js          # Custom lower-case node implementation
├── package.json           # Project dependencies and node definitions
├── package-lock.json      # Locked dependency versions
├── misc/                  # Documentation and resources
│   └── Node-Red App.docx.pdf  # Original assignment details
├── .github/               # GitHub configuration (rulesets)
├── .vscode/               # VS Code settings
├── CONTRIBUTING.md        # Contribution guidelines
├── INSTRUCTIONS.md        # Detailed setup and usage instructions
├── LICENSE                # MIT License
└── README.md             # This file

Custom Nodes

lower-case.js

A custom Node-RED node that converts text to lowercase. Defined in package.json:

"node-red": {
  "nodes": {
    "lower-case": "lower-case.js"
  }
}

Technical Details

Message Storage

Messages are stored in Node-RED's context object:

  • Scope: Flow or global context
  • Persistence: Memory only (lost on restart)
  • Structure: Array of objects with content and sender fields

Translation API

Uses Google Translate API (unofficial endpoint):

https://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl={lang}&dt=t&q={text}

Note: This is an unofficial API and may have limitations. For production use, consider Google Cloud Translation API.

Dashboard Components

Built with node-red-dashboard:

  • Text input fields
  • Dropdown selectors
  • Template nodes for custom HTML
  • Real-time data binding

Design Patterns

  • Observer Pattern: The dashboard UI automatically observes and reacts to changes in the message context.
  • Strategy Pattern: Different translation languages are handled by a unified translation strategy within the API nodes.
  • Singleton Pattern: The flow and global context objects act as singletons for storing message data across nodes.

Development

Node-RED Best Practices Used

  1. Minimal Function Nodes: Uses built-in nodes wherever possible
  2. Visual Flow Design: Logic represented visually for easy understanding
  3. Node Naming: All nodes have descriptive names
  4. Flow Organization: Organized into logical sections
  5. Error Handling: Proper error handling in critical paths

Exporting Flow

To export your flow:

  1. Select all nodes (Ctrl+A or Cmd+A)
  2. Menu → Export → Clipboard
  3. Save as flows.json

Importing Flow

To import a flow:

  1. Menu → Import → Clipboard
  2. Paste the JSON
  3. Click "Import"
  4. Deploy the flow

Known Limitations

  • Messages are not persisted (stored in memory only)
  • Translation requires internet connection
  • Unofficial Google Translate API may have rate limits
  • Single server instance (no clustering support)

Contributing

Contributions to this project are released to the public under the project's open source license.

Everyone is welcome to contribute. Contributing doesn't just mean submitting pull requests—there are many different ways to get involved, including answering questions and reporting issues.

Please feel free to contact me with any question, comment, pull-request, issue, or any other thing you have in mind.

See CONTRIBUTING.md for detailed contribution guidelines.

Support

For questions, issues, or contributions:

Author

License

This application has an MIT license - see the LICENSE file for details.

Acknowledgments

  • Built for educational and research purposes
  • Respects robots.txt and implements rate limiting
  • Uses user-agent rotation to avoid detection
  • Implements polite crawling practices

About

A visual programming blogging application built with Node-RED that allows users to post messages, filter by sender, and translate content to multiple languages in real-time. Built in November 2021. A Node-RED application demonstrates visual flow-based programming to create a functional blogging system with translation capabilities using custom code

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors