webstack

A project to prototype web stacks source code

        
.--------------------------------------------------------------.
|                          API checks                          |
|--------------------------------------------------------------|
|              stack                |  ok %  | avg ms | p95 ms |
|-----------------------------------|--------|--------|--------|
| fly-go-tailscale-crunchy-replicas | 100.00 |    144 |    310 |
| fly-go-neon                       | 100.00 |    187 |    341 |
| heroku-go-crunchy                 |  99.99 |    198 |    354 |
| heroku-go-postgres                |  99.99 |    218 |    336 |
| railway-go-neon                   | 100.00 |    255 |    465 |
| railway-go-postgres               | 100.00 |    258 |    481 |
| railway-go-crunchy                | 100.00 |    264 |    448 |
| render-go-neon                    | 100.00 |    265 |    485 |
| render-go-postgres                |  99.99 |    273 |    545 |
'--------------------------------------------------------------'
      
API checks via Checkly from N. California, N. Virginia, and London.

Stacks have been deployed to:

Databases used have been:

Each stack serves a healthcheck-style HTTP API endpoint that executes a SELECT 1 to a SQL database and responds with JSON {"status":"ok"}. Each stack uses a lightweight router, a SQL database driver (no ORM), and a database connection (often pooled). Most stacks are written in Go. Example:

      
package main

import (
	"context"
	"fmt"
	"log"
	"net/http"
	"os"

	"github.com/jackc/pgx/v4/pgxpool"
)

func main() {
	// env
	port, ok := os.LookupEnv("PORT")
	if !ok {
		port = "8080"
	}
	dbUrl, ok := os.LookupEnv("DATABASE_URL")
	if !ok {
		dbUrl = "postgres:///webstack_dev"
	}

	// db
	db, err := pgxpool.Connect(context.Background(), dbUrl)
	if err != nil {
		log.Fatal(err)
	}
	defer db.Close()

	// routes
	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		var col int
		db.QueryRow(r.Context(), "SELECT 1").Scan(&col)
		w.Header().Set("Content-Type", "application/json")
		fmt.Fprintf(w, "{\"status\":\"ok\"}")
	})

	// listen
	log.Println("Listening at http://localhost:" + port)
	log.Fatal(http.ListenAndServe(":"+port, nil))
}
    

Connecting to databases vary a little:

heroku

From 2009-2022, my stack most often included Heroku + Postgres:

Cons:

fly

Pros:

Pros and cons?

Cons:

northflank

Pros:

Cons:

railway

Pros:

Cons:

render

Pros:

Cons:

vercel

Pros:

Cons: