Build a mini Yelp for Bathrooms. This was my demo for the AWS NYC Summit talk.
It's inspired by Seinfeld and the scene where George Costanza says "give me an address, ill tell you the best bathroom in the city."
View the running demo here https://main.d2ddguywmojniz.amplifyapp.com/
Amplify Studio is a new service apart of the Amplify portfolio -- it helps frontend developers more easily build UIs by converting Figma files to human-readable react code! You don't have to be a CSS wiz!
Step-by-step on how to configure, develop & deploy this app on AWS.
Studio will orchestrate handling your data APIs, generating your React code from Figma and more, like authentication!
- Sign-in to AWS or Create an Account
- Head over to AWS Amplify, New app -> Build an app. Give it a name, deploy.
- Launch Studio! FYI, you can grant co-workers access to studio without requiring an AWS account.
- Let's add our data models. Use the suggested model below called
Bathrooms
name -> String
rating -> Float
address -> String
description -> String
image_url -> String
- Save, and deploy.
I recommend starting with our base Figma template and altering/building components from there. These privatives are tied to Amplify UI library.
- For this tutorial, you can use my Figma File where I've configured 4 components to match the above design. Duplicate this in your Figma account.
The components are called:
NavBar
BathroomCard
HeroGeorge
TestFooter
- Play around with the file, and create or alter a component of your own! We will use shortly.
- Create a base React app to give us a starting point.
- I used CRA -
npx npx create-react-app .
npm install
&npm start
- confirm this works as expected- Install Amplify CLI (Amplify's toolchain)
npm install -g @aws-amplify/cli
- Install Amplify's UI lib
npm install aws-amplify @aws-amplify/ui-react
- Initialize Amplify with
amplify init
, follow steps
Amplify Studio also provides a light-weight CMS. This makes it easy to test and prototype.
- In Amplfiy Studio, click Content (under manage).
- You can try to auto-generate data using the Faker.js integration, but I recommend making three entries of your own. If you need an image, you can use these: image1 , image2 , image3
- Click create bathroom, and create a few! This data updates in real-time!
After your components are built (yes, they can be adjusted at anytime) let's sync them with Amplify studio
- Go to Amplify Studio. Click UI Library -> get started.
- Copy/Paste your Figma URL
- Studio is now importing each component -- feel free to Accept all.
- Moving forward, each adjustment made to the Figma file will need to be synced to Studio. (see workflow section below)
- After Studio imports these components, we must bind the corresponding fields to the data model we created.
- Let's sync
BathroomCard
first. Find it from the component list, then click Configure (upper right) - Click on Bathroom Name -> set text label. Under value select bathroom.name.
- Set the remaining properties (don't forget the image). The rating component requires you to create a prop called
value
, then for Value selectbathroom.rating
. - Now our bathroom component is linked to our data models. This will generate code that pulls live data using the APIs created & managed by Studio.
- Let's build a Collection which will display a list of our
BathroomCard
. Click Create collection and name itBathroomCardCollection
. Test different layouts. I selected Grid. You can also sort and add pagination or search with a click. - Configure the remaining components using the methods above. Here's the logo I used for the Header. Set this in Amplify Studio by setting the src prop.
Now that our components are built, synced and linked to data in Studio, we can now import them in our codebase.
- In studio, click Get component code at the bottom.
- First, we must pull down these changes by running
amplify pull
, the full command should look like `amplify pull --appId xxxapp_id``` --envName staging - This pulls the human-readable code locally. You can view the component code in the Components directory
- In general, you simply import the component like this
import {
BathroomCardCollectionThree
} from './ui-components';
Then call it <BathroomCardCollectionThree />
- Copy/paste the App.js code - Simply imported & referenced the 4 components and added a few CSS properties.
- Copy/paste the Index.js code - installed Amplify.
- Want the same font? Put
@import url('https://fonts.googleapis.com/css2?family=Inter:slnt,[email protected],100..900&display=swap');
at the top ofApp.css
Run the app! npm start
The optimal developer workflow is 1) Editing components in Figma 2) Syncing these changes to Studio (click Sync with Figma Button) 3) running amplify pull
locally
This takes the changes from Figma, imports to Studio, then updates the generated code.
- Use the Amplify Theming Plugin The Seinfeld colors are...
Red: #fe0116
Blue: #062f63
Yellow: #ffea00
- Add Authentication with one click! Click the Authentication tab in Studio. Keep the defaults and click Deploy. Then uncomment Line 34 in
App.js
, comment out line 35. - Check out overrides
- Deploy on Amplify Hosting with one command
amplify publish
- Reach out on the Amplify Discord Server
- Tweet at @mauerbac on Twitter
- Create a GitHub issue in the Studio Repo