Bear Blog – A privacy-first, fast blogging platform
bearblog.dev
bearblog.dev
After getting burned out of blogging after maintaining my own platform (instead of just writing), something like this is appealing to me.
Is it possible for others to use this as well ?
But try to signup. It should work for other people too now. It just not polished yet.
Non trivial. I wish there was an API.
Well, there is a fair amount of css wrapped in <style> tags. Not sure I understand the upside of not putting it in a separate file.
Though the look is reasonably pleasant.
Edit: The example blog also loads js, despite the "no javascript" claim. Like: <script src="https://cdn.usefathom.com/script.js" data-site="WKWMFTPV" defer></script>. Perhaps that's not a default thing, but it seems odd to link to an example blog that doesn't match the sales pitch.
I ran a bunch of tests when setting it up to see what loads faster and it turns out the <style> tag in the head, with such minimal styles outperformed external stylesheets (even though the browser can cache them). With styles so small once the html page is loaded (at 2-5kb gzipped) the styles are immediate, whereas even if retrieving from browser cache the html needs to load first before it can take effect.
The second bit with Fathom analytics is that users can optionally connect Fathom to their accounts (this is the only analytics tool you can connect since they have a track record of being trustworthy). But yes, it is technically included JS.
All in all I think developers have considered all options and chose the best solution for their particular use case.
One other thing that is almost always overlooked is that you don’t tend to use all styles on a given page, and you could strip out the unused styles. For example, the front page linked here has over 4KB of stylesheet, unminified and with unused styles; minified, it’s 3KB; with unused styles removed (including the wonky body:hover), it’s about 662 bytes. Something in the vicinity of 1KB is for specific pages, and 1KB for editing (form fields and such). If you try actively minimising the front page (removing unnecessary whitespace and attribute quotation marks, minifying and paring the stylesheet, and removing a few pointless elements), the whole thing ends up under 3.4KiB (down from 7.8KiB).
(Mind you, most browsers can do some degree of intra-session sharing of an in-memory representation of a stylesheet, for performance and memory usage reasons, and doing this will thwart that. But that’s only likely to make things faster over inlining if you’ve got much heavier styles, dozens or hundreds of kilobytes, the sort that you wouldn’t be so likely to inline anyway.)
As for the “making additional requests thing”: you still have to remember latency, because you’re adding another whole round trip to the waterfall. In the case of bearblog.dev which is hosted somewhere on the other side of the world from me (I’m in Australia), that will add an absolute minimum of over 260ms, more commonly half a second or more. Inlining of small resources like this when you have a very short waterfall already significantly improves load performance. The HTTP/2 and HTTP/3 improvements are about requesting more than just a couple of resources: in a case like this if you had one HTML and one CSS resource from the same host, HTTP/2 would not improve anything over HTTP/1.1.
I’ve spent a lot of time obsessing over this—and being perplexed by performance-focused web devs favoring inline styles generally. Here’s what I’ve found.
- External <link> stylesheets are exactly as you describe, with some important caveats depending on specifics of the actual page, site, host, resources, and other bundle characteristics.
- Perceived performance is almost universally better, for all network conditions I’ve tested, when at least a portion of a page’s styles are inlined in <head>. Yes, even with HTTP/2. Yes, even with optimal metadata hints which should degrade better on a slower network. The most reasonable conclusion I can come to is that the main document parser is so well optimized that beating it is like challenging the Harlem Globetrotters on “fundamentals”: you’re going to be right, some of the time; you’re going to lose, every time.
- The benefits of inline styles degrade pretty quickly for subsequent navigations, with appropriate cache headers. This is expected, but with perf (web or otherwise) validating assumptions isn’t something you should leave unspoken.
- Many hosts have bad cache headers, even those you’d expect to do better (glares at GitHub Pages, my host).
- While the benefits of inline styles degrade rapidly, the drawbacks rarely if ever accelerate enough to care except under the worst network circumstances. And the drawbacks of <link> stylesheets accelerate much more rapidly.
- Most of these facts are mostly unnoticeable, on most mainstream devices, for most of this audience. You have to measure to register a difference, and the measuring has a greater impact than any measurable implementation difference.
- The notable exception, one which users will notice regardless of their device capabilities or network conditions, is web fonts. If you load them, the best perceived performance strategy is to mark them optional. Even so, they have the greatest impact on perceived performance, on otherwise well optimized pages, on high perf devices with good network conditions.
- When loading fonts on a page, inline styles perform dramatically better than <link> stylesheets regardless of any other implementation detail or circumstance. They have better perceived performance if baseline styles like colors and basic typography are inlined as well. This is what is commonly glossed over (and sometimes overloaded to mean more) as “critical styles”.
- From this point on, <link> styles perform “the same or better” for a basically useless unit of “better”. Assuming a relatively flat request waterfall. HTTP/2 helps if you know your entire dependency graph upfront, which nearly no site does… and it doesn’t matter, because Push is dead or on its way out and that graph is meaningless if the client disregards it.
- Good luck knowing your dependency graph. The tools that are designed for it are concerned with JS bundles. Your best bet is the added build-time complexity of CSS-in-JS and dynamic atomic classes (which are both great, albeit an unpopular combination). If you don’t, you’re either serving redundant styles, too many (my personal preference, after critical styles), or you’ve rolled your own static analysis tool (please share!).
Also the amount of time taken to download a CSS file is usually much less than the round trip time for requesting the file. Especially in the p90/p99 end of the latency distribution. Here in Australia, I can download a 10kb css file in less than 1ms. But simply requesting that CSS file from America will take 200ms.
For a blog, inlining the css is absolutely the way to go. Especially if the css is small (which it should be!).
depending on _how_ you cache it, there might be a cache invalidation round trip for your css (Q: has this changed? A: no), which might or might not transfer more data than your embedded css anyway.
Unless you’re hyper tuning the page load performance in some specific way I think CSS is usually best served as a separate asset with a very generous cache time.
If the entirety of the CSS is extremely minimal it can make sense to in-line it too. Especially if you can get everything in at under 14kb. (Initial TCP window size)
There's no FOUC if you add a stylesheet to <head>, and it concerns me that people seeing that flash have come to expect it as a fault of CSS, when it's really these frameworks making a decision to load the stylesheet via javascript.
Seems like this is loading Fathom analytics: https://usefathom.com/
Probably safe to turn off, as uBlock Origins and other ad blocking solutions would, depending on your settings. So I guess in a way the site itself works just fine without JS enabled and doesn't require it, but the authors have chosen to add analytics to see who uses their site, then.
I inject some CSS to make it work for me, i.e. fonts - and simple colors and I removed most of the "extra" pages because I wanted to keep it as a one pager. It's a great platform and I wish there was a version where I could self host it like `hexo.js`
Thanks for your work herman!
[1] orlie.dev - Currently using it behind Cloudflare!
- "No trackers, no javascript, no stylesheets" - inline js. - inline stylesheets. - uses favicon which can be used for tracking. - not self hosted. - requires an account to sign up - "TOS" > "Bear may disclose personally identifiable information under special circumstances, such as to comply with subpoenas or when your actions violate the Terms of Service." - can't be bothered to indent the html. - payment system could require real identity.
As far as I understand bitcoin is mostly useless for actual payment these days.
Their servers are located in the Netherlands. Its good that they list that. It would be better to hoist information into something that is less policy/legal oriented and perhaps provide an overview of the laws of that region.
Other things that should be listed is how is the data stored, transferred, how is it protected, are there any steps to anonymize the data, hash the data, or provide a way to bring your on key for data encryption.
Is there any telemetry gathered or stored by the server? Is the code in the github project the same that is deployed in production or is there a private repo that augments the code?
——
- "No trackers, no javascript, no stylesheets"
- inline js.
- inline stylesheets.
- uses favicon which can be used for tracking.
- not self hosted.
- requires an account to sign up
- "TOS" > "Bear may disclose personally identifiable information under special circumstances, such as to comply with subpoenas or when your actions violate the Terms of Service."
- can't be bothered to indent the html.
- payment system could require real identity
Markdown is not the only game in town. Yes, for now it’s the dominant lightweight markup language (more’s the pity—it’s a right mess, thoroughly unsound and inconsistent in a great many ways), but a lot of stuff exists beyond its horizons; it’s only an instance of LMLs, not the whole class.
> uses stylesheets anyway
I don't get this part.
What blogging platforms focus on this side of things? Which ones help solve the "What do I write next?" problem?
You should write about nothing though, it's a good writing exercise. Just maybe don't publish it? Publish what you write after that, when you know what to write about.
The hardest part of a blog is actually filling it with compelling content — research, writing and editing.
The hard part of forever isn't picking the right technology, it's keeping the content available online.
You can't self-host this. So unless your bank account is designed to pay for the URL, hosting, and keeping the project up to date forever, you're just lying to lock people into your platform.
Besides being exceedingly, aggressively negative and paranoid, this also doesn’t make sense at all. Why would they build this niche thing, make it explicitly privacy-focused, and target it to an audience who surely will notice any abuse?
Was annoyed I'd have to pay to have a custom domain but seeing it's a one time payment and not a subscription, I am probably on board.
Personally the minimalism is what drew me more than privacy stuff.
https://devnull.land/github-gist-blog
I only feel sort of bad that I basically use Gist as my data store.
Edit: I do like how neat it sounds to just query a user's public Gists though.
I've actually been thinking about different ways of adding exactly that to a static site - technically you could have something like a comments form that just writes to a text file somewhere (perhaps updating a Gist with the API you mentioned[1]), which the static site reads from upon page reload.
Sounds a bit inelegant I guess, but could be interesting to implement.
[1] https://docs.github.com/en/rest/gists/gists#update-a-gist
Alternatively there's https://github.com/giscus/giscus, which instead uses github discussions.
Haven't used either so can't comment (heh) on their "performance".
Comments on blogs is the whole point of posting things on the internet. That and forums and chat.
I keep a Contact page with various ways to reach me if you really want to chat about something. It's rare when folks chat me up but it's always a good convo when it happens.
Also, "privacy-first" and "self-hosted" are not mutually exclusive concepts. By your logic all software you don't host yourself isn't privacy respecting, which is a fair belief on your part, but opinionated at best.
Even if the software development cost and labour were free, we still need to figure out revenue generation for hardware and network in order for it to last forever.
I expected custom domain to be paid feature, but that doesn't seems to be the case here.
So do we have a business model for it to last forever, or even if it is something like 50 years.
Custom domain is a paid feature. It appears to cost $29 as of now.
There's the usual youtube and vimeo integration, but also
- integration with Flowcharts through mermaid https://jpanther.github.io/congo/samples/diagrams-flowcharts...
- charts through Chart.js https://jpanther.github.io/congo/samples/charts/
- and even LaTeX support: https://jpanther.github.io/congo/samples/mathematical-notati...
Client-side rendering works well enough for me, and has been for years (as a visitor). I don't see a benefit to integrate a custom Hugo patch to get server-side rendering for my simple personal blog.
There's an open source, self-hosted clone of BearBlog, called PolarBearBlog [0], that builds a docker image and run it on Google Cloud Run. It uses Google Cloud Storage to manage a single JSON file for the whole blog contents (yes all your blog posts are in a single json file, which probably will start to show issues when you have hundreds of posts, but then again it's just markdown text so maybe that won't be a big issue anyways), and you only need to redeploy it if you made code change or system level config changes, which really is really more convenient than the whole static approach.
I made a fork of PolarBearBlog to add some of the features I care about, like cactus comment integration and rending full posts in the RSS feed. [1]
[0]: As far as I could tell PolarBearBlog has no affiliation with BearBlog, but it did get a mention in BearBlog's README: https://github.com/HermanMartinus/bearblog/blob/master/READM...
You can self-host it on a "cheap" webhost and rsync the changes (that's the way I do it). Or you can integrate it with Github and host it with
- Netlify https://gohugo.io/hosting-and-deployment/hosting-on-netlify/
- AWS Amplify https://gohugo.io/hosting-and-deployment/hosting-on-aws-ampl...
- Cloudflare Pages https://developers.cloudflare.com/pages/framework-guides/dep...
to name a few. The hugo site has a couple of howtos.
Some hosting solutions require that the entire website is stored in a separate branch, others regenerate the HTML through a CI pipeline and store it in an object store.
It has been going amazing for me![2]
0: https://github.com/monkeyWzr/hugo-theme-cactus
1: https://github.com/abhijit-hota/kaktus
2: https://abhijithota.meComing from hugo, prose.sh has been much easier to publish content since I pretty much live in the terminal anyway.
Pricing
- Premium — all features
- $9/year
A blog hosting price that's actually reasonable! The trend of everything being $5-10/month is ridiculous, this is nice to see.In every case, Mataroa has a free tier, so you can always try before you buy. If you want to see, my blog is at https://blog.bayindirh.io.
I have mixed feelings about generic names like this, but naming a blogging service “Bear Blog” when there is a pretty well known Bear app for writing, seems to be inviting confusion.
Or maybe someone will make a Bear theme for Bear? Or a Bear to Bear integration?