Remix Persistence With DynamoDB

Rate this content
Bookmark

Remix is the best React framework for working with the second most important feature of the web: forms. (Anchors are more important.) But building forms is the fun part: the tricky part is what happens when a web consumer submits a form! Not the client side validation logic but the brass tacks backend logic for creating, reading, updating, destroying, and listing records in a durable database (CRUDL). Databases can be intimidating. Which one to choose? What are the tradeoffs? How do I model data for fast queries? In this talk, we'll learn about the incredibly powerful AWS DynamoDB. Dynamo promises single-digit millisecond latency no matter how much data you have stored, scaling is completely transparent, and it comes with a generous free tier. Dynamo is a different level of database but it does not have to be intimidating.

This talk has been presented at Remix Conf Europe 2022, check out the latest edition of this React Conference.

FAQ

Yes, DynamoDB supports an SQL-like syntax through PartiQL, which allows for querying data in a manner similar to SQL. This makes it accessible for users familiar with SQL while offering the benefits of a NoSQL database.

DynamoDB automatically scales up and down according to the application's needs without downtime. It uses partitioning and replication to ensure that the database can handle large amounts of data and high levels of application traffic.

DynamoDB is a low-latency, wide-column key-value store used for database management. It operates as a fully managed service on AWS, meaning there's no need for manual patching or software upgrades. It allows for different item attributes per row and uses JSON for storing data.

DynamoDB offers a generous free tier, providing 25 GB of storage and 200 million requests per month. Beyond the free tier, costs are incurred based on storage and request volume, but it remains a cost-effective solution for many applications, especially during the prototyping phase.

Common misconceptions include the belief that DynamoDB is overly expensive, requires upfront knowledge of all access patterns, and is difficult to modify or migrate. However, these are largely myths; DynamoDB is cost-effective, flexible in data modeling, and supports SQL-like query options.

DynamoDB features include automatic scaling, built-in security, in-memory caching, continuous backups, and data import/export tools. It is designed to provide both high performance and high availability, handling over 82 million requests per second during peak times like Amazon's Prime Day.

DynamoDB is highly suitable for applications requiring low latency data access at any scale. It's particularly beneficial for web, mobile, gaming, ad tech, IoT, and many other applications. However, it might not be the best fit for applications requiring complex transactions typical in relational databases.

DynamoDB is favored for its scalability, managed service features, and low-latency performance, especially in high-demand environments. It supports a huge free tier, integrates well with AWS Lambda for single-digit millisecond latency, and its simplicity in API (about six key API calls) makes it user-friendly for developers.

Brian LeRoux
Brian LeRoux
41 min
18 Nov, 2022

Comments

Sign in or register to post your comment.
Video Summary and Transcription
DynamoDB is a next-generation key-value database that is low-latency, scalable, and easy to use. It offers advantages such as local development options, a generous free tier, and fast performance. Common misconceptions about DynamoDB being expensive or hard to learn are debunked. The Talk covers topics like basic modeling, separating concerns, working with DynamoDB in Remix, and building a DynamoDB client. Overall, DynamoDB is a powerful database that integrates well with Remix and provides efficient data access patterns.
Available in Español: Persistencia de Remix con DynamoDB

1. Introduction to DynamoDB

Short description:

Today I'm going to talk about persistence with DynamoDB, a next-generation key-value database. DynamoDB is a low-latency, wide-column key-value store that allows querying by key and storing values as JSON. It is a completely managed database with no patching or software upgrades required. Additionally, DynamoDB is scaled to zero, meaning you only pay for what you use.

Hi, everybody, it's a real pleasure to be here, and I'm stoked to be part of this remix movement with you. And today I'm going to be talking to you about persistence with DynamoDB. My name is Brian LaRue, you can find me on various socials, so it still exists under that name, and I work for Begin.com.

So, before I get into Dynamo, I'm just going to talk about persistence in general. So, persistence is a really important requirement for dynamic web applications. It is an essential complexity for anything that's personalized, so anything that's got an authentication step and we're saving some data about a person and we need to do that in a secure way and in a fast way, you're going to need a database. And you can't do this with a flat file system. You don't want to do this with a flat file system because you'll get into concurrency issues.

So, traditionally, people would choose a relational database, and DynamoDB is a kind of next-generation database that is key-value based. And so, most organizations out there these days have settled on Amazon for infrastructure, and Dynamo is the flagship key-value database for AWS. So, if you're using AWS, you probably would like to learn more about Dynamo.

So, what exactly is Dynamo? It's a low-latency, wide-column key-value store that's a really fancy way of saying that we query by key, and we store values as JSON, and we can have different shapes of different columns on every row. So, for every row in my database, I could have different item attributes and it's all good. Dynamo is a completely managed database, and this means that there's no patching. There's no software to upgrade, and that's really nice. And also really nice is that it's scaled to zero, which is a fancy way of saying that you only pay for what you use, and you don't pay for anything else. So, it's 100% utilization. You're not keeping a big cluster of servers around just to meet demand that you may or may not have. You just use what you pay for, and happy days. You move on from there.

2. Advantages of DynamoDB

Short description:

DynamoDB is the flagship managed database for the pioneer of the cloud, used by Amazon themselves. It offers great local development options, a huge free tier, and fast performance regardless of data size. With only a few key API calls and excellent compatibility with AWS Lambda, DynamoDB stands out from traditional relational databases in terms of speed and integration.

So, the next kind of big question that I often get is like, well, why would I choose DynamoDB out of the millions of database options that we have available to us out there? And the key one for me is it's the flagship managed database for the pioneer of the cloud, and they use it themselves at Amazon to back Amazon.com's retail business. So, it's just a good choice. From that regard, there's great local development options. It's got a huge free tier. It's fast no matter how much data you store, which is kind of a science fiction dream for databases. Used to be, as you added servers, you would add latency, and you definitely would add problems, which we just don't experience with a managed database. It's very small, so there's not a whole lot of API to learn. There's really only about six key API calls to deal with Dynamo, which is really great. It's got a good SDK for just about every runtime you could think of. And the sort of sleeper feature, my favorite feature, that it works really well with AWS Lambda, single digit millisecond latency for queries, no matter how much data you're storing. It's generally the line that gets tossed around, and this is a really big deal because a lot of databases are quite slow today, especially traditional relational databases. They can be made fast, but they're never gonna be that fast. And they just don't work as well with Lambda for a variety of reasons.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Building Better Websites with Remix
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
Building Better Websites with Remix
Top Content
Remix is a web framework built on React Router that focuses on web fundamentals, accessibility, performance, and flexibility. It delivers real HTML and SEO benefits, and allows for automatic updating of meta tags and styles. It provides features like login functionality, session management, and error handling. Remix is a server-rendered framework that can enhance sites with JavaScript but doesn't require it for basic functionality. It aims to create quality HTML-driven documents and is flexible for use with different web technologies and stacks.
Don't Solve Problems, Eliminate Them
React Advanced 2021React Advanced 2021
39 min
Don't Solve Problems, Eliminate Them
Top Content
Kent C. Dodds discusses the concept of problem elimination rather than just problem-solving. He introduces the idea of a problem tree and the importance of avoiding creating solutions prematurely. Kent uses examples like Tesla's electric engine and Remix framework to illustrate the benefits of problem elimination. He emphasizes the value of trade-offs and taking the easier path, as well as the need to constantly re-evaluate and change approaches to eliminate problems.
Scaling Up with Remix and Micro Frontends
Remix Conf Europe 2022Remix Conf Europe 2022
23 min
Scaling Up with Remix and Micro Frontends
Top Content
This talk discusses the usage of Microfrontends in Remix and introduces the Tiny Frontend library. Kazoo, a used car buying platform, follows a domain-driven design approach and encountered issues with granular slicing. Tiny Frontend aims to solve the slicing problem and promotes type safety and compatibility of shared dependencies. The speaker demonstrates how Tiny Frontend works with server-side rendering and how Remix can consume and update components without redeploying the app. The talk also explores the usage of micro frontends and the future support for Webpack Module Federation in Remix.
Full Stack Components
Remix Conf Europe 2022Remix Conf Europe 2022
37 min
Full Stack Components
Top Content
RemixConf EU discussed full stack components and their benefits, such as marrying the backend and UI in the same file. The talk demonstrated the implementation of a combo box with search functionality using Remix and the Downshift library. It also highlighted the ease of creating resource routes in Remix and the importance of code organization and maintainability in full stack components. The speaker expressed gratitude towards the audience and discussed the future of Remix, including its acquisition by Shopify and the potential for collaboration with Hydrogen.
Debugging JS
React Summit 2023React Summit 2023
24 min
Debugging JS
Top Content
Watch video: Debugging JS
Debugging JavaScript is a crucial skill that is often overlooked in the industry. It is important to understand the problem, reproduce the issue, and identify the root cause. Having a variety of debugging tools and techniques, such as console methods and graphical debuggers, is beneficial. Replay is a time-traveling debugger for JavaScript that allows users to record and inspect bugs. It works with Redux, plain React, and even minified code with the help of source maps.
Making JavaScript on WebAssembly Fast
JSNation Live 2021JSNation Live 2021
29 min
Making JavaScript on WebAssembly Fast
Top Content
WebAssembly enables optimizing JavaScript performance for different environments by deploying the JavaScript engine as a portable WebAssembly module. By making JavaScript on WebAssembly fast, instances can be created for each request, reducing latency and security risks. Initialization and runtime phases can be improved with tools like Wiser and snapshotting, resulting in faster startup times. Optimizing JavaScript performance in WebAssembly can be achieved through techniques like ahead-of-time compilation and inline caching. WebAssembly usage is growing outside the web, offering benefits like isolation and portability. Build sizes and snapshotting in WebAssembly depend on the application, and more information can be found on the Mozilla Hacks website and Bike Reliance site.

Workshops on related topic

Master JavaScript Patterns
JSNation 2024JSNation 2024
145 min
Master JavaScript Patterns
Top Content
Featured Workshop
Adrian Hajdin
Adrian Hajdin
During this workshop, participants will review the essential JavaScript patterns that every developer should know. Through hands-on exercises, real-world examples, and interactive discussions, attendees will deepen their understanding of best practices for organizing code, solving common challenges, and designing scalable architectures. By the end of the workshop, participants will gain newfound confidence in their ability to write high-quality JavaScript code that stands the test of time.
Points Covered:
1. Introduction to JavaScript Patterns2. Foundational Patterns3. Object Creation Patterns4. Behavioral Patterns5. Architectural Patterns6. Hands-On Exercises and Case Studies
How It Will Help Developers:
- Gain a deep understanding of JavaScript patterns and their applications in real-world scenarios- Learn best practices for organizing code, solving common challenges, and designing scalable architectures- Enhance problem-solving skills and code readability- Improve collaboration and communication within development teams- Accelerate career growth and opportunities for advancement in the software industry
Using CodeMirror to Build a JavaScript Editor with Linting and AutoComplete
React Day Berlin 2022React Day Berlin 2022
86 min
Using CodeMirror to Build a JavaScript Editor with Linting and AutoComplete
Top Content
WorkshopFree
Hussien Khayoon
Kahvi Patel
2 authors
Using a library might seem easy at first glance, but how do you choose the right library? How do you upgrade an existing one? And how do you wade through the documentation to find what you want?
In this workshop, we’ll discuss all these finer points while going through a general example of building a code editor using CodeMirror in React. All while sharing some of the nuances our team learned about using this library and some problems we encountered.
Remix Fundamentals
React Summit 2022React Summit 2022
136 min
Remix Fundamentals
Top Content
WorkshopFree
Kent C. Dodds
Kent C. Dodds
Building modern web applications is riddled with complexity And that's only if you bother to deal with the problems
Tired of wiring up onSubmit to backend APIs and making sure your client-side cache stays up-to-date? Wouldn't it be cool to be able to use the global nature of CSS to your benefit, rather than find tools or conventions to avoid or work around it? And how would you like nested layouts with intelligent and performance optimized data management that just works™?
Remix solves some of these problems, and completely eliminates the rest. You don't even have to think about server cache management or global CSS namespace clashes. It's not that Remix has APIs to avoid these problems, they simply don't exist when you're using Remix. Oh, and you don't need that huge complex graphql client when you're using Remix. They've got you covered. Ready to build faster apps faster?
At the end of this workshop, you'll know how to:- Create Remix Routes- Style Remix applications- Load data in Remix loaders- Mutate data with forms and actions
Relational Database Modeling for GraphQL
GraphQL Galaxy 2020GraphQL Galaxy 2020
106 min
Relational Database Modeling for GraphQL
Top Content
Workshop
Adron Hall
Adron Hall
In this workshop we'll dig deeper into data modeling. We'll start with a discussion about various database types and how they map to GraphQL. Once that groundwork is laid out, the focus will shift to specific types of databases and how to build data models that work best for GraphQL within various scenarios.
Table of contentsPart 1 - Hour 1      a. Relational Database Data Modeling      b. Comparing Relational and NoSQL Databases      c. GraphQL with the Database in mindPart 2 - Hour 2      a. Designing Relational Data Models      b. Relationship, Building MultijoinsTables      c. GraphQL & Relational Data Modeling Query Complexities
Prerequisites      a. Data modeling tool. The trainer will be using dbdiagram      b. Postgres, albeit no need to install this locally, as I'll be using a Postgres Dicker image, from Docker Hub for all examples      c. Hasura
Testing Web Applications Using Cypress
TestJS Summit - January, 2021TestJS Summit - January, 2021
173 min
Testing Web Applications Using Cypress
Top Content
WorkshopFree
Gleb Bahmutov
Gleb Bahmutov
This workshop will teach you the basics of writing useful end-to-end tests using Cypress Test Runner.
We will cover writing tests, covering every application feature, structuring tests, intercepting network requests, and setting up the backend data.
Anyone who knows JavaScript programming language and has NPM installed would be able to follow along.
React Server Components Unleashed: A Deep Dive into Next-Gen Web Development
React Day Berlin 2023React Day Berlin 2023
149 min
React Server Components Unleashed: A Deep Dive into Next-Gen Web Development
Workshop
Maurice de Beijer
Maurice de Beijer
Get ready to supercharge your web development skills with React Server Components! In this immersive, 3-hour workshop, we'll unlock the full potential of this revolutionary technology and explore how it's transforming the way developers build lightning-fast, efficient web applications.
Join us as we delve into the exciting world of React Server Components, which seamlessly blend server-side rendering with client-side interactivity for unparalleled performance and user experience. You'll gain hands-on experience through practical exercises, real-world examples, and expert guidance on how to harness the power of Server Components in your own projects.
Throughout the workshop, we'll cover essential topics, including:- Understanding the differences between Server and Client Components- Implementing Server Components to optimize data fetching and reduce JavaScript bundle size- Integrating Server and Client Components for a seamless user experience- Strategies for effectively passing data between components and managing state- Tips and best practices for maximizing the performance benefits of React Server Components