DEV Community

xnoɹǝʃ uɐıɹq
xnoɹǝʃ uɐıɹq

Posted on

7 3

Strangler except serverless with OpenJS Architect

The strangler pattern is a technique for refactoring an application with new functionality by wrapping the old logic in new logic. In the modern era of web apps this technique has been adapted to intercept HTTP traffic in new application code, use feature flags to turn on and off new functionality and otherwise proxy everything back to the original domain. A few years back Ceej pulled off an impressive migration from monolith to microservices using this technique at npm Inc.

Strangler but serverlessly

By using AWS API Gateway we can do the same thing and even better setting this up takes roughly 30 seconds total. This enables your dev team to pick off routes one by one and make them stateless functions. Or maybe we want to host a static app elsewhere and build the dynamic backend with Lambda.

Whatever the use case OpenJS Architect makes configuring this setup completely painless. Create an app.arc file with the following configuration:

@app
myapp

@proxy
testing https://testing.brian.io
staging https://staging.brian.io
production https://brian.io

@http
post /graphql
Enter fullscreen mode Exit fullscreen mode

And run arc init to generate the app. You can deploy it to your own AWS account with arc deploy or setup Begin for CI/CD. This app will proxy all traffic to my brian.io domain except post /graphql for my backend code. Eventually I will probably want to move the static assets onto S3 and manage my own CloudFront too …but this can now happen at any time!

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay