Astro just launched a database

Issue #271.March 14, 2024.2 Minute read.
Bytes

Today’s issue: The DevRel went down to Georgia, positive affirmations for site reliability engineers, and web apps that become piles of primordial ooze.

Welcome to #271.


Eyeballs logo

The Main Thing

Guy posing for a picture with a floppy disk

Ben Holmes showing off the latest edition of Astro DB

Astro just launched a database

Yes, you read that correctly. And no, this isn’t an early April Fool’s joke.

Astro DB is a fast, fully managed SQL database designed exclusively for Astro sites. But before we dig into how it’s different from the 50 other database offerings out there, let’s take a closer look at why and how they built it.

Why they did it: Since they first introduced their Islands architecture, Astro has always been focused on building content-driven websites. They doubled down on that use case when they launched Content Collections last year to provide a “TypeScript for your Markdown” experience.

Developers loved it, but Astro didn’t want to stop there. They had their eyes set on the granddaddy of them all — WordPress. And one of the biggest drivers of WP’s popularity is its built-in database.

WordPress smartly understood that all content is data, so they gave users a simple way to manage all of their article content, pages, images, blocks, and plugins in one place. Astro wanted to do the same thing for their own users, but doing so meant they’d have to go beyond static repo data and step into the deep waters of database land.

The problem? Databases, historically, don’t have the best DX…

How they built it: They started by trying to build SQLite into Astro itself, but ran into a few blockers, one of which was imagining what would happen when a JavaScript developer realized their C++ binary failed to compile.

This caused them to put the idea on hold for a while, until they discovered libSQL — a fork of SQLite created by the Turso team that offered a more modern, lightweight DB client for JavaScript/TypeScript.

Astro immediately fell in love with libSQL, because it worked everywhere without any extra dependencies or services. According to FKS (Astro’s co-creator), “libSQL allowed us to rethink the product in a way that makes the database a core part of the experience that is always there.”

And as we all know from our abstinence-based sex ed classes, when a framework and a database love each other very much, something beautiful like Astro DB is born.

So what does Astro DB actually give you?

  • Automatically configured: As soon as you start up your dev server, you get a fully local libSQL database, along with the schema, the seed file, and a type-safe ORM (Drizzle). You don’t have to worry about configuration, provisioning, or setup at all.

  • Free tier that scales: Astro DB automatically scales up to meet demand, then scales back down to $0 when inactive. And because of Turso’s database per tenant model, Astro DB can cheaply spin up hundreds of thousands of DB’s on demand — so you don’t need to worry about them rug-pulling their free tier.

  • Get started fast: You can create a new DB for your Astro project in 30 seconds, leaving you with plenty of time to worry about the existential dread of getting users.

Bottom Line: This is the first time we’ve seen Astro-the-company try to make money, but if they really can deliver a next-gen WordPress experience for developers, I think they may be onto something.

        

Sonar logo

Our Friends
(With Benefits)

Darth Vader skipping in the countryside

Tfw you know your code is squeaky clean

Learn how to implement static code analysis — in-depth webinar

Your team probably already does some form of unit or end-to-end testing — but how do you check to see if your code is reliable, maintainable, and secure?

The answer is static code analysis, and Sonar is hosting a free in-depth webinar on April 17th that will dive deep on the topic.

Here’s what you’ll learn:

  • What static code analyzers do, and how they give you more power than static type checkers like TypeScript.

  • How to go beyond your test runner to get helpful insights about your code quality.

  • How to ship new features faster with code that is always secure, maintainable, and reliable.

Sound interesting? Sign up today and learn how to reduce the chaos in your codebase — for free.


Spot the Bug logo

Spot the Bug

Sponsored by FusionAuth

They created this free whitepaper on How to implement passkeys into your app to improve user security, and why they’re better than traditional passwords.

class Person {
  constructor(name, age) {
    this.name = name;
    this.age = age;
  }

  set name (value) {
    this.name = value;
  }

  set age (value) {
    this.age = value;
  }

  printName() {
    console.log(this.name);
  }

  printAge() {
    console.log(this.age);
  }
}

Cool Bits logo

Ben's Bits

Well, it sure has Ben a while. This list Byte-er be good!

  1. Mayank wrote about what the shadow realm DOM really does. I guess web components aren’t bad, just misunderstood?

  2. KRAZAM shared some positive affirmations for site reliability engineers. Going to thank my therapist for rejecting that DevOps offer next time.

  3. Tomek Sułkowski wrote about how StackBlitz updated all of their starters to run on WebContainers. This lets you instantly spin up a working, shareable prototype project in React, Vite, Svelte, Qwik, and 60+ other technologies — no local config required. [sponsored]

  4. Van Neistat shares 7 principles to stop being late. No, “T-Shirt sizing sessions” didn’t make the list.

  5. “I wonder if many web apps these days will become piles of primordial ooze over time.” Is that a terrible Slimer quote from the new Ghostbusters, or a hot take on the web dev industry? Click to find out.

  6. Alex Riviere drops his new hit single, The DevRel went down to Georgia. Makes me want to revive my old cover band, Florida Georgia Linebreak.

  7. Here’s what 9 years of building an iOS markdown editor looks like. No jokes, it’s the best deep dive on maintaining a project I’ve read.

  8. Callstack is hosting a free webinar on Improving performance of a React Native App on March 20th. They’ll be walking through a case study on Expensify’s RN app, and show how they were able to identify and fix performance issues. [sponsored]

  9. Storybook 8 just came out with built-in visual testing, RSC support, 2-4x faster builds, and more.

  10. Elm creator, Evan Czaplicki spoke about the economics of open source programming languages. Wait, so you don’t need to build a database platform to make money? 😬


Spot the Bug logo

Spot the Bug: Solution

Sponsored by FusionAuth

When the class assigns the name and age properties, it calls the setters, which in turn call themselves. This creates an infinite loop and will throw a “Maximum call stack size exceeded” error. To fix this, you should use different names for the properties and the setters.

class Person {
  constructor(name, age) {
    this._name = name;
    this._age = age;
  }

  set name (value) {
    this._name = value;
  }

  set age (value) {
    this._age = value;
  }

  get name() {
    return this._name;
  }

  get age() {
    return this._age;
  }

  printName() {
    console.log(this._name);
  }

  printAge() {
    console.log(this._age);
  }
}