[HN Gopher] Show HN: A text-only blog engine using Cloudflare wo...
       ___________________________________________________________________
        
       Show HN: A text-only blog engine using Cloudflare workers and KV
       store
        
       Author : jonutah
       Score  : 83 points
       Date   : 2024-10-26 12:40 UTC (10 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | jagadeeshposni wrote:
       | I have been working on something similar this morning. I want to
       | create a simple blog to document my thoughts without having to
       | deal much about technical stuff and maintenance and spend a few
       | hours diving the rabbit hole of jekyll blogs.
       | 
       | While their documentation(https://jekyllrb.com/docs/) is one of
       | the best resources to learn, I have found my job much more
       | straightforward using one of the pre-built themes that is
       | available on the internet. With deployment to github pages almost
       | instantaneous, I can see myself updating the blog much more
       | often.
       | 
       | The blog which I am currently working on:
       | https://jagadeeshposni.github.io The theme I have used: minimal
       | mistakes
        
         | pyeri wrote:
         | Minimal mistakes is a great theme. I had almost decided on
         | minimal mistakes when I wanted to upgrade my blog from a simple
         | two column Hyde theme. But then I wrote the template from
         | scratch using bootstrap-5 as I felt that gave me more control
         | and I took it as opportunity to develop my frontend skills.
         | Here is my blog:
         | 
         | https://prahladyeri.github.io/
        
         | LtdJorge wrote:
         | Same happened to me with Astro. Yes, it's much more involved
         | initially because you have to set up the entire layout, but
         | after that, adding content only pages is just writing Markdown.
         | And for the layout, with the help of Tailwind and TailwindUI,
         | it's pretty easy for a non-designer.
        
       | simonw wrote:
       | 6 comments already complaining that this isn't "simple".
       | 
       | I suggest we instead treat this post as if the title was "Show
       | HN: a simple text blog demonstrating how to use Cloudflare
       | workers and KV store" - that way we get to have a more
       | interesting conversation.
        
         | dang wrote:
         | Thanks--we've put that (more or less) in the title above.
         | 
         | (Submitted title was 'Show HN: Simple Text Blog")
        
           | jonutah wrote:
           | Sorry and thanks for fixing. I'd put more detail in the
           | description but didn't realise it didn't show. Thanks for
           | making the title more accurate.
        
         | Xeoncross wrote:
         | I'm honestly not sure what the problem with "simple" is either.
         | 
         | It's literally a single file with 80 lines of code. At this
         | point the only thing easier is a linux one-liner to serve a
         | file directory over HTTP.
         | 
         | Like, has anyone ever used Jekyll, Hugo, Ghost, Jr, Wordpress
         | or any other blog system? None of them are anything close to 80
         | lines of code.
        
       | dang wrote:
       | [stub for offtopicness]
        
         | Eikon wrote:
         | What's simpler about this than just uploading .html files?
         | 
         | This seems actually very complicated for what it does.
        
           | deafpolygon wrote:
           | I was going to say, just upload .txt
        
           | simonw wrote:
           | Just uploading HTML files won't teach you how to use
           | Cloudflare workers and their KV store.
        
             | krapp wrote:
             | A "simple text blog" shouldn't need to use anything of the
             | sort.
        
               | simonw wrote:
               | Sure, but you're getting hung up on the link title and
               | not the actual substance.
               | 
               | Imagine if the title was this instead: "Show HN: a simple
               | text blog demonstrating how to use Cloudflare workers and
               | KV store"
        
               | evbogue wrote:
               | Would simple text chatroom demand the kv?
        
               | krapp wrote:
               | No.
        
               | evbogue wrote:
               | Yah, I guess you could use WebRTC or some other way of
               | exchanging messages now that I think about it.
        
               | krapp wrote:
               | You don't even need realtime. You can get away with just
               | having people POST to a backend, updating a database and
               | letting people refresh the page.
        
               | evbogue wrote:
               | Why do all that when you could have the server write
               | simple text files to the disk?
        
         | yakshaving_jgt wrote:
         | This is anything but simple.
        
           | lhousa wrote:
           | Suggestion: "plain text blog"
        
         | kissgyorgy wrote:
         | How is that simple?
         | 
         | Simple would be if you would just write text files, drop it
         | somewhere simple, either a webserver or GitHub pages or some
         | hosted service, and be done with it.
        
         | zeroq wrote:
         | [flagged]
        
           | dang wrote:
           | " _Please don 't post shallow dismissals, especially of other
           | people's work. A good critical comment teaches us
           | something._"
           | 
           | https://news.ycombinator.com/newsguidelines.html
        
             | zeroq wrote:
             | I'm sorry Dan, but whose work? His or the entire JS
             | community as a whole? If the latter then yes, I'm guilty as
             | charged, because I deeply believe that we went way too far
             | and the fact that a few years old smartphone can't handle
             | sites like LinkedIn is just ridiculous. If the former,
             | then, like I've stated in my opening statement it's a cool
             | experiment you can do over a weekend if you want to learn
             | something new or brush off your skills but is it really
             | worth calling a "blog engine" or place on 1st page of HN?
        
               | bravura wrote:
               | It's quite a smear to write "He's probably unemployed at
               | the moment or just brushing off before the next
               | interview.". Cheap smears are a form of casual dismissal
               | and devalue this site.
        
       | jumping_frog wrote:
       | I think what would be amazing is if WhatsApp creates a mobile
       | number based website which anyone can access if they know the
       | mobile number. Access through whatsapp mobile app.
        
         | bravura wrote:
         | That's called a Telegram bot and you can write one yourself.
        
       | simonw wrote:
       | I tried this out and found it useful for exploring Cloudflare
       | workers. One thing I learned: KV and durable objects are not the
       | same thing. KV is eventually consistent, durable objects is the
       | thing where all traffic has to be routed to the same node since
       | it's dealing with a read/write store that has read-after-write
       | guarantees.
       | 
       | Also Cloudflare KV provides a simple dashboard interface for
       | adding and removing KV entries:
       | https://gist.github.com/simonw/1e072d04960616970381a433bfca7...
        
       | stavros wrote:
       | This is great, thanks! It's always useful to see these "here's
       | how to do something useful with a new technology" demos, and I've
       | been wondering how Cloudflare's offerings work exactly, so
       | thanks!
       | 
       | Now we need the equivalent thing for Durable Objects! Maybe a
       | chat room, hm.
        
       | eggfriedrice wrote:
       | This is nice, apart from a quick play when they were new I've
       | never really looked at CF Workers and KV again. This made me go
       | and have a look at the docs and find that it's actually looks
       | quite useful. I didn't know they'd added Python and other
       | languages, so that's cool in itself.
       | 
       | I like Jon's example here, a single and fairly short file that
       | does just enough to demo this all, nice.
        
         | Super_Jambo wrote:
         | I'd have thought the SQLite database (D1) would be a more
         | obvious fit for a blog?
        
           | bravura wrote:
           | I was stoked on D1 when it was announced.
           | 
           | But the maximum DB size is 10GB
           | (https://developers.cloudflare.com/d1/platform/limits/).
           | 
           | Really?
        
             | Super_Jambo wrote:
             | I assume the intention is you store actual data in R2
             | objects and just hold references to them in D1.
        
           | jonutah wrote:
           | Good point, I'm making my way through exploring more of CF so
           | I'll likely try a D1 variant of this. Ta
        
       | hk1337 wrote:
       | I like it but not that enthusiastic about JavaScript echoing
       | html. What about having simple html templates that call back to
       | the worker for the posts and the worker return json?
        
         | jonutah wrote:
         | Yeah it is gross interweaving html fragments randomly but I
         | wanted to see if I could do it and keep it all constrained to
         | one file. Thanks for the feedback.
        
       | ThinkBeat wrote:
       | What is the pricing structure on this?
       | 
       | I am sure there is a free-tier, but if we skip that and pretend
       | we are paying for it from the beginning.
       | 
       | How would much 100.000 hits be?
       | 
       | I presume it would be a tiny number, A esp given the current
       | content in the blog. so lets imagine some photos and heavier
       | content.
       | 
       | How difficult would it be to extend with with CF CDN?
        
         | LtdJorge wrote:
         | For workers, free is 100k hits per day and 10ms of CPU per hit.
         | KV is 100k reads, 1k writes, 1k deletes, 1k lists and 1GB
         | storage.
         | 
         | The subscription is 5 USD a month, including 10M hits at 30ms
         | each, 10M w, 1M r, 1M d, 1M l, and also 1GB.
         | 
         | One of the examples in their page (for a fully dynamic website,
         | which is worst case) is: Subscription $5.00
         | 
         | Requests $1.50 (15,000,000 requests - 10,000,000 included
         | requests) / 1,000,000 * $0.30
         | 
         | CPU time $1.50 ((7 ms per request * 15,000,000) - 30,000,000
         | included CPU ms) / 1,000,000 * $0.02
         | 
         | Total $8.00
        
           | sigio wrote:
           | I'll stick my static website on a $3.50 VPS then, and have no
           | practical limits and a fixed price. Also soo much simpler.
        
       ___________________________________________________________________
       (page generated 2024-10-26 23:03 UTC)