DEV Community

Cover image for Introducing Krabber.net
Toul
Toul

Posted on • Updated on • Originally published at automatetheboringstuffwithgo.ghost.io

Introducing Krabber.net

Hi, everyone today I'm introducing krabber a satirical Twitter clone built with GoLang (GO), AWS DynamoDB, HTMX, and Single Table Design.

The premise of Krabber is that Mr.Krabs has learned of web apps and how lucrative they can be, and so with the support of a grant (f-r-e-e monies) from the Bikini Bottom Modernization effort, has decided to make Krusty Krab IT, to diversify the business holdings of the Krusty Krab.

So, enjoy, and hope you have a good laugh out of it.

Please keep in mind that Krabber is not fully complete, but the majority of the core functionality exists;

  • Sign up/out
  • Follow/unfollow
  • Molt
  • threads
  • Like
  • Remolt
  • Front page (latest molts in last 24hrs)
  • Trench (molts from the crabs you follow)
  • Notifications

what mostly remains to be done is cosmetic UI changes (not my strength)...

If you'd like to see the code yourself then check; Krusty-Krab-IT/krabber-net and get some Golang web app inspiration.

The project is open-source and free for anyone to tinker with so go ahead and fork it and modify it as desired.

Technical Details

For those interested I'll dive into deeper detail on Single Table Design, HTMX, Server Side Rendered web apps, and Elastic Beanstalk.

High-Level Overview of Tech Stack

  • AWS
    • Elastic Beanstalk
    • Application Load balancer
    • Amazon Certificate Manager (ACM)
    • Route 53
    • DynamoDB
    • AWS SDK for GoLang v2/v1
  • E-mail
    • Mailtrap.io
  • HTMX
  • GoLang (GO)

Single Table Design

Is an architectural style popularized by AWS for use with its NoSQL DB of choice, DynamoDB. The reasoning is that 'joins' become one of the biggest bottlenecks as an app has more individuals interacting with it.

So, by eliminating other tables and only using one table you eliminate 'joins' and thus keep high performance when obtaining more interactions.

The trade-off for getting this performance gain is that a Single Table design is much more challenging to implement
as it requires knowing the read and write patterns upfront, otherwise a major change is painful, and often requires starting over.

But, taking an existing and well-known pattern and then translating it into a single table design isn't as painful. Hence, building a Twitter clone or a clone in general of another app reduces the pain.

Additionally, while learning about Single Table design I saw numerous assertions that a Twitter-like app would benefit greatly from it so thought sure why not try it?

Server Side Rendering (SSR)

Server-side rendering is the tried and true way of building web apps. It is boring and not as interesting, but as a solo builder, it is probably the simplest to use.

The gist of the pattern is the server shows HTML pages then as the user interacts it processes the HTML page and returns it with the populated data.

Think of it like this you fill out a bank withdrawal slip at your bank with a teller then they go to the machine and return with the money that you requested from your form.

Essentially, the burden of computing is on the server rather than the browser, which is the trend nowadays.

Lastly, GO's standard library has everything needed to do it, in addition to having built-in concurrency for most of the components, meaning the server can handle, around 15-30k crabs before knocking over (much more than I suspect it'll ever need).

Why AWS?

I chose AWS because of its generous free tier for computing and storage. Essentially, the server is free for a year or two for the instance size and so are the DynamoDB requests for read and write (it would take hundreds of millions of requests before I start paying for DynamoDB).

Since this is a hobby project, it is nice not to spend too much.

Additionally, AWS Elastic Beanstalk is great for a basic web app, from setting up DNS records, Load Balancing, continuous deployments, environment variable management, and auto-scaling, all out of the box. And there's the handy 'eb cli' tool to make managing everything simple from the terminal.

HTMX

HTMX is gaining traction as a JavaScript library, especially within the GoLang community and there are not many apps out there built using it, it aims to replace AJAX by giving SSR web apps that 'interactiveness' feeling.

Top comments (0)