Logo
    Search

    Pros + Cons of JavaScript Servers, Serverless, and Cloudflare Workers

    enFebruary 07, 2022

    Podcast Summary

    • Discussing JavaScript servers, serverless, and Cloudflare Workers, comparing their pros and consHashnode is a blogging platform with content ownership, markdown support, analytics, newsletter functionality, HTTPS, and edge caching, while Linode is a versatile cloud computing provider for hosting JavaScript, Node, or any Linux-based server.

      During this episode of Syntax, Wes, Barracuda, Boss, and Scott El Toro Loco discussed JavaScript servers, serverless, and Cloudflare Workers, comparing their pros and cons for hosting and running server-side JavaScript. They also introduced two sponsors: Hashnode and Linode. Hashnode is a blogging platform that emphasizes content ownership. Users write their posts in markdown, own all data, and can easily export and backup content to GitHub. Hashnode offers built-in analytics, newsletter functionality, HTTPS, and edge caching with SSL. It's an excellent choice for starting a blog. Linode is a cloud computing provider where you can host your JavaScript, Node, or any Linux-based server. They offer a $100 free credit for new users. Linode is a versatile platform, allowing you to run various applications, including Node.js, Ruby, Go, and more. The episode began with a potluck question about the MERN stack, which stands for MongoDB, Express.js, React, and Node.js. The hosts discussed their experiences with the MERN stack and its benefits, such as its flexibility, scalability, and ease of use. The MERN stack is a popular choice for building dynamic web applications.

    • Choosing Between Next.js API and Separate BackendConsider flexibility, control, and complexity when deciding between using Next.js API or creating a separate backend. Traditional Node.js servers offer more control but require setup, while serverless functions like AWS Lambda or Cloudflare Workers offer automatic scaling and reduced operational overhead but may not support complex logic.

      When building an API for a Next.js project, there are trade-offs to consider when deciding whether to build it in the Next.js API folder or create a separate backend outside of Next.js. Both traditional Node.js servers and serverless functions like AWS Lambda or Cloudflare Workers have their pros and cons. Traditional Node.js servers, such as Fastify or Express, offer flexibility and control, allowing for complex back-end logic and long-running processes. However, they require additional setup, including hosting and managing the server. Serverless functions, on the other hand, offer the benefits of automatic scaling, reduced operational overhead, and lower costs. They are ideal for simple, stateless APIs that can be triggered by events. However, they may not be suitable for complex back-end logic or long-running processes. Cloudflare Workers represent another serverless option, offering similar benefits to other serverless functions but with the added advantage of running at the edge, closer to the user. They are ideal for lightweight, stateless APIs that can benefit from low latency and improved performance. Ultimately, the choice between using the Next.js API folder or creating a separate backend depends on the specific requirements of the project. Most back-end logic will port easily between frameworks, but there may be specific features or limitations to consider. It's important to weigh the trade-offs and choose the option that best fits the needs of the project.

    • Understanding the differences between traditionally hosted servers and serverless functionsTraditionally hosted servers offer full control and disk access but require management, while serverless functions provide ease of deployment and automatic scaling but lack persistent storage

      The core functionality of writing code for applications, such as database queries, data processing, and rendering templates, remains consistent in both traditionally hosted servers and serverless functions. However, the process of getting requests and sending results can differ between platforms. AWS is the leading provider in the serverless space, with offerings like Netlify functions built on top of it. While traditionally hosted servers offer full control and disk access, serverless environments are transient and do not allow for long-term storage of data or logs. The hardest part of using serverless technology is navigating the unique quirks and features of each platform. The pros and cons of traditionally hosted Linux servers include easy use, full control, and disk access, but also the responsibility of installing and managing software. Serverless functions offer ease of deployment and automatic scaling, but lack the ability to store data or logs persistently. Ultimately, the choice between the two comes down to the specific needs and resources of the project.

    • Comparing VPS and External Caching for Hosting Web ApplicationsVPS offers more control but requires management, while external caching with Redis and serverless functions have their own advantages and challenges. Choose based on app needs for scalability, control, and cost.

      When it comes to hosting web applications, there are various options each with their pros and cons. One common hosting solution is using a Virtual Private Server (VPS), which provides more control over the server but requires more management and scaling complexities. A popular alternative to VPS is using an external caching service like Redis for transient data, and serverless functions for pay-per-use, event-driven computing. Caching in memory is convenient but has its limitations, as data is only available as long as the server is running. Redis, on the other hand, allows for external storage and can handle larger datasets. However, scaling Redis and managing sessions across multiple instances can be challenging. Serverless functions offer the benefit of only paying for the resources used and the ability to handle individual tasks. The downside is the added complexity of setting up SSL certificates, managing dependencies, and dealing with cold starts. Ultimately, the choice of hosting solution depends on the specific requirements of the web application, including scalability, control, and cost. Understanding the strengths and weaknesses of each option can help developers make informed decisions and build robust and efficient web applications.

    • Considerations for using serverless functionsServerless functions offer cost-effective hosting for APIs and background tasks, but require new database connections per request, may not support long-running processes, and some tools may not work.

      Serverless functions offer a cost-effective solution for hosting APIs or running background tasks, as you only pay for the actual time they are in use. However, there are some considerations to keep in mind. For instance, you may need to rethink how you establish connections to databases, as each request requires a new connection. This can add some complexity and potentially increase latency. Additionally, long-running processes are not well-suited for serverless functions, as they start up and shut down based on incoming requests. Some packages or tools may also not work in a serverless environment due to low-level binding requirements. Overall, while serverless functions can be a great choice for certain use cases, it's important to carefully consider the trade-offs and potential challenges before making the switch.

    • Consider package size and compatibility in serverless developmentBreak up functions, use tree shaking, and choose compatible packages for serverless environments. Utilize Cloudflare Workers for edge computing, but be aware of its differences from Node.js and lack of access to certain APIs.

      When developing applications for serverless environments, it's crucial to consider the size and compatibility of packages used. Some packages may not work perfectly due to the lean environment and lack of access to a full Linux server. Additionally, larger packages may not be able to fit within the constraints of a serverless function. To mitigate this, it's recommended to break up functions and routes into their own serverless functions, and some platforms perform tree shaking to exclude unnecessary dependencies. Another platform mentioned was Cloudflare Workers. It's a serverless function that runs closer to the edge, meaning it runs on the server closest to the user. However, it runs on Cloudflare's own version of JavaScript, which is not the same as Node.js. While it shares similarities with Web Workers, it lacks access to both the browser DOM and Node.js APIs, only providing JavaScript and additional Web Worker APIs. Despite its pros, such as running closer to the edge, it comes with cons, including the inability to use Node.js APIs directly.

    • Challenges of using Cloudflare Workers and similar toolsDespite reliability and compatibility issues, developers find benefits like price and performance outweigh challenges when using Cloudflare Workers and similar tools. Easier integration with frameworks like Next.js or SvelteKit can help mitigate challenges.

      While Cloudflare Workers and other performance APIs can be effective, they come with their own set of challenges. The reliability of these tools can be unpredictable, and compatibility with certain packages and APIs can be an issue. Cloudflare's "Works With Workers" website, which lists packages known to work with their platform, leaves many unlisted, making it difficult to determine compatibility. Additionally, setting up and testing these tools locally can be frustrating due to differences between development and production environments. However, despite these challenges, many developers find the benefits, such as price and performance, to outweigh the initial bumps and scrapes. For those considering using Cloudflare Workers or similar tools, it may be worth exploring frameworks like Next.js or SvelteKit that offer easier integration. Ultimately, the decision to use these tools or run code locally depends on the specific use case and the developer's comfort level with the associated challenges.

    • Separate logic into a library for better code organizationImprove code testability, reusability, and adaptability by separating app logic into a library, while keeping API handling in the API folder.

      When building applications, it's beneficial to separate the majority of your application's logic into a library and keep only the necessary parts related to handling requests and responses within the API folder. This approach makes the code more testable, reusable, and adaptable to different frameworks or hosting platforms. Additionally, starting with a serverless architecture can make deployment easier and more cost-effective, especially for smaller projects. However, traditional server setups like Linux servers can also be a viable option with minimal issues. Ultimately, the choice depends on the specific needs and goals of the project.

    • Managing a DevOps team: It's about more than just tools and processesBalancing speed, efficiency, reliability, and security while fostering collaboration and continuous improvement in a DevOps team

      Managing a DevOps team involves making trade-offs. It's not just about automating processes or writing code, but also about managing people and communication. This means that you'll need to balance the need for speed and efficiency with the need for reliability and security. It's a complex task that requires a deep understanding of both technology and people. The discussion also emphasized that there's no one-size-fits-all answer to what you should do when managing a DevOps team. It depends on the specific context and circumstances of your organization. So, it's important to be flexible and adaptable, and to be willing to experiment and learn from your mistakes. Ultimately, the goal is to create a culture of collaboration and continuous improvement, where everyone is working together to deliver high-quality software as quickly and efficiently as possible. This requires strong communication, a willingness to listen and learn from each other, and a commitment to transparency and accountability. So, if you're managing a DevOps team, remember that it's not just about managing tools and processes. It's about managing people and communication. And, as always, it's about making trade-offs. If you enjoyed this discussion, be sure to check out Syntax.fm for more great content on all things web development. And don't forget to subscribe in your podcast player or leave a review if you like what you hear. Peace out!

    Recent Episodes from Syntax - Tasty Web Development Treats

    788: Supabase: Open Source Firebase for Fullstack JS Apps

    788: Supabase: Open Source Firebase for Fullstack JS Apps

    Scott and CJ chat with Paul Copplestone, CEO and co-founder of Supabase, about the journey of building an open source alternative to Firebase. Learn about the tech stack, the story behind their excellent documentation, and how Supabase balances business goals with open-source values.

    Show Notes

    • 00:00 Welcome to Syntax!
    • 00:30 Who is Paul Copplestone?
    • 01:17 Why ‘Supa’ and not ‘Super’?
    • 02:26 How did Supabase start?
    • 08:42 Simplicity in design.
    • 10:32 How do you take Supabase one step beyond the competition?
    • 12:35 How do you decide which libraries are officially supported vs community maintained?
      • 15:17 You don’t need a client library!
    • 16:48 Edge functions for server-side functionality.
    • 18:51 The genesis of pgvector.
    • 20:59 The product strategy.
    • 22:25 What’s the story behind Supabase’s awesome docs?
    • 25:26 The tech behind Supabase.
    • 35:46 How do you balance business goals with open source?
    • 42:01 What’s next for Supabase?
    • 44:15 Supabase’s GA + new features.
    • 48:24 Who runs the X account?
    • 50:39 Sick Picks + Shameless Plugs.

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    CJ: X Instagram YouTube TwitchTV

    Randy: X Instagram YouTube Threads

    787: You Should Try Vue.js

    787: You Should Try Vue.js

    Scott and CJ dive deep into the world of Vue.js, exploring what makes this frontend framework unique and why it stands out from React and Svelte. CJ gives a comprehensive tour, covering everything from getting started to advanced features like state management and Vue’s built-in styles.

    Show Notes

    Vue.js: The Documentary.

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    786: What Open Source license should you use?

    786: What Open Source license should you use?

    Scott and CJ dive into the world of open source, breaking down its meaning, benefits, and the various types of licenses you’ll encounter. From permissive licenses like MIT and Apache 2.0 to copy-left licenses such as GNU GPLv3, they’ll help you choose and apply the right license for your project.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    785: What’s Next for NextJS with Tim Neutkens

    785: What’s Next for NextJS with Tim Neutkens

    Scott and Wes dive into the world of Next.js with special guest Tim Neutkens from Vercel. They explore the latest updates, including the React Compiler and React Server Components, discussing their impact on developer workflows and the future of Next.js development.

    Show Notes

    • 00:00 Welcome to Syntax!
    • 00:30 What does the React Compiler do?
    • 05:04 Will React Compiler help with managing Context?
    • 06:39 What happens if you’re not using a React Compiler?
    • 09:30 Will this work on any NextJS version?
    • 12:18 What are React Server Components?
    • 16:28 Shipping all the data inside an encapsulated component.
    • 20:17 Clearing up the frustrations around retrofitting server components.
    • 23:13 Handing migration.
    • 28:30 Is this just a fetch request with props?
    • 36:41 How closely are the NextJS and React teams working?
    • 41:53 Will we ever get Async Client Components?
    • 43:52 Async Local Storage API.
    • 45:31 Turbopack.
    • 57:51 Sick Picks & Shameless Plugs.

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    784: Logging × Blogging × Testing × Freelancing

    784: Logging × Blogging × Testing × Freelancing

    In this Potluck episode, Scott and Wes tackle listener questions on modern blogging, website environmental impact, and using LangChain with LLMs. They also cover CSS hyphens, unit vs. integration testing, and balancing web development with new parenthood.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott: X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    783: How We Built a Netflix Style “Save for Offline” Feature Into Syntax

    783: How We Built a Netflix Style “Save for Offline” Feature Into Syntax

    Scott and Wes dive into the world of browser caching for audio files, exploring the File System API and the Cache API. They discuss size restrictions across different browsers, how tools like Riverside.fm leverage IndexedDB, and walk through code examples for creating, retrieving, and managing cached audio data.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    782: The Developer’s Guide To Fonts with Stephen Nixon

    782: The Developer’s Guide To Fonts with Stephen Nixon

    Scott and CJ are joined by Stephen Nixon of ArrowType to delve into the world of fonts and type for developers. They explore the intricacies of font creation, the utility of variable fonts, and offer tips for making visually appealing typography on the web.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    781: Potluck - The Value of TypeScript × Vue vs Svelte × Leetcode

    781: Potluck - The Value of TypeScript × Vue vs Svelte × Leetcode

    In this potluck episode of Syntax, Scott and CJ serve up a variety of community questions, from the nuances of beginner vs. advanced TypeScript to the pros and cons of SvelteKit. They also discuss falling out of love with React, shipping private packages via NPM, and the eternal struggle of always starting but never finishing projects.

    Show Notes

    Sick Picks

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    780: Cloud Storage: Bandwidth, Storage and BIG ZIPS

    780: Cloud Storage: Bandwidth, Storage and BIG ZIPS

    Today, Scott and Wes dive into cloud storage solutions—why you might need them, how they use them, and what you need to know about the big players, fees, and more.

    Show Notes

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    779: Why SQLite is Taking Over with Brian Holt & Marco Bambini

    779: Why SQLite is Taking Over with Brian Holt & Marco Bambini

    Scott and CJ dive into the world of SQLite Cloud with special guests Brian Holt and Marco Bambini. They explore why SQLite is gaining traction, its unique features, and the misconceptions surrounding its use—let’s get into it!

    Show Notes

    • 00:00 Welcome to Syntax!
    • 01:20 Who is Brian Holt?
    • 02:26 Who is Marco Bambini?
    • 05:12 Why are people starting to talk so much about SQLite now?
    • 08:47 What makes SQLite special or interesting?
    • 09:46 What is a big misconception about SQLite?
    • 11:13 Installed by default in operating systems.
    • 12:03 A perception that SQLite is intended for single users.
    • 13:36 Convincing developers it’s a full-featured solution.
    • 15:11 What does SQLite do better than Postgres or MySQL?
    • 17:30 SQLite Cloud & local first features.
    • 20:38 Where does SQLite store the offline information?
    • 23:08 Are you typically reaching for ORMs?
    • 25:00 What is SQLite Cloud?
    • 27:29 What makes for an approachable software?
    • 29:18 What make SQLite cloud different from other hosted SQLite options?
    • 32:13 Is SQLite still evolving?
    • 34:40 What about branching?
    • 37:37 What is the GA timeline?
    • 40:04 How does SQLite actually work?
    • 41:19 Questions about security.
    • 44:28 But does it scale?
    • 45:52 Sick Picks + Shameless Plugs.

    Sick Picks

    Brian: Trainer Road
    Marco: Tennis

    Shameless Plugs

    Hit us up on Socials!

    Syntax: X Instagram Tiktok LinkedIn Threads

    Wes: X Instagram Tiktok LinkedIn Threads

    Scott:X Instagram Tiktok LinkedIn Threads

    Randy: X Instagram YouTube Threads

    Related Episodes

    Stacks On Stacks On Stacks

    Stacks On Stacks On Stacks

    Dude, in this gnarly podcast episode, Seth Whiting and Jake Pacheco are all about web development frameworks, bro! They break down the MEAN stack (MongoDB, Express.js, AngularJS, and Node.js) and compare SQL and NoSQL databases. It's all about choices, man!

    Frameworks and libraries, bro, they got you covered! Frameworks like Angular and Vue give you rules and guidelines for writing code, while libraries offer pre-written code blocks for specific tasks. Seth shares his experience with jQuery and Knockout.js, and he's all about that MEAN stack for full-stack projects. Express.js, a back-end framework, makes working with databases a breeze, dude.

    Now, here's the kicker: Next.js, the full-stack framework that combines React on the front end with Node.js on the back end. It's like a one-stop shop, man! Next.js hooks you up with project scaffolding and amps up the user experience. Just make sure you know React and Node.js before you ride the Next.js wave, bro.

    This podcast episode is a tubular journey through web development frameworks, their role in creating killer apps, and how the front end and back end talk to each other. It's a rad ride, bro!

    Special thanks to Diarrhea Planet for our intro and outro music and @SkratchTopo for our artwork.

    018 | How to create Azure Function Apps with Bicep | step by step

    018 | How to create Azure Function Apps with Bicep | step by step

    WATCH

    ▶️ Watch this episode on YouTube

    **********

    EPISODE DESCRIPTION

    Learn how to use Azure Bicep to create resources reliably & orchestrate changes and embrace infrastructure as code (IaC) in your Azure projects.

    Get any links, images, and resources mentioned in this episode in the associated article and YouTube video.

    If you enjoyed this episode, you might like my YouTube Channel, my The Full Stack Dev's Microsoft 365 Playbook newsletter, and my articles on voitanos.io/blog!

    Swiss Cheese - ASW #106

    Swiss Cheese - ASW #106

    This week, we welcome Gareth Rushgrove, Director of Product Management at Snyk, to talk about Modern Application Security and Container Security! In the Application Security News, Psychic Paper demonstrates why a lack of safe and consistent parsing of XML is disturbing, Beware of the GIF: Account Takeover Vulnerability in Microsoft Teams, Salt Bugs Allow Full RCE as Root on Cloud Servers, and Love Bug's creator tracked down to repair shop in Manila!

     

    Show Notes: https://wiki.securityweekly.com/ASWEpisode106

    To learn more about Snyk, visit: https://securityweekly.com/snyk

    Visit https://www.securityweekly.com/asw for all the latest episodes!

     

    Follow us on Twitter: https://www.twitter.com/securityweekly

    Like us on Facebook: https://www.facebook.com/secweekly

    Lose Weight - Application Security Weekly #52

    Lose Weight - Application Security Weekly #52

    This week, many websites threatened by highly critical code-execution bug in Drupal, UK parliament calls for antitrust, data abuse probe of Facebook, CommitStrip: Get rich quick, Google says the built-in microphone it never told Nest users about was 'never supposed to be a secret', and more! In our second segment, we welcome Matt Springfield, is the Founder of 12Feet, Inc., an information security consulting firm based in the Dallas area! Matt has more than 23 years of information security experience spanning operations, architecture and consulting with a focus on large scale retail and service provider environments!

     

    Full Show Notes: https://wiki.securityweekly.com/ASW_Episode52

    Visit https://www.securityweekly.com/asw for all the latest episodes!

     

    Visit our website: https://www.securityweekly.com

    Follow us on Twitter: https://www.twitter.com/securityweekly

    Like us on Facebook: https://www.facebook.com/secweekly

    RAMSAY, STAMINA, & US-Cert Vulnerabilities - Wrap Up - SWN #34

    RAMSAY, STAMINA, & US-Cert Vulnerabilities - Wrap Up - SWN #34

    This week, Doug wraps up all the shows across our network, including the Show News, Bunny Lebowski's toes, STAMINA, RAMSAY, and US-Cert Vulnerabilities!

     

    Show Notes: https://wiki.securityweekly.com/SWNEpisode34

    Visit https://www.securityweekly.com/swn for all the latest episodes!

     

    Follow us on Twitter: https://www.twitter.com/securityweekly

    Like us on Facebook: https://www.facebook.com/secweekly