A fast, resilient, isomorphic hacker news clone in ~1k lines of rust.

Overview

Hackernews sauron

A hacker news clone in ~1k lines of rust. This is using sauron web-framework.

Feature

  • Isomorphic
    • Completely identical server-side rendered and client-side rendered
    • No weird font jumping.
  • Resilient
    • Can work without javascript enabled.
    • Can work without the page server*.
      • You can kill the server after the initial serve.
    • *Note: This will not work if both points of failure are encountered at the same time.

Quickstart

Prerequisite:

cargo install wasm-pack

Compile and run

git clone --depth=1 https://github.com/ivanceras/hackernews-sauron

cd hackernews-sauron

wasm-pack build client --release --target web

cargo run --release --bin server

Navigate to http://localhost:3030

Screenshot

Online demo

You might also like...
Wordlet - a command line clone of Wordle, written in Rust.
Wordlet - a command line clone of Wordle, written in Rust.

Wordlet Wordlet is a command line clone of Wordle, written in Rust. Installation $ cargo install wordlet Usage After installation, start Wordlet by ty

A clone of linux cal command, using rust programming language

CLI Calendar command What the project does This command was inspired by Linux Cal command that shows the current month calendar as output (by default)

A minecraft clone made in Rust - WIP
A minecraft clone made in Rust - WIP

unsafe {} A minecraft clone made in Rust. The world is infinite in all three directions. DISCLAIMER: Some textures are stolen from the chisel mod HEAV

rust cli project.el clone for those leaving emacs

R-Ject I was a longtime Emacs user and really miss the project management that came with projectile.el and project.el at the same time I was looking f

A cat(1) clone with syntax highlighting and Git integration.
A cat(1) clone with syntax highlighting and Git integration.

