Live data from Hacker News

Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

joshwcomeau.com

11–20 of 52 posts

Re: Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

#11
I can't help but feel like this article is a good summary of what's wrong with the modern internet. It's not a bad article, it just feels like a parody.

'Ok guys, now here's the modern way to make one of the more simple things from yesteryear.

First, lets bust out react....

A few hundred loc later...

Ok guys the database...

Sign up for account

Several more hundred loc later...

'Now to actually write our functions'

Download some dependencies Several hundred loc later...

And...here's your hit counter guys...

This whole article just captures perfectly the essence of all the things we complain about with the modern web.

Overengineered, convoluted solutions to simple problems.

Honestly, it would be nice sometimes if modern solutions remembered sometimes, it's ok to just keep it simple.

I did have a quick look around to see if i could find a simple, 'modern' hit counter.

https://www.codementor.io/@jamesezechukwu/how-to-create-a-si...

Personally, I prefer the simplicity of this to the article myself.

Re: Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

#12

Earlier quoted context omitted.

these days the hard part isn't the view counter logic, it's managing the 395,000 dependencies in your project

I used to be “dependency-first” for library code, but I’ve noticed lately that my first question has been “why wouldn’t it be a good idea to build in house?”

Hard same. After having a few experiences where a dependency hardly does anything, my approach is to read the docs first and see if I can implement the parts I need in a couple of hours. Often I can.

Re: Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

#13
I don't think this is at all in the spirit of hit counters of the past; IIRC they were an img tag that would be dynamically rendered serverside. Static markup » dynamic content.

Perhaps a more apples-to-apples comparison would be an img tag that returns an SVG, allowing CSS styling. You can still choose serverless backend, or you can use the tried-and-true apache/nginx with memcache, just like the 90s.

Re: Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

#14

I can't help but feel like this article is a good summary of what's wrong with the modern internet. It's not a bad article, it just feels like a parody. 'Ok guys, now here's the modern way to make one of the more simple things from yesteryear. First, lets bust out react.... A few hundred loc later... Ok guys the database... Sign up for account Several more hundred loc later... 'Now to actually write our functions' Do…

The one you've linked to doesn't seem to actually store the count anywhere, which seems to be the hard part.

Re: Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

#15

I can't help but feel like this article is a good summary of what's wrong with the modern internet. It's not a bad article, it just feels like a parody. 'Ok guys, now here's the modern way to make one of the more simple things from yesteryear. First, lets bust out react.... A few hundred loc later... Ok guys the database... Sign up for account Several more hundred loc later... 'Now to actually write our functions' Do…

Agree with a lot of what you wrote, but the example is weird. It's a client side counter with no persistence.

Re: Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

#16
post #15

I can't help but feel like this article is a good summary of what's wrong with the modern internet. It's not a bad article, it just feels like a parody. 'Ok guys, now here's the modern way to make one of the more simple things from yesteryear. First, lets bust out react.... A few hundred loc later... Ok guys the database... Sign up for account Several more hundred loc later... 'Now to actually write our functions' Do…

Agree with a lot of what you wrote, but the example is weird. It's a client side counter with no persistence.

Yeah, i realize that, it was just something quick I found after about a 30 second search. I wasn't trying to complain about the original article itself, it's obviously a production ready example whereas my linked one not so much.

It's just the general idea that, such things are required even for something so simple just seems over the top when you look at something like a hit counter alone.

It's just overall, if we tried to simplify, the simple things, would all the rest of the frameworks and apps end up being so convoluted and overengineered?

Re: Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

#18
I suspect this is intended to be just an example tutorial that isn't intended to be "this is how a hit counter SHOULD BE".

Queue the OMG modern web complaints that are correct that this is a lot for a hit counter, but this also I don't think that's the point here.

If someone were to take this article and think "oh this is how to build a web counter" that's not OMG modern web, that's a different problem.

Re: Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

#19
post #15

Earlier quoted context omitted.

Agree with a lot of what you wrote, but the example is weird. It's a client side counter with no persistence.

Yeah, i realize that, it was just something quick I found after about a 30 second search. I wasn't trying to complain about the original article itself, it's obviously a production ready example whereas my linked one not so much. It's just the general idea that, such things are required even for something so simple just seems over the top when you look at something like a hit counter alone. It's just overall, if we t…

Yes, I imagine there's some example that uses Redis or similar with a proper increment and locking somewhere, perhaps in an eventually consistent way that doesn't block the page load.

Re: Build a hit counter for Gatsby with React, AWS Lambda, and FaunaDB

#20

I don't think this is at all in the spirit of hit counters of the past; IIRC they were an img tag that would be dynamically rendered serverside. Static markup » dynamic content. Perhaps a more apples-to-apples comparison would be an img tag that returns an SVG, allowing CSS styling. You can still choose serverless backend, or you can use the tried-and-true apache/nginx with memcache, just like the 90s.

More like CGI with local state file and locking, or a DB back-end. I'm sure some major sites used memory, but at the point you need that you might be using a load balancer, reducing the usefulness of the technique.
Post reply on HN