Frontend
Last updated
Last updated
After you defined the business functionality - expressed most clearly by the APIs of a domain - by creating your API mocks, you start building your UI.
Architectural Decisions
*TODO: Create ADR* I stick with React up to the point that the others are at least on the same functional level: Native and Frontend.
Decide if you deploy the application serverless or use docker containers (vendor independent)
Build Setup: ES6, webpack, babel, npm
Frontend Framework: React ( / ) - JSX, State, Life Cycle Methods
State Management: Redux + Redux Saga
Web/Desktop:
React with Create-React-App
CSS Framework - Bulma /
Web/Mobile:
CSS Framework - Bulma
Native:
React Native
To get feedback fast create a first prototype:
Define Application Structure (Paper? + Photo or Balsamiq + screenshot from rolemodels):
Create sampleapp-client
Setup Project Structure
Create Router and setup basic Application structure
Install: npm i react-router-dom
Create Placeholder Components/Containers:
Setup CSS Framework for Styling
Install storybook.js and configure it
Further Setup:
Create Container/Componente LoginPage (might be a container in the future):
/src/container/LoginPage
in its own folder in this folder you then find the LoginPage.js
file, .css
, pictures (.svg
) and the story LoginPage-story.js
Example how IBM is doing it:
Developer Components in Stylebook:
Run Storybook: npm run storybook
Using ReactRouter with history:
use withRouter on at least App and otherwise use a manual history object
Frontend Tracking with Google Analytics:
Upload the assets of our app
Use a CDN to serve out our assets
Point our domain to the CDN distribution
Switch to HTTPS with a SSL certificate
Select Create Bucketand pick a name for your application and select the US East (N. Virginia) Region Region. Since our application is being served out using a CDN, the region should not matter to us.
Now click on your newly created bucket from the list and navigate to its permissions panel by clicking Permissions.
Now select Use this bucket to host a website and add ourindex.html
as the Index Document and the Error Document. Since we are letting React handle 404s, we can simply redirect our errors to ourindex.html
as well. Hit Save once you are done.
This panel also shows us where our app will be accessible. AWS assigns us a URL for our static website. In this case the URL assigned to me is http://developerportal-client.s3-website.eu-central-1.amazonaws.com
.
Create React App comes with a convenient way to package and prepare our app for deployment. From our working directory simply run the following command.
This packages all of our assets and places them in thebuild/
directory.
Now to deploy simply run the following command; whereYOUR_S3_DEPLOY_BUCKET_NAME
is the name of the S3 Bucket we created before.
unit testing framework
component based testing frameworks
how to build this into the build pipeline?
Code splitting to multiple pages in react:
single-spa:
Design:
LandingPage (login or not)2. Personal Service Page (only logged in)
Theory:
Link: /
Setup Routers:
I currently use / and :
Include link to css in index.html or (recomended)
Basic Setup:
Configure Storybook []
Component
Config:
Storybook:
Webpack config (to use):
How to use in project:
Sample:
AWS provides quite a few services that can help us do the above. We are going to use to host our assets, to serve it, to manage our domain, and to handle our SSL certificate.
First, log in to yourand select S3 from the list of services.
All this command does is that it syncs thebuild/
directory with our bucket on S3. Just as a sanity check, go into the S3 section in your and check if your bucket has the files we just uploaded.
Authenticated Session with the SSO / Login page and inquiry without user interaction:
Serverside Rendering:
AWS Amplify:
Create new Component Mock and Create new StoryBook (e.g. copying the one of the old component):
Implement new component logic