SlideShare a Scribd company logo
1 of 42
Remix
By Rahul Mohan and Mohammed Farhan
Speakers
• Rahul Mohan, Talentica Software
• Mohammed Farhan, Talentica Software
2
Some Prerequisite
• ReactJS
• What is SSR, CSR, SSG.
• SSR (Server-side rendering) : The good old days of PHP and
templating languages.
• SSR is faster but can be more costly in terms of deployment (thin
client) can’t be cached in end nodes (CDN’s)
• Pros of SSR:
• Social media-friendly.
• SEO friendly.
• Fast First Concertful Paint (FCP).
• Up-to-date content.
3
SSR,CSR,SSG
Cons:
• Slow TTFB
• Server-intensive workloads
• Can’t be cached by traditional CDNs
• Navigating across a site is slow without universal rendering
• TTI is longer than FTP with universal rendering
4
SSR,CSR,SSG
• SSR (Static side Rendering)
• Build the pages at run time, this was what the original web was
made on, but new frameworks have made this a good
alternative.
• Pros of SSG:
• Fast load times
• SEO friendly
• Cons of SSG:
• Problematic for sites with many pages
• No personalization
• Content may be stale
5
SSR,CSR,SSG
• Cons of SSG:
• Problematic for sites with many pages
• No personalization
• Content may be stale
6
SSR,CSR,SSG
• Client-Side Rendering
This everyone is known as react become very prevalent in the
last five years.
• Pros:
• Very responsive sites
• No need to wait for pages to be loaded
• Easy in a production env lower build times with the code-
base as static page assets don’t need to be built.
7
SSR,CSR,SSG
• Cons
• Hard to make is SEO Friendly (Google new ranking
algorithm)
• Bigger bundle sizes and slow first conceitful page.
• Not he best option for very thin client there is a JS
overhead.
8
Why Remix ?
• A Runtime for React
• Component + API Route (write your server-side code and
components in the same file).
• Cut down the API overheads of any fetch.
• Avoid the standard Pattern:
• <form method=“post” onSubmit={event => {
event.preventDefault();
}}
• Create state to manage data.
• Use effect hook to update UI.
9
Why Remix ?
• Use the form (browser) like the good old days of
PHP let the browser manage the state.
• useLoaderData,useActionData,useTransition
• Amazing error bounders on the sever side code
and the frontend side.
10
Why Remix ?
11
Prerequisites-The dev setup
12
• Node.js 14 or greater(Preferred 16)
• npm 7 or greater
Initial setup
• npx create-remix@latest
• Follow along with the defaults use some other
service if you want to have another server. (remix
app serer should do fine for now)
• cd project_name
13
Initial setup
14
The file Structure
15
The file Structure
16
• app/ - This is where all your Remix app code goes
• app/entry.client.tsx - This is the first bit of your JavaScript that will run when the
app loads in the browser. We use this file to hydrate our React components.
• app/entry.server.tsx - This is the first bit of your JavaScript that will run when a
request hits your server. Remix handles loading all the necessary data and
you're responsible for sending back the response. We'll use this file to render our
React app to a string/stream and send that as our response to the client.
• app/root.tsx - This is where we put the root component for our application. You
render the <html> element here.
• app/routes/ - This is where all your "route modules" will go. Remix uses the files
in this directory to create the URL routes for your app based on the name of the
files.
• public/ - This is where your static assets go (images/fonts/etc)
• remix.config.js - Remix has a handful of configuration options you can set in this
file.
The file Structure
17
• Let’s delete the files and start a new project
The file Structure
18
• Change your root
Routes
• /
• /blog
• /blog/:blogID
• /blog/new
• /login
19
Old way of routes
20
Routes: app/routes/index.tsx
21
Routes: app/root.tsx
22
Routes: Nested Routes
23
Routes: Nested Routes
24
Routes: Nested Routes
25
Routes: Parameterized Routes
26
Style and all that jazz
• We are going back to the good old days of stylesheets
27
Style and all that jazz
28
Style and all that jazz
29
Some Boring but important DB setup
30
• As this has nothing to do with react in general, I will be breezing
through most of it, but you can use any ORM you please and use
any underlying DB or API you please
• We will be using Prisma
• And a local DB
LoaderFunction,useLoaderData,Link
• LoaderFunction: This is simply an async
function you export that returns a response
• useLoaderData: The hook that replaces all
the other use hooks on your fronted
• Link: Similar to the one we all know and love
from react-router.
31
AUTHENTICATION - Process of recognizing a user's identity
 Password based authentication
 In web world HTTP cookies is the way to use for
