In this post I'll show you how to design four different example apps - a SimpleNote clone, a Twitter clone, a Slack clone, and an E-commerce store. And we'll do it with the coolest new toy released at AWS re:Invent 2020
Introducing the Amplify Sandbox
Amplify Admin UI is an new low code interface used for building an app back-end and the used does not require AWS expertise.
The sandbox can be shared publicly where we can create and prototype our data models without even login to the AWS account.
At present only the Data Sand Box is built out, but over the time the other categories of AWS Amplify will be made available.
When you first enter the sand box, we will see a visual builder where we can add our models, enums, and custom type. We mostly create custom models.
We can name models, add fields, and even add one to one OR one to many, OR many to may relationships between models.
Four Sample Sandboxes
A notes app (inspired by the free note-taking app SimpleNote)
A chat app (inspired by Slack)
A social media app (inspired by Twitter)
An ecommerce backend (inspired by every shopping experience)
The Notes App
This is a minimal app that I personally use every day, so I like it for its simplicity. We have two models: Notes and Tags, and only one many-to-many relationship between them for easy querying
You can see the Sandbox here: https://sandbox.amplifyapp.com/schema-design/1c782f02-1fe7-4785-9a02-22a27cc96d0d/clone. Note that we use a bidirectional many to many relationship here between the models, as notes can have zero or more tags and vice versa.
The Slack Clone
Many of us use chat apps for work, so we are familiar with this app use case from the user side.
You can see the Sandbox here: https://sandbox.amplifyapp.com/schema-design/5f863684-fd1e-41b4-bca1-36c2271e21a1/clone. Channel is the most complex model here – notice how we fully utilize all the relationship types available in the Sandbox:
Channels can have many Users, and Users can join many Channels
Channels can only be created by one User, and there is no requirement to keep track of what channels any particular user has created
Channels can have many Messages, but each Message can only belong to one Channel.
The Twitter Clone
Social media is often one of the most complex data models to model. We implement the minimum viable social media app – a Tweet and a User model is all we offer.
You can see the Sandbox here: https://sandbox.amplifyapp.com/schema-design/ad5b5b7e-f207-42d1-92b1-0ccef056a26b/clone. Note that recursion is implemented here by modeling likes, replies, and quotes as an array of the respective User and Tweet ID's.
The Ecommerce Store
The stakes are higher when there is money involved. Keeping track of orders and ensuring a great customer experience is important and critical task.
Since there are infinitely many variations on the ecommerce experience, we can’t possibly model them all, but I hope that this serves as a good enough starting point. Share your own if you have twists on this concept! You can see the Sandbox here: https://sandbox.amplifyapp.com/schema-design/aa0e7a61-aa72-4b27-b6db-ea8e2031f95e/clone. Note the sheer complexity of this model is easily handled by the Sandbox's features. One Order can only have one Customer, but a Customer can have many Orders.
When you set this up on the Customer model, the Sandbox is smart enough to automatically set up a corresponding customerID field as a "Relationship Source" on the Order model. This will be very handy for GraphQL queries down the road.
How to Deploy the Model to AWS
Once we are done with your model, the Sandbox prompts you to test locally by downloading it with the Amplify CLI. However, if we want to get it live on AWS, we can skip that and head straight to the "Deploy to AWS" stage:
If you read this far, hit like and share to show the author that you care.
Comments