#Working on something cool, wanting feedback on my design?

149 messages · Page 1 of 1 (latest)

fallen vale
#

Hey guys, I'm working on something and I was wondering what you all thought of this general design? Its for a sort of IaC thing

import { api, database, bucket, queue, job } from "@launchd/edge";

const db = database("main");
const uploads = bucket("uploads");
const emails = queue("emails");

export const createPost = api("/posts", { method: "POST" }, async (req) => {
  const post = await db.post.create({
    title: req.body.title,
    body: req.body.body,
  });

  await uploads.put(`posts/${post.id}.json`, JSON.stringify(post));
  await emails.send({ type: "post.created", postId: post.id });

  return post;
});

export const emailSender = watcher(emails, (event) => {
  if(event.type == "post.created"){
    console.log(event.postId)
  }
})

export const cleanup = job("cleanup", { every: "1h" }, async () => {
  await db.post.deleteMany({ where: { archived: true } });
});
naive archBOT
#

-# TypeScript @elder parcel @green dagger @restive bramble @regal lion

regal lion
#

leaky abstractions through and through

#

what part do you want feedback on

hollow orchid
#

bad

fallen vale
#

Trying to optimize for DX and then build the rest of the software around that

fallen vale
# hollow orchid bad

I appreicate the feedback, anything particularly you dont like that I should look into fixing?

regal lion
#

in the end there are a bunch of leaky abstractions in there

#

e.g. what does const db = database("main"); actually do

#

does it spin up a new database? Does it connect to an existing database?

fallen vale
#

it provisions a database, correct

#

So you would prefer something like createDatabase?

regal lion
#

No I generally find all of those very abstracted things to be lacking

#

since you're doing TS type safety should be your main focus

#

dealing with migrations and DB state is probably gonna be relatively hairy

#

error handling would be another thing I'd ask about

fallen vale
#

Correct, you can pass optional parameters to the create function like so

const db = database("main", {
  migrations: "./migrations"
})

But its really for getting the ConnString. You handle migrations in something like Prisma or Drizzle not within our framework

regal lion
#
const post = await db.post.create({
    title: req.body.title,
    body: req.body.body,
  });
fallen vale
regal lion
#

this is all in your framework though, no mention of a different thing

hollow orchid
#

no that's fine tbh. but like. you create a post with title and body but you also for some reason upload the post to disk which doesn't make much sense unless it's very large, then you say this is for iac but there's no sign of that, you have some tacked on event driven interface for logging which idk, you have your scheduled tasks in your backend server, there is no authentication, there is no access control, you are asking about general design and it is bad.

fallen vale
hollow orchid
#

error first btw

#

not "ah there will be a trace later"

regal lion
#

Idk who the target audience is for this

#

but in general I haven't seen many companies get abstractions this big correctly

hollow orchid
#

an "internal orm"? you built a post endpoint for an object, this is not worth my time.

fallen vale
fallen vale
#

Im trying to build a way to not have to dig through 20 pages of the AWS console and deploy 900 different objects to run my website.

hollow orchid
#

okay, so you're not asking us to look at the shit code you just sent, you're asking us to theorycraft the code underneath it, stop wasting my time.

fallen vale
#

I understand, thank you for your time. I apologize that you feel as though I have wasted it.

regal lion
#

if you were vercel and wanted to start offering hosted databases it might make a little more sense

#

(might just be me being bad at startups tho, what do I know)

fallen vale
#

Its not another AWS framework, or another provider backed by AWS. Our plan is to take my years of infrastructure experience and build actual racks in datacenters

#

And become competetive in more ways than just features. Im tired of every big infra company thats worth anything being price-locked by AWS and GCP because they cant figure out the infra side.

regal lion
#

is that a real problem tho? might be very European-coded of me to say but people here just use Hetzner or rent rack space when the AWS bill is too high

#

and from those savings you can usually pay for a couple of engineers to take care of those boxes

fallen vale
#

I guess I just feel an engineer shouldnt need to be a devops/linux expert to make something thats cool. Renting Hetzner boxes is a fine solution until overnight your app blows up and you just dont have the capacity to scale.

regal lion
#

Do you have more capacity to scale than Hetzner tho?

regal lion
#

then there's fly.io or railway if you just want the machines (idk haven't used them personally)

#

in the end you will have leaky abstractions so you'll have to decide for who they leak

if the vercel crowd is your target audience then you can probably make certain tradeoffs that you couldn't make for others (especially on how much configuration the users actually need to do)

flint flame
flint flame
fallen vale
fallen vale
fallen vale
regal lion
fallen vale
fallen vale
#

I personally liked this more, but I guess I wasnt thinking as much about scalability in a large codebase and more about simplicity to get up and running

flint flame
#

if you want to abstract it away you can still manage the image build

regal lion
fallen vale
regal lion
fallen vale
#

None

regal lion
#

interesting

fallen vale
#

I dont vibecode, I dispise people that do that.

flint flame
fallen vale
#

Claude can do some things well, large codebases are not one of those things.

regal lion
#

was just curious because making a serverless runtime sounds like a decent amount of work lol

flint flame
#

and I’d argue the scalability statement

fallen vale
fallen vale
#

The serverless runtime was the hard part, now the SDK is where it gets simple lol

#

I need sleep lol

fallen vale
flint flame
#

you can scale your underlying workers and orchestrate customer runtimes over those separately with this solution