authentication.
 HTTP Cookies – Server sends small piece of data to user’
browser and it stores it and sends back to server with later
request for user specific authentication.
 How to set cookie ?
 Set-Cookie: <cookie-name>=<cookie-value>
32
33
Remix‘s Session
 Allow server to identify if request coming form same person
 Remix comes with pre-built session storage options.
1. CreateCookieSessionStorage
2. createMemorySessionStorage
3. CreateFileSessionStorage
4. CreateCloudflareKVSessionStorage(cloudflare-workers)
5. CreateSessionStorage(Custom)
34
How to create cookie session with Remix ?
35
Error handling
 Error handling in remix is stellar
 Route modules has Error Boundary component exported and used
 Error Boundary also works on server errors, action and loaders.
 Error Boundary is some kind of same that we have in REACT16
36
export function ErrorBoundary() {
}
Unexpected Error handling
Error those are not known or guessed it could be catch with this
Expected Error handling
Error those are known and based on that dev can display information to user
SEO With Meta tags
 Remix has meta export for route modules
 <Meta/> Tag for app/root.tsx . It’s in built.
Resource Routing
 Renders other than HTML document like CSV data, image, RSS feed.
 Crete a file under routes jokes[.]rss.tsx
Remix can work without loading JavaScript to the page ?
Thank You

More Related Content

Similar to Remix: An Introduction to Server-Side Rendering with React

Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Henry S
 
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!Teamstudio
 
JavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User ExperienceJavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User Experiencereeder29
 
Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Dimitri de Putte
 
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...Amazon Web Services
 
RESTful web
RESTful webRESTful web
RESTful webAlvin Qi
 
AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)Igor Talevski
 
Delivering Mobile Apps That Perform
Delivering Mobile Apps That PerformDelivering Mobile Apps That Perform
Delivering Mobile Apps That PerformRuben Goncalves
 
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...Ram G Athreya
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applicationsEugene Lazutkin
 
AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2Sean Braymen
 
2014 09-12 lambda-architecture-at-indix
2014 09-12 lambda-architecture-at-indix2014 09-12 lambda-architecture-at-indix
2014 09-12 lambda-architecture-at-indixYu Ishikawa
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuningJohn McCaffrey
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...Malin Weiss
 
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...Speedment, Inc.
 
ReproNow—Save Time Reproducing and Triaging Security Bugs
ReproNow—Save Time Reproducing and Triaging Security BugsReproNow—Save Time Reproducing and Triaging Security Bugs
ReproNow—Save Time Reproducing and Triaging Security BugsPriyanka Aash
 

Similar to Remix: An Introduction to Server-Side Rendering with React (20)

Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1Code for Startup MVP (Ruby on Rails) Session 1
Code for Startup MVP (Ruby on Rails) Session 1
 
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
The Autobahn Has No Speed Limit - Your XPages Shouldn't Either!
 
#Webperf Choreography
#Webperf Choreography#Webperf Choreography
#Webperf Choreography
 
JavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User ExperienceJavaScript Service Worker Design Patterns for Better User Experience
JavaScript Service Worker Design Patterns for Better User Experience
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
Javascript for Wep Apps
Javascript for Wep AppsJavascript for Wep Apps
Javascript for Wep Apps
 
Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012Backbonification for dummies - Arrrrug 10/1/2012
Backbonification for dummies - Arrrrug 10/1/2012
 
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
AWS re:Invent 2016: Amazon CloudFront Flash Talks: Best Practices on Configur...
 
RESTful web
RESTful webRESTful web
RESTful web
 
AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)AngularJS 1.x - your first application (problems and solutions)
AngularJS 1.x - your first application (problems and solutions)
 
Delivering Mobile Apps That Perform
Delivering Mobile Apps That PerformDelivering Mobile Apps That Perform
Delivering Mobile Apps That Perform
 
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
A Public Cloud Based SOA Workflow for Machine Learning Based Recommendation A...
 
Optimization of modern web applications
Optimization of modern web applicationsOptimization of modern web applications
Optimization of modern web applications
 
Web Performance Optimization (WPO)
Web Performance Optimization (WPO)Web Performance Optimization (WPO)
Web Performance Optimization (WPO)
 
AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2AOUG_11Nov2016_Challenges_with_EBS12_2
AOUG_11Nov2016_Challenges_with_EBS12_2
 
2014 09-12 lambda-architecture-at-indix
2014 09-12 lambda-architecture-at-indix2014 09-12 lambda-architecture-at-indix
2014 09-12 lambda-architecture-at-indix
 
Cvcc performance tuning
Cvcc performance tuningCvcc performance tuning
Cvcc performance tuning
 
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
How to JavaOne 2016 - Generate Customized Java 8 Code from Your Database [TUT...
 
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
JavaOne2016 - How to Generate Customized Java 8 Code from Your Database [TUT4...
 
ReproNow—Save Time Reproducing and Triaging Security Bugs
ReproNow—Save Time Reproducing and Triaging Security BugsReproNow—Save Time Reproducing and Triaging Security Bugs
ReproNow—Save Time Reproducing and Triaging Security Bugs
 

More from Talentica Software

Typescript: Beginner to Advanced
Typescript: Beginner to AdvancedTypescript: Beginner to Advanced
Typescript: Beginner to AdvancedTalentica Software
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in ReactTalentica Software
 
Nodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design PatternNodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design PatternTalentica Software
 
Setting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | TalenticaSetting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | TalenticaTalentica Software
 
Connected World in android - Local data sharing and service discovery
Connected World in android - Local data sharing and service discoveryConnected World in android - Local data sharing and service discovery
Connected World in android - Local data sharing and service discoveryTalentica Software
 
Mobile App Monetization - Ecosystem & Emerging Trends
Mobile App Monetization - Ecosystem & Emerging TrendsMobile App Monetization - Ecosystem & Emerging Trends
Mobile App Monetization - Ecosystem & Emerging TrendsTalentica Software
 
Android Media Player Development
Android Media Player DevelopmentAndroid Media Player Development
Android Media Player DevelopmentTalentica Software
 
Cross Platform Mobile Technologies
Cross Platform Mobile TechnologiesCross Platform Mobile Technologies
Cross Platform Mobile TechnologiesTalentica Software
 
Big Data Technologies - Hadoop
Big Data Technologies - HadoopBig Data Technologies - Hadoop
Big Data Technologies - HadoopTalentica Software
 
Continous Integration: A Case Study
Continous Integration: A Case StudyContinous Integration: A Case Study
Continous Integration: A Case StudyTalentica Software
 
Technology Challenges in Building New Media Applications
Technology Challenges in Building New Media ApplicationsTechnology Challenges in Building New Media Applications
Technology Challenges in Building New Media ApplicationsTalentica Software
 
Flex on Grails - Rich Internet Applications With Rapid Application Development
Flex on Grails - Rich Internet Applications With Rapid Application DevelopmentFlex on Grails - Rich Internet Applications With Rapid Application Development
Flex on Grails - Rich Internet Applications With Rapid Application DevelopmentTalentica Software
 

More from Talentica Software (20)

Typescript: Beginner to Advanced
Typescript: Beginner to AdvancedTypescript: Beginner to Advanced
Typescript: Beginner to Advanced
 
Web 3.0
Web 3.0Web 3.0
Web 3.0
 
Web Performance & Latest in React
Web Performance & Latest in ReactWeb Performance & Latest in React
Web Performance & Latest in React
 
Nodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design PatternNodejs Chapter 3 - Design Pattern
Nodejs Chapter 3 - Design Pattern
 
Node js Chapter-2
Node js Chapter-2Node js Chapter-2
Node js Chapter-2
 
Node.js Chapter1
Node.js Chapter1Node.js Chapter1
Node.js Chapter1
 
Micro Frontends
Micro FrontendsMicro Frontends
Micro Frontends
 
Test Policy and Practices
Test Policy and PracticesTest Policy and Practices
Test Policy and Practices
 
Advanced JavaScript
Advanced JavaScriptAdvanced JavaScript
Advanced JavaScript
 
Setting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | TalenticaSetting Up Development Environment For Google App Engine & Python | Talentica
Setting Up Development Environment For Google App Engine & Python | Talentica
 
Connected World in android - Local data sharing and service discovery
Connected World in android - Local data sharing and service discoveryConnected World in android - Local data sharing and service discovery
Connected World in android - Local data sharing and service discovery
 
Mobile App Monetization - Ecosystem & Emerging Trends
Mobile App Monetization - Ecosystem & Emerging TrendsMobile App Monetization - Ecosystem & Emerging Trends
Mobile App Monetization - Ecosystem & Emerging Trends
 
Android Media Player Development
Android Media Player DevelopmentAndroid Media Player Development
Android Media Player Development
 
Cross Platform Mobile Technologies
Cross Platform Mobile TechnologiesCross Platform Mobile Technologies
Cross Platform Mobile Technologies
 
Big Data Technologies - Hadoop
Big Data Technologies - HadoopBig Data Technologies - Hadoop
Big Data Technologies - Hadoop
 
Big Data – Are You Ready?
Big Data – Are You Ready?Big Data – Are You Ready?
Big Data – Are You Ready?
 
Legacy modernization
Legacy modernizationLegacy modernization
Legacy modernization
 
Continous Integration: A Case Study
Continous Integration: A Case StudyContinous Integration: A Case Study
Continous Integration: A Case Study
 
Technology Challenges in Building New Media Applications
Technology Challenges in Building New Media ApplicationsTechnology Challenges in Building New Media Applications
Technology Challenges in Building New Media Applications
 
Flex on Grails - Rich Internet Applications With Rapid Application Development
Flex on Grails - Rich Internet Applications With Rapid Application DevelopmentFlex on Grails - Rich Internet Applications With Rapid Application Development
Flex on Grails - Rich Internet Applications With Rapid Application Development
 

Recently uploaded

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 

Recently uploaded (20)

APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 

Remix: An Introduction to Server-Side Rendering with React

  • 1. Remix By Rahul Mohan and Mohammed Farhan
  • 2. Speakers • Rahul Mohan, Talentica Software • Mohammed Farhan, Talentica Software 2
  • 3. Some Prerequisite • ReactJS • What is SSR, CSR, SSG. • SSR (Server-side rendering) : The good old days of PHP and templating languages. • SSR is faster but can be more costly in terms of deployment (thin client) can’t be cached in end nodes (CDN’s) • Pros of SSR: • Social media-friendly. • SEO friendly. • Fast First Concertful Paint (FCP). • Up-to-date content. 3
  • 4. SSR,CSR,SSG Cons: • Slow TTFB • Server-intensive workloads • Can’t be cached by traditional CDNs • Navigating across a site is slow without universal rendering • TTI is longer than FTP with universal rendering 4
  • 5. SSR,CSR,SSG • SSR (Static side Rendering) • Build the pages at run time, this was what the original web was made on, but new frameworks have made this a good alternative. • Pros of SSG: • Fast load times • SEO friendly • Cons of SSG: • Problematic for sites with many pages • No personalization • Content may be stale 5
  • 6. SSR,CSR,SSG • Cons of SSG: • Problematic for sites with many pages • No personalization • Content may be stale 6
  • 7. SSR,CSR,SSG • Client-Side Rendering This everyone is known as react become very prevalent in the last five years. • Pros: • Very responsive sites • No need to wait for pages to be loaded • Easy in a production env lower build times with the code- base as static page assets don’t need to be built. 7
  • 8. SSR,CSR,SSG • Cons • Hard to make is SEO Friendly (Google new ranking algorithm) • Bigger bundle sizes and slow first conceitful page. • Not he best option for very thin client there is a JS overhead. 8
  • 9. Why Remix ? • A Runtime for React • Component + API Route (write your server-side code and components in the same file). • Cut down the API overheads of any fetch. • Avoid the standard Pattern: • <form method=“post” onSubmit={event => { event.preventDefault(); }} • Create state to manage data. • Use effect hook to update UI. 9
  • 10. Why Remix ? • Use the form (browser) like the good old days of PHP let the browser manage the state. • useLoaderData,useActionData,useTransition • Amazing error bounders on the sever side code and the frontend side. 10
  • 12. Prerequisites-The dev setup 12 • Node.js 14 or greater(Preferred 16) • npm 7 or greater
  • 13. Initial setup • npx create-remix@latest • Follow along with the defaults use some other service if you want to have another server. (remix app serer should do fine for now) • cd project_name 13
  • 16. The file Structure 16 • app/ - This is where all your Remix app code goes • app/entry.client.tsx - This is the first bit of your JavaScript that will run when the app loads in the browser. We use this file to hydrate our React components. • app/entry.server.tsx - This is the first bit of your JavaScript that will run when a request hits your server. Remix handles loading all the necessary data and you're responsible for sending back the response. We'll use this file to render our React app to a string/stream and send that as our response to the client. • app/root.tsx - This is where we put the root component for our application. You render the <html> element here. • app/routes/ - This is where all your "route modules" will go. Remix uses the files in this directory to create the URL routes for your app based on the name of the files. • public/ - This is where your static assets go (images/fonts/etc) • remix.config.js - Remix has a handful of configuration options you can set in this file.
  • 17. The file Structure 17 • Let’s delete the files and start a new project
  • 18. The file Structure 18 • Change your root
  • 19. Routes • / • /blog • /blog/:blogID • /blog/new • /login 19
  • 20. Old way of routes 20
  • 27. Style and all that jazz • We are going back to the good old days of stylesheets 27
  • 28. Style and all that jazz 28
  • 29. Style and all that jazz 29
  • 30. Some Boring but important DB setup 30 • As this has nothing to do with react in general, I will be breezing through most of it, but you can use any ORM you please and use any underlying DB or API you please • We will be using Prisma • And a local DB
  • 31. LoaderFunction,useLoaderData,Link • LoaderFunction: This is simply an async function you export that returns a response • useLoaderData: The hook that replaces all the other use hooks on your fronted • Link: Similar to the one we all know and love from react-router. 31
  • 32. AUTHENTICATION - Process of recognizing a user's identity  Password based authentication  In web world HTTP cookies is the way to use for authentication.  HTTP Cookies – Server sends small piece of data to user’ browser and it stores it and sends back to server with later request for user specific authentication.  How to set cookie ?  Set-Cookie: <cookie-name>=<cookie-value> 32
  • 33. 33
  • 34. Remix‘s Session  Allow server to identify if request coming form same person  Remix comes with pre-built session storage options. 1. CreateCookieSessionStorage 2. createMemorySessionStorage 3. CreateFileSessionStorage 4. CreateCloudflareKVSessionStorage(cloudflare-workers) 5. CreateSessionStorage(Custom) 34
  • 35. How to create cookie session with Remix ? 35
  • 36. Error handling  Error handling in remix is stellar  Route modules has Error Boundary component exported and used  Error Boundary also works on server errors, action and loaders.  Error Boundary is some kind of same that we have in REACT16 36 export function ErrorBoundary() { }
  • 37. Unexpected Error handling Error those are not known or guessed it could be catch with this
  • 38. Expected Error handling Error those are known and based on that dev can display information to user
  • 39. SEO With Meta tags  Remix has meta export for route modules  <Meta/> Tag for app/root.tsx . It’s in built.
  • 40. Resource Routing  Renders other than HTML document like CSV data, image, RSS feed.  Crete a file under routes jokes[.]rss.tsx
  • 41. Remix can work without loading JavaScript to the page ?