A cat(1) clone with syntax highlighting and Git integration. Key Features • How To Use • Installation • Customization • Project goals, alternatives [中

A toy-clone of ping

Rong Ping is a simple command that is used to check the liveness of a server. Ping measures the round-trip time for messages sent from the originating

xcp is a (partial) clone of the Unix cp command. It is not intended as a full replacement

xcp is a (partial) clone of the Unix cp command. It is not intended as a full replacement, but as a companion utility with some more user-friendly feedback and some optimisations that make sense under certain tasks (see below).

A simple cli to clone projects and fetch all projects in a GitHub org..

stupid-git A simple cli to clone projects and update all projects. get all repository from GitHub clone all pull all with git stash Usage create sgit.

My own image file format created for fun! Install the "hif_opener.exe" to open hif files. clone the repo and compile to make your own hif file

Why am i creating this? I wanted to create my own image format since I was 12 years old using Windows 7, tryna modify GTA San Andreas. That day, when

Comments
  • Wrong story opened under best sorting

    Wrong story opened under best sorting

    Hi, I am learning to implement a router through this example cuz I cannot find a built-in one in sauron. When I open your online demo, it is StorySorting::Top by default. If I switch it to any other sorting and click on the link to open the story or user. It will show the corresponding one in Top sorting in terms of position.

    Please let me know if there is a way to fix this. Thank you!

    bug 
    opened by bryan824 4
  • Client crash

    Client crash

    Hi, when I build and run this project and then load http://localhost:3000 and click on "best" in the orange top bar of the site and then click on "top" in the same orange top bar, the page stops working. I get output in the console showing that this is due to a crash.

    The full output is quite long so I am initially posting only the beginning of the two messages that show up in the console:

    client.js:321 panicked at 'must have a parent node, tag: Some("ol"), path: TreePath { node_idx: 110, path: [0, 2, 0, 0, 4] }, for patch: Element(
        Element {
            namespace: None,
            tag: "li",
            attrs: [
                Attribute {
                    namespace: None,
                    name: "key",
                    value: [
                        I64(
                            28199994,
                        ),
                    ],
                },
            ],
    [...]
    

    and

    client_bg.wasm:0x9a362 Uncaught RuntimeError: unreachable
        at __rust_start_panic (client_bg.wasm:0x9a362)
        at rust_panic (client_bg.wasm:0x98546)
        at std::panicking::rust_panic_with_hook::h2d9079427a2d996a (client_bg.wasm:0x8a5f0)
        at std::panicking::begin_panic_handler::{{closure}}::h4e49f350d9f4de36 (client_bg.wasm:0x8fd5f)
        at std::sys_common::backtrace::__rust_end_short_backtrace::h91e711607d91be52 (client_bg.wasm:0x97dfc)
        at rust_begin_unwind (client_bg.wasm:0x97074)
        at std::panicking::begin_panic_fmt::h7a3482363d68bbca (client_bg.wasm:0x97b8c)
        at sauron_core::dom::apply_patches::apply_patch_to_node::{{closure}}::h75823b077a8bf1f0 (client_bg.wasm:0x90153)
        at sauron_core::dom::apply_patches::patch::hbbaec4fc219f9cfc (client_bg.wasm:0x32ca2)
        at sauron_core::dom::dom_updater::DomUpdater<MSG>::update_dom::h1ec3d272cce49647 (client_bg.wasm:0x5c501)
    $__rust_start_panic @ client_bg.wasm:0x9a362
    $rust_panic @ client_bg.wasm:0x98546
    [...]
    

    The browser I am using is Brave Version 1.28.105, which is based on Chromium: 92.0.4515.131 (Official Build) (arm64). Running on a MacBook Pro M1 with macOS Big Sur Version 11.5.2.

    bug 
    opened by ctsrc 3
Owner
Jovansonlee Cesar
Rust programmer, library creator, blockchain enthusiast.
Jovansonlee Cesar
Cloc - cloc counts blank lines, comment lines, and physical lines of source code in many programming languages.

cloc Count Lines of Code cloc counts blank lines, comment lines, and physical lines of source code in many programming languages. Latest release: v1.9

null 15.3k Jan 8, 2023
Consume the news in yout terminal. 📰

News TUI News is a text user interface that allows you to consume daily news in multiple categories like technology, science, health, and so on. Insta

Samy Rahmani 3 Jul 17, 2023
The hacker's BLE (bluetooth low energy) browser terminal app

Blendr is a terminal UI app for browsing BLE (Bluetooth Low Energy) devices. It allows you to inspect, search, connect, and analyze data coming from B

Dmitriy Kovalenko 120 Jul 4, 2023
a cargo subcommand for counting lines of code in Rust projects

cargo-count Linux: A cargo subcommand for displaying line counts of source code in projects, including a niave unsafe counter for Rust source files. T

Kevin K. 125 Dec 1, 2022
Neovim plugin for moving lines up and down, written in Rust

Moveline.nvim Moveline is a simple plugin for moving lines up and down. It's written in Rust using my library nvim-utils. Installation Moveline can be

Will Hopkins 34 Mar 18, 2023
Just a simple object renderer, written in under 500 lines using Rust.

All cargoes that the project runs are: bitflags: a crate for defining bitflag types cfg-if: a small macro crate for defining cfg-based - conditional c

null 3 May 4, 2023
A tool for adding new lines to files, skipping duplicates and write in Rust!

anew A tool for adding new lines to files written in Rust. The tool aids in appending lines from stdin to a file, but only if they don't already appea

z3r0yu 4 Nov 16, 2023
Turns lines of text into SVG files.

Sentences 2 svg Does what it says on the tin. This takes in a file with some sentences and outputs numbered svgs. There are 3 arguments to keep in min

Fallen 4 Eyes 1 Jan 1, 2022
Command-line tool that provides a workflow for extending, editing, diffing, and writing to vim-style grep lines.

Grug Grug is a command-line tool that provides a workflow for expanding, editing, diffing, and writing edits to files using vim-styled grep lines (suc

null 4 Apr 25, 2023
🦀 Stupid simple presentation of the number of words, characters and lines on your clipboard.

clipcount: Counting words from the clipboard content Why does this exist? Do you find yourself often needing to count the number of words in a piece o

Magnus Rødseth 3 Feb 23, 2024