fallen vale
# flint flame Your PXE boot is going to cause bigger cold start than having a very slim image ...

Thats not the solution, the PXE boot system launches nodes (those nodes run our agent) the agent handles running the functions. And extra capacity is only provisioned once required (not as requests come in, it would be scaled by us if a customer had a large increase in load, specifically more than our existing cluster could handle)

We currently have a cabinet in a DC with 24x R630s as the main compute stack.

#

So the idea is that if we had an overload condition, we could scale up in a few minutes compared to a few hours

#

Its not designed to spin up a physical machine every single time the request is run lol

#

that would be wildly slow

flint flame
#

you misinterpreted what I said

fallen vale
#

Oh, apologies

#

Sometimes I do that, its not intentional

flint flame
#

no it’s all good mang we just yapping

regal lion
#

tbh I think there are different problems you're trying to solve here

One is the customer applications on JS or whatever (aka the stuff running on your WASM serverless runtime)

and then there's the big infra side of things like your provisioned databases, storage, etc.

Those seem like they need very different tools?

fallen vale
#

I really appreicate you guys' time and insights by the way

regal lion
#

we love yapping about infra and startups 🗣️ 🔥

fallen vale
flint flame
#

I work at a company that is a cloud provider so I love da infra yap

#

it’s been mentioned in this thread :3

regal lion
# fallen vale Hmm, what would you propose as a solution?

I don't think there's a clean solution for both lol they have to run on separate stacks

e.g. competing with Neon, Planetscale, Turso, etc. etc., AWS Aurora, etc. on the one hand

And then competing with Vercel, AWS Lambda / Fargate for the customer apps

fallen vale
#

I want it built in a way that a developer can write some code, make a config file, launchd dev spins up the stack and tests locally, launchd deploy pushes to the cloud and its live

#

No questions, no complications, all automated

#

Just works™

regal lion
#

I guess I kinda misunderstood what the const db = database("main"); actually does then

fallen vale
#

I guess im trying to find out what developers would want a solution like that to look like

flint flame
#

if no containerization full stop deal breaker for me

fallen vale
#

Maybe? its supposed to define a database that our platform would provision

fallen vale
#

Current feature scope:

flint flame
#

if I get vendor locked in on some weird runtime deal breaker

regal lion
fallen vale
#
  1. Databases
  2. S3 Storage
  3. Serverless Functions
  4. Static site hosting
  5. Background CRON jobs
  6. Pub/Sub QUeues
  7. Serverless AI Inference
  8. Containers
regal lion
#

No offense but to me it seems like you're trying to compete with everyone

I know like 5 startups for each of those areas (except S3 maybe), probably makes more sense to focus on one thing first?

#

(also serverless AI inference I would not touch with a 10ft pole, that shit is HELLA complicated if you want to do it profitably)

fallen vale
regal lion
#

So just doing what the other inference providers do and charging by the token?

fallen vale
regal lion
#

That can be very profitable but it's also a business of very tight margins tbh

fallen vale
regal lion
fallen vale
#

At least from what I can tell

#

unless im incorrect?

regal lion
#

No lol even on the business plan you get zero data retention etc. if you want that

#

Should be default on the enterprise plans or maybe you have to click a button somewhere to enable it

fallen vale
#

Interesting, well then that kinda kills that idea then. Glad im figuring this out now!

regal lion
#

basically every inference provider out there has those guarantees for anyone pushing remotely serious volume through the platform (like >$100 a month or whatever)

#

(I'd assume AWS Bedrock, Azure, etc. have similar things too for data protection on ML stuff)

fallen vale
#

Okay cool, thats good to know

#

What core features would you want to see from a provider like this

regal lion
fallen vale
#

Something like

  1. Databases
  2. S3
  3. Containers
  4. Queues
regal lion
#

in my last startup we had a few guys write a custom networking stack to cut down latency etc.

fallen vale
regal lion
#

S3 I'd probably just cut out and just resell Backblaze or S3 or whatever

#

it's already been commoditized, I personally don't see the point in trying to bring up infra there (especially because it only gets worth it once you hit huge scales on the clusters)

fallen vale
#

Really? I find the marigns on S3 to be very good especially using OSS tools as part of the stack

#

We are basically just running Garage on three R730s with Ceph on them

regal lion
#

from the napkin math I did at the last ceph meetup I attended (granted that was a few months ago) you need high utilization for it to make sense

#

S3 customers would also expect the objects to live in separate availability zones etc. (with all of the funny guarantees)

#

also idk about garage + ceph, aren't those competing kind of?

fallen vale
#

garage has a clustering mechanism but it isnt very good from my experience

#

Okay so I think a better idea is this guys:

Everything is based on containers not serverless, and then it doesnt vendor-lock you in. Env vars are used for putting in things from DBs, Queues, etc. and you can use standard tools and whatever language you want.

#

Does this seem, better? @regal lion and @flint flame ?

regal lion
#

tricky to make $$$ without lockin but what do I know 😂

fallen vale
#

less friction

#

Launchd deploy does the work for you

#

yeah you can take it elsewhere, but then you have to be a sysadmin

#

if you want to be a sysadmin then youre gonna do that anyways

#

this is more targeted towards people who dont care about that

regal lion
#

fair enough

fallen vale
#

See im glad im asking for feedback before launching

#

this is very good

flint flame
#

just as a sidenote

fallen vale
#

and just tell us the port and we will proxy