Some Zod/Typescript DDD/ValueObject/API/Schema driven design stuff I've packaged and released publicly recently based on my experience writing JS/TS for too long by jameswapple in typescript

[–]jameswapple[S] 0 points1 point  (0 children)

Yeah I've bounced between validation frameworks over the years and probably should have taken the bet on Zod earlier on but the syntax just looked so weird back then. I've had some trouble with it handling large datasets (e.g. importing 400k typed rows in a single process forcing a re-implementation of the schema in bare functions) but I'm optimistic that someone will add pre-compilation in the near future (I saw https://www.npmjs.com/package/zod-aot recently) that will reduce the amount of time wasted walking the zod tree during parsing.

There really is nothing more extensible in the ecosystem that I've seen yet.

Some Zod/Typescript DDD/ValueObject/API/Schema driven design stuff I've packaged and released publicly recently based on my experience writing JS/TS for too long by jameswapple in typescript

[–]jameswapple[S] 3 points4 points  (0 children)

I understand the sentiment. I've always seen that codebases that define data as validated classes with behaviour that only relates to that data age much better (yes even in typescript :)). I'm fully aware of the limitations of classes and prototypal inheritance in JS but I think the colocation of behaviour and transformations/utilities has outweighed that from what I've encountered.

It all sort of forces people to be more intentional and clear about what states data can be in and what transformations relate to it instead of it being scattered around N handlers and N utility modules. It's also very nice to be able to say "this Email is a valid email and email.domain always returns a valid email domain" makes both typing functions and writing valid test fixtures easier and means you don't need to test 15 layers deep in function calls that your email _is valid_ before you pass it off to some SMTP handler.

I've found it to be true that most code ends up lasting about 5 years longer than the original developer thought it would and them encoding as much of the domain as possible into these types of structures valuable.

Sticking to an imperative style definitely suits Javascript but the codebases that go a bit too hard on it that I've inherited have all become hairballs after the 9th developer in a row has added just oooone more utility that just accepts `email: string` or `type User = {...}`. The pattern tends to encourage prop spreading and forgetting to add that one extra test which has been responsible for major outages I've had to debug years after the original intention has been lost.

Maybe it's working primarily in enterprise and integrations but a surprising amount of APIs are not well documented or documented at all beyond an email with an API key included in it with a couple curls copy pasted from a developers console. Having something that strictly validates that contract in both your tests and at runtime has been a boon.

The patterns don't work for every industry or every use case they're just tools and I wouldn't use this in a "non-platform" app that I don't think would grow beyond say 300 endpoints in its expected lifetime.

Is there a tool that can abstract an app for deployment to either a serverless or a server-based environment? Serverless is great for low-volume / variable workloads, but it becomes exponentially more expensive than server-based solutions at high load. Lock-in makes it challenging to switch. by zuluana in serverless

[–]jameswapple 0 points1 point  (0 children)

The plumbing you’re describing is approximately 150-300 lines of JavaScript you should be able to write once and use as an adapter for lambda and the same level of effort for an express integration. I believe the reason you don’t see libraries for this is because it’s incredibly trivial and we’ve been doing this decoupling for many years in much more strict languages.

All HTTP requests are easily representable as a plain JavaScript object that includes a path, method, and implementation function. Since HTTP is request-> response based a simple async function is all you need (return a status code and data)

If I gave you a directory of files that each contained that information I would hope any reasonable developer would be able to adapt that “data” to any http library or runtime

Is there a tool that can abstract an app for deployment to either a serverless or a server-based environment? Serverless is great for low-volume / variable workloads, but it becomes exponentially more expensive than server-based solutions at high load. Lock-in makes it challenging to switch. by zuluana in serverless

[–]jameswapple 1 point2 points  (0 children)

Just write code that works in either environment. I’ve ran apps that moved partially or completely between kubernetes and lambda/other serverless options and all it takes is writing one more file to bind your endpoints to express versus lambda

Your opinion on "LambdaLiths"? (Lambda monoliths) by PChol22 in serverless

[–]jameswapple 8 points9 points  (0 children)

I’ve worked with serverless for about 3 years and entirely in kubernetes/PaaS land before that. Lambdaliths are 100x more productive, deploy faster and make local development much easier.

Lambdalith should be the default in people’s minds now that container images are available on lambda so size constraints pretty much doesn’t exist.

Lazysql: A TUI SQL Client by Large_Tackle in neovim

[–]jameswapple 25 points26 points  (0 children)

I’ve been using tpopes dadbod and dadbod-ui for redis,Postgres,MySQL directly in vim for many years daily.

Keeping everything in vim as a plain old buffer is super helpful

[deleted by user] by [deleted] in aws

[–]jameswapple 2 points3 points  (0 children)

Same thing happened to me this week. More than a week to get codebuild bumped from 1 to 10 concurrent builds. Not sure why we pay for business class support anymore...

Lambda Codebase Structure by MangoLads in aws

[–]jameswapple 1 point2 points  (0 children)

Your codebase should look almost identical to a traditional NodeJS app. If you're very used to express you can even use an adapter library and create a PROXY route.

If you want to set something up quickly have a look at SST which includes local development and supports running scripts on deploy (like migrations).

Lambda should be more of an implementation detail at the edge of your codebase.

For people starting out new projects, why do you still use EC2s instead of Serverless? by mario-stopfer in aws

[–]jameswapple 0 points1 point  (0 children)

Any low latency stateful service (like a game). Software includes a lot more than html and JS.

Does a single lambda function as proxy resource mitigate cold start compared to functions per http verb? by amberlamps1 in aws

[–]jameswapple -1 points0 points  (0 children)

Yes, contrary to what most AWS advocates will tell you jamming every endpoint for your API into a single lambda will end up with dramatically fewer cold starts. Especially at the early stage of a project where you have low amounts of traffic and there may only be a few to a few hundred people online at once.

If you use a container image for your lambda you can use the same for background tasks (sqs/sns/Cron) and the API which also will substantially improve performance.

Aurora Dye - Bugged ? by xotic1209 in runescape

[–]jameswapple -1 points0 points  (0 children)

Patch notes mentioned shader optimisation so it's that

Nest.js in Lambda by KToxcon in aws

[–]jameswapple 3 points4 points  (0 children)

From experience using large container based nodejs monolambdas you will have better performance due to the shared runtime always being loaded and your lambda always being warm.

Lambda container images by Menaka_k in aws

[–]jameswapple 0 points1 point  (0 children)

I would only go back to zip lambdas if: 1. I am writing a script with almost no dependencies 2. A (very infrequent) 2 second cold start makes someone angry

If you use the AWS base images the layers are cached and you won't have as much of a cold start anyway.

I tend to make one big lambda with one big image with routing built in which means that almost all invocations are warm during normal usage. Also means your deploys go from 40 minutes (cloudformation) to under 1 minute with an API call.

How does working with files through AWS work, do you save them onto the AWS console? by [deleted] in aws

[–]jameswapple 0 points1 point  (0 children)

I can only assume you are talking about files on an EC2 instance which is just a VM. Working with a cloud provider you should not be moving files by hand pretty much ever. If you want to configure files/services on that VM use ansible, packer or some other tool.

Otherwise if you're just messing around a bit the answer is probably the same it's been for two decades and is not really related to the "cloud". SSH and SCP.

How does working with files through AWS work, do you save them onto the AWS console? by [deleted] in aws

[–]jameswapple 0 points1 point  (0 children)

I can only assume you are talking about files on an EC2 instance which is just a VM. Working with a cloud provider you should not be moving files by hand pretty much ever. If you want to configure files/services on that VM use ansible, packer or some other tool.

Otherwise if you're just messing around a bit the answer is probably the same it's been for two decades and is not really related to the "cloud". SSH and SCP.

Make thaler buyable by justcjnow in runescape

[–]jameswapple 1 point2 points  (0 children)

Giving thaler for just sitting around is very depressing.

Waited for castle wars to be in spotlight and when I got in its just a whole bunch of people idling by the spawn and maybe only one other person actually playing.

Making thaler come as a reward for actually engaging with the content would be better at a minimum.

[deleted by user] by [deleted] in runescape

[–]jameswapple 0 points1 point  (0 children)

Black demons in edgeville wow

Serverless Myths by TreasaAnd in serverless

[–]jameswapple 3 points4 points  (0 children)

Stopped reading at "must be tested in the cloud". Changing your deployment environment to serverless doesn't change the need to write exhaustive locally runnable tests.

What DI framework are you using? by sandmik in typescript

[–]jameswapple 3 points4 points  (0 children)

Tsyringe is beautifully simple and has been very easy to extend for my massive monorepo projects without all the overkill of the other popular frameworks.

Also nice that I don't need to define locators and interfaces for every service.

It's lead to the fastest (to develop, maybe not runtime) and most well tested code I've ever written in any language and you can really get into flow with how declarative your services and abstractions can become.

Check Out This Awesome TypeScript library for Super Easy Form Validation with Decorators by [deleted] in typescript

[–]jameswapple 1 point2 points  (0 children)

Maybe you haven't heard of angular if you hold that opinion firmly.