<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jeff Mendez on Medium]]></title>
        <description><![CDATA[Stories by Jeff Mendez on Medium]]></description>
        <link>https://medium.com/@jeffmendez?source=rss-f9c20205dc8c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CVzUJyfIo1mLpahbMNxtgw.jpeg</url>
            <title>Stories by Jeff Mendez on Medium</title>
            <link>https://medium.com/@jeffmendez?source=rss-f9c20205dc8c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 00:40:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jeffmendez/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Unlocking the Power of Web Crawling with Spider.Cloud]]></title>
            <link>https://jeffmendez.medium.com/unlocking-the-power-of-web-crawling-with-spider-cloud-04f652737d85?source=rss-f9c20205dc8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/04f652737d85</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[web-crawler]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Jeff Mendez]]></dc:creator>
            <pubDate>Wed, 07 Aug 2024 12:17:18 GMT</pubDate>
            <atom:updated>2024-08-09T23:57:29.591Z</atom:updated>
            <content:encoded><![CDATA[<p>In the realm of data collection and web scraping, efficiency, cost-effectiveness, and ease of use are key pillars that determine the success of any tool. Enter <a href="https://spider.cloud/">Spider.Cloud</a> — a leading web crawling tool that hits the mark on all fronts, providing advanced yet user-friendly solutions for data curation. In this article, we’ll dive into what makes <a href="https://spider.cloud/">Spider.Cloud</a> an exceptional choice for all your web crawling needs to the next generation of speed with <a href="https://github.com/spider-rs/spider">Spider</a> .</p><figure><img alt="The Spider Cloud Dashboard that allows seamless data collecting. The dashboard displays the form for adding websites, credits display &amp; billing, websites, and the detailed view on the right of the website active data." src="https://cdn-images-1.medium.com/max/700/0*ZQo3qycjl6AqqNsS.png" /><figcaption>Spider Cloud Dashboard</figcaption></figure><h3>What is Spider.Cloud?</h3><p>Spider.Cloud is a web crawling platform that simplifies the process of collecting data from various websites. It is designed to offer speed and cost-effectiveness while supporting an array of data formats, including LLM-ready markdown. Whether you are a developer, a data scientist, or someone new to web scraping, Spider.Cloud provides robust solutions tailored to your specific requirements.</p><h3>Getting Started: Your Websites Dashboard</h3><p>The Dashboard interface of Spider.Cloud is intuitive and neatly organized, making it easy to navigate. You start by entering a URL or uploading a CSV list of URLs to begin the data collection process. Here’s what you can expect:</p><p>**Spider Crawl**: Initiate a crawl by clicking this button after entering your URLs.</p><p>**Configure Crawl**: Customize your crawl settings as per your requirements.</p><p>**Credits and Billing**: Keep track of your available credits and monthly bill effortlessly.</p><p>The platform offers an auto-refill option to ensure you never run out of credits, streamlining your data collection operations.</p><h3>Comprehensive API Reference</h3><p>Spider.Cloud’s API is based on REST, supporting predictable, standardized HTTP response codes, authentication, and verbs. This means it’s highly flexible and can be integrated seamlessly with different systems. Here are some of the standout features:</p><p>**Multiple Domain Actions**: You can work with multiple domains per request by adding comma-separated URLs.</p><p>**Customizable**: The API is tailored for each account, allowing you to pin to specific versions and set specialized configurations.</p><h3>How to Use the API</h3><p>Using Spider.Cloud’s API is straightforward. Set your API secret key in the `<strong>authorization</strong>` header and specify the `<strong>content-type</strong>` based on your requirements — options include `<strong>application/json</strong>`, `<strong>application/xml</strong>`, `<strong>text/csv</strong>`, and more. Execute your requests through a simple and efficient process, ensuring reliable results.</p><h3>Diverse Features at Your Fingertips</h3><p>Spider.Cloud offers a wide array of features aimed at covering all aspects of web crawling and data processing. Here’s a snapshot:</p><h3>Core Features</h3><p>1. **Website Crawling** ($0.03/GB)</p><p>2. **Collecting Links** ($0.02/GB)</p><p>3. **Screenshot** ($0.06/GB)</p><p>4. **Data Pipelines** ($0.03/GB)</p><p>5. **Search** ($0.005 + $0.03/GB)</p><p>6. **Transform** ($0.0001/per request)</p><p>7. **Query** ($0.0001/per request)</p><p>8. **Proxy Mode** ($0.0001/per request)</p><h3>Add-Ons</h3><p>1. **Javascript Rendering** ($0.03/GB)</p><p>2. **AI Scraping** ($0.01/1k tokens)</p><p>3. **Data Storage** ($0.30/GB month)</p><p>4. **Metadata Processing** ($0.0005/GB)</p><p>5. **Premium Proxies** ($5.00/GB)</p><p>These features ensure that regardless of the complexity of your data collection needs, <a href="https://spider.cloud/">Spider.Cloud</a> has got you covered.</p><h3>Practical Pricing Structure</h3><p>Spider.Cloud’s pricing model is highly transparent and affordable. The base cost includes a per-GB charge for file size and a minimal fee for uptime latency. You only pay for what you use, making it incredibly cost-effective for both small-scale and large-scale operations.</p><p><a href="https://spider.cloud/">Spider.Cloud</a> makes web crawling accessible and affordable for everyone. Its comprehensive features, coupled with a user-friendly API and competitive pricing, make it an indispensable tool for anyone involved in data collection. So, why wait? Dive into the world of efficient web crawling with Spider.Cloud and elevate your data solutions to a new level.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04f652737d85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Deno could be the right tool for your next project]]></title>
            <link>https://jeffmendez.medium.com/why-deno-could-be-the-right-tool-for-your-next-project-69213534c71c?source=rss-f9c20205dc8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/69213534c71c</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[rustlang]]></category>
            <category><![CDATA[deno]]></category>
            <dc:creator><![CDATA[Jeff Mendez]]></dc:creator>
            <pubDate>Wed, 05 May 2021 12:52:11 GMT</pubDate>
            <atom:updated>2021-05-05T14:57:33.323Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently got a chance to start playing with Deno a secure runtime for javascript and typescript. My initial attraction came from using Rust and typescript as the two main weapons in my arsenal. This to me felt like it only made sense to look at how I can combine the love for both tools to achieve the need for speed on the productivity and application portion of software development. The creator of node.js is also the creator of Deno and his major focus currently is working on the deno project.</p><h3>Major Benefits</h3><p>Deno provides a great set of features that make building your application a lot smoother than your standard node project. The control you get from the initial extracting of packages allows for circle references and other nasty bugs to be less of an occurrence. Instead of having to learn each native node module we now can focus on one <a href="https://doc.deno.land/builtin/stable">doc</a> to get the majority of things done like creating new files or fetching data. Integrating with other node packages can still be done to incorporate mixed modules if needed so you are not completely locked in to the <a href="https://deno.land/x">deno-land</a> eco system for your next project. In deno at the top level everything is async which allows for minimal boilerplate for simple stand alone methods.</p><h3>Speed</h3><p>One of the things that make deno fast is that it is built with v8 and <a href="https://tokio.rs/">tokio</a>. Tokio is a async runtime for rust for interacting with the network that has zero-cost abstractions allowing bare-metal performance. Bellow is a picture comparing the HTTP server throughput amongst the top runtimes. There are many metrics to look at but, heres one of the main ones in when deciding what to use when it comes to HTTP, the bigger the number the better for the chart below.</p><figure><img alt="deno HTTP server throughput performance metrics comparing against other tools" src="https://cdn-images-1.medium.com/max/704/1*0JZ30ozs_wSOajR87rBpFw.png" /></figure><h4>Real World Production Example</h4><p>Here is a real world getting started <a href="https://github.com/j-mendez/deno-rest-starter">repo</a> that is production docker ready using oak middleware to help create a REST API in deno<strong>. </strong>The app is set to launch on ECS Fargate to scale at the systems level and at the application level has security in a couple layers with a ready to go custom instances of mongo, redis, and <a href="https://github.com/meilisearch/MeiliSearch">meilisearch</a>. The application has middle-wares to abstract concerns from validation, spam protection, body-parser, error-handling, redirects and more. The app also has a basic suite of test and automation with circleci to help with keeping things reliable. Checkout the benchmarks folder to get a gist of the speed for a couple of key metrics like concurrency.</p><h4>Learning Curve</h4><p>If you are coming from typescript getting started with deno is fairly straight forward after learning how to structure the application since the concepts of index.js is frowned upon. Theres a couple of overall project setup differences like establishing a dep.ts to control all of your application dependancies instead of package.json. Getting started with Deno can be a little confusing since theres a lot of different pieces to bring together that make the Deno runtime environment, if you need help try looking at the <a href="https://deno.land/manual">deno-manual</a>.</p><h4>References</h4><p><a href="https://deno.land/benchmarks#http-server-throughput">https://deno.land/benchmarks#http-server-throughput</a><br><a href="https://tokio.rs/">https://tokio.rs/</a><br><a href="https://github.com/j-mendez/deno-rest-starter">https://github.com/j-mendez/deno-rest-starter</a><br><a href="https://deno.land/benchmarks">https://deno.land/benchmarks</a><br><a href="https://deno.land/manual">https://deno.land/manual</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69213534c71c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Road to a Perfect Lighthouse Score]]></title>
            <link>https://jeffmendez.medium.com/the-road-to-a-perfect-lighthouse-score-fe2607719b0f?source=rss-f9c20205dc8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe2607719b0f</guid>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[web-performance]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Jeff Mendez]]></dc:creator>
            <pubDate>Sat, 06 Mar 2021 15:33:09 GMT</pubDate>
            <atom:updated>2021-03-22T17:45:34.737Z</atom:updated>
            <content:encoded><![CDATA[<h3>Perfect Lighthouse Score Guide</h3><figure><img alt="a11ywatch.com 100 google lighthouse score for performance metrics" src="https://cdn-images-1.medium.com/max/1024/1*pwIx9oKNeY1zfDLjRbzKWg.jpeg" /><figcaption>desktop lighthouse score</figcaption></figure><p>So there was a time where figuring out performance metrics across browsers would be a night and day task. Now thanks to the lighthouse team we can easily get a base standard on how our website will compare to a real world situation on performance. Lighthouse uses a mid tier device to determine the appropriate metrics for a test for a solid base target audience which gives us a good solid base.</p><h3>Why should we care about performance?</h3><p>When we are using a website for the first time we want to make sure we get the users attention and maintain their engagement. One of the most critical areas where this lies is in how fast can we get the data we need on the resource we are interacting with. With caching we sometimes overlook the initial onboarding for a new user experience, this is where keeping performance vitals can help since it treats the run as a fresh http instance to the website. This means performance in a way trickles down into every other area for an application to run effectively.</p><h3><strong>Understanding the root cause and steps needed</strong></h3><p>With performance tuning it can help to get a base understanding at how resources are managed and the underlying action being performed like external img elements fetching the resource. A lot of the resources that we initially send to the client are not in the view port and never get used if a user does not scroll to the section. So the question is do we need to send all of the resources initially?</p><p><strong>Lazy Loading</strong><br>Depending on the answers to the question we can determine if lazy loading the resource if that could be an opportunity to reduce some the payload and work done when a browser sends the code to a users client. This includes 3rd party assets and scripts. Try to use js to load heavy scripts that could be delayed until they need to be used. Like if you are using google translate load the script on hover until the user is going to perform the click action. If you have videos on your page, use a Facade and only return the video when in view port to prevent fetching the resource on load.</p><p><strong>Pre-processing </strong><br>Pre process assets using tools like <a href="https://postcss.org/">postcss</a> and <a href="https://purgecss.com/plugins/postcss.html">postcss-purgecss</a> to reduce the bloat and redundancy of js in css. Remove unused js, css, and html across your files to make sure that you are only sending code that is actually being used.</p><p><strong>Use css/html when possible</strong><br>Look at javascript as a tool that needs to be used only when css cannot achieve the underlying affect. Use html forms instead of replicating with js, try to minimize the need for js execution that runs automatically and on event.</p><p><strong>SSG/SSR</strong><br>If we can save the client from having to process code this is a big win. Try to render your webpage statically or server side. Tools like <a href="https://github.com/vercel/next.js">next.js</a>, <a href="https://github.com/gatsbyjs/gatsby">gatsby</a>, or <a href="https://github.com/getzola/zola">zola</a> make this process simpler.</p><p><strong>Use a multiple CDNs </strong><br>Put your website on a CDN and your assets to lower the bandwidth across the board. Your web-server or website is machine that could be scattered across the land to make the bandwidth lower when targeting across regions. One CDN for your resources and one CDN for the website. You want to put your resources on a CDN that way if you target anything outside your web server like a native app so your resources can be fetched. You can even place your API on a CDN in combo with a load balancer to make your network request transfer distance smaller.</p><p><strong>Optimize your Images</strong><br>Images can be quite large and a lot of times we over fetch an image compared to its usage in a website. Like a 1400x1200 img for a 60x60 badge. Optimize your images at the level where its going to be used perspectively to your application view. Also optimizing your images with tools like <a href="https://github.com/marketplace/imgbot">ImgBot</a> that use lossless compression to strip away all the unneeded space. Also using srcset to return responsive images help. Tools like <a href="https://nextjs.org/docs/api-reference/next/image">next/image</a> make this step automatic.</p><p><strong>Reverse Proxy</strong><br>Caching your HTTP <strong>GET</strong> request through a reverse proxy allows for all urls to be cached. This is different than object caching at the application level since this does not require application dependancies and all things are ran through the network layer. Usually once theres traffic above a certain threshold this approach is brought into play.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe2607719b0f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Better your web accessibility and UX productivity]]></title>
            <link>https://jeffmendez.medium.com/better-your-web-accessibility-and-ux-productivity-ab48535949d4?source=rss-f9c20205dc8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab48535949d4</guid>
            <category><![CDATA[free-software]]></category>
            <category><![CDATA[a11y]]></category>
            <category><![CDATA[web-accessibility]]></category>
            <category><![CDATA[web-accessibility-a11y]]></category>
            <dc:creator><![CDATA[Jeff Mendez]]></dc:creator>
            <pubDate>Fri, 26 Jun 2020 13:00:55 GMT</pubDate>
            <atom:updated>2021-03-06T15:45:00.775Z</atom:updated>
            <content:encoded><![CDATA[<h3>Web accessibility productivity</h3><p>Within the world of information technology, regulations are often set in place and we must inquire to understand why such enforcements are necessary. ADA compliance is one of these cases that cares to leverage a neutral experience for users that may lack accessibility issues. The Web Content Accessibility Guidelines, otherwise known as WCAG, is in part responsible for the standards of an organization that is met. These rules that get standardized by WCAG allow for efficient targeting and usability for all users. During periods of economic and technological distress, it’s important to have our information systems accessible by all and we have the WCAG open source community to thank for their contributions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*gwqwLmQ_Dm-ICBZi" /></figure><figure><img alt="man using special googles to embrace dust storm" src="https://cdn-images-1.medium.com/max/502/0*p3bK7Zl7BugBKlC4.gif" /></figure><p>Silph Scope activated</p><h3>AI to the rescue</h3><p>Thankfully, we have the technology to support this effort and find the leverage we need. A prime example of such is when we observe machine learning and the progressive development of artificial intelligence. AI has the power to apprehend common systematic issues like pages rendering slowly, user interface issues, links failing, as well as screen readers. Having real-time monitors to support such common errors is one of the things I set out to accomplish at <a href="https://www.a11ywatch.com/">A11yWatch</a>. With the rise of AI on the horizon, we at <a href="https://www.a11ywatch.com/">A11yWatch </a>provide helpful tools and services to help give you the vision you need for better accessibility. The video below is a demo and proof of concept for the application during its’ early stages of development. Here is an example of some of the features provided by A1 as it fills in alt tags and fixes some issues with contrasting colors.</p><p>example of using a custom CDN tailored for you to fix your issues</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*kjwaYVZXRY9roNBN" /></figure><figure><img alt="A11yWatch dashboard screen" src="https://cdn-images-1.medium.com/max/1024/1*R5N00sHK9NnoDx1XZZm_3g.png" /></figure><p>dashboard screen</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*Esr6SEVxDBu5ROzv" /></figure><figure><img alt="web detailed pre-view mode" src="https://cdn-images-1.medium.com/max/1024/0*_kCURfNb51GrZ7E_.png" /></figure><p>an example webpage in the website vision edit view</p><h3>The heavy lifting</h3><p>When we consider how many applications avoid ADA compliance, we bring awareness to where better accessibility is needed. It should be simple, fast, and easy to control what’s needed in order to bring a safe and pleasant experience to all users. With our monitoring service, you can get notified throughout the day if an issue arises. We built the product to provide a custom CDN that will fix a majority of your issues. We also track a record of this in order to let you know if and when issues arise. Should errors occur, they are handled and logged before more issues are able to accrue. This allows us to avoid problems stacking up and apprehends reoccurring issues within the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/60/0*H5HRbAZweH4nI04l" /></figure><figure><img alt="a11ywatch cdn page" src="https://cdn-images-1.medium.com/max/1024/0*A6sIURvFvCXhQwGT.png" /></figure><p>if a webpage has issues, use our custom CDN for your specific issues</p><h3>Conclusion</h3><p>I hope you guys take the time to consider the importance of ADA compliance and how our application allows accessibility for all users alike. Though it may seem like an unnecessary measure, it allows for products and services to be enjoyed with ease of access. Currently, the project is set to boost your products’ accessibility but does not offer services to regulate your application if it is indeed compliant with WCAG. We are working on looking into this soon. You can also visit the application at <a href="https://www.a11ywatch.com/">a11ywatch.com</a> and signup for free! The <a href="https://www.a11ywatch.com/">project</a> is being actively worked on and improving daily so stay tuned!</p><p>P.S</p><p>If you are wondering what does a11y mean? A11y is abbreviated for accessibility. Here is a cool website with the explanation as well <a href="http://mds.is/a11y/">http://mds.is/a11y/</a>.</p><p>Here’s a great article describing more information on accessibility with AI <a href="https://towardsdatascience.com/the-role-of-ai-in-web-based-ada-and-wcag-compliance-4fc09e69f416">https://towardsdatascience.com/the-role-of-ai-in-web-based-ada-and-wcag-compliance-4fc09e69f416</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab48535949d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamic SSR styling with Next.js]]></title>
            <link>https://jeffmendez.medium.com/dynamic-ssr-styling-with-next-js-5bc7eab64f2b?source=rss-f9c20205dc8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bc7eab64f2b</guid>
            <category><![CDATA[serverside-rendering]]></category>
            <category><![CDATA[static-site-generator]]></category>
            <category><![CDATA[servers]]></category>
            <category><![CDATA[dynamic-programming]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Jeff Mendez]]></dc:creator>
            <pubDate>Mon, 03 Feb 2020 23:19:31 GMT</pubDate>
            <atom:updated>2021-03-08T14:54:33.512Z</atom:updated>
            <content:encoded><![CDATA[<h3>Dynamic SSG/SSR styling with Next.js</h3><p>Server-side rendering has come in and out of popularity over the years with a weird reason for going out of the current meta. The power of rendering your content on the server brings the ultimate ability to target users regardless of their network connection, device capabilities, etc. It has a purpose way beyond being the flavor of the month and here&#39;s why.</p><h3>The problem</h3><p>The first thing that happens when a browser interacts with a domain is it checks to see if the page is in the cache to render the view that you have downloaded/been to before. Afterward, the HTML code is sent with the CSS and javascript scripts to execute to display your content which can take a couple of round trips to fully gather the assets/scripts needed for your views. This can take a long time if your network is spotty, slow or just in a remote location like the Amazon rain forest where it takes a long time for data to travel unless we are using CDNs to target broader regions (we still might have a lot of problems in the amazon with this). If your user is visiting your webpage for the first time it can take a bit of time to gather all the resources needed until its cached.</p><h3>Next.js to the rescue</h3><p>Next.js is a really powerful framework for react to render content on the server statically and dynamically. Next.js provides an <strong><em>_app </em></strong>and <strong><em>_document </em></strong>setup where your content first initially renders on the server firing methods on your <em>_document</em> file which is, in essence, the base layer that redirects all routes and API requests onto your pages. The <strong><em>_app </em></strong>file will be the initial location where your app loads on the client-side. When it comes to creating dynamic content on the server you need to make sure you mimic all client-side initial renders on the server. If you have a view that only displays on mobile devices you need to determine if its a mobile device on the <strong><em>_document </em></strong>file using different techniques since we do not have a window or DOM object to work with but, we do have metadata that is passed onto each request from the initial client interaction request. Example we can use <a href="https://github.com/faisalman/ua-parser-js">https://github.com/faisalman/ua-parser-js</a> to determine the agent/device on the server and set the appropriate conditional rendering for our tree.</p><h3>The hard part</h3><p>With great power comes great responsibility is a very true statement. Now that we see the power of <a href="https://nextjs.org/">next.js</a> app-doc link setup to render SSR pages we need to understand if we do not pass down the same variables down your component tree your page styles will break and display a very ugly page to your users. We need to make sure that our top-level component and its children can execute the first render initial the same way on the client on the server which can be very tricky. I prefer to use one object that handles all conditionals that have an init process that must be equivalent from the SSR render and client init renders. The init process is usually established in the constructor of your <strong><em>_app </em></strong>and <strong><em>_document </em></strong>javascript files.</p><h3>Cookies Ftw</h3><p>Cookies where invented to send information on every request so that information of the users state can be tracked. If we add a middle handler that can determine whether to use the document or req data from the server we can now create dynamic views very easily. The one thing we need to do is make sure to establish an initial cookie load in our constructor or componentDidMount methods of <strong><em>_app.js</em></strong> and<strong><em> _document.js</em></strong> Here is an example of a method being used inside getInitialProps establishment for <strong><em>_document.js</em></strong>. The example below using the <a href="https://github.com/faisalman/ua-parser-js">ua-parser-js</a> lib and a custom parseCookie method that can either use a cookie or the dom to extract properties. I recommend using a method without UA like checking for maxTouchPoints, theres a section on how in this <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent">article</a>.You can get very creative on how you want to store and set up your cookies for extraction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*wRUzql_iyFCFincE1AqWQw.png" /><figcaption>example on _document.js getInitialProps</figcaption></figure><h3>with-cookie package</h3><p>So all this cookie talk got me wondering what if there&#39;s a way just to use your normal data structure and automatically map the property to a cookie. Also, why can&#39;t we just retrieve the same value as a cookie without having to write verbose code? You can now with <a href="https://github.com/A11yWatch/with-cookie">https://github.com/A11yWatch/with-cookie</a>. Heres an example being used to change the theme and persist it across documents/reloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*L7q78Af2XsJZRQcE7Zjw-g.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F391719946%3Fapp_id%3D122963&amp;dntp=1&amp;display_name=Vimeo&amp;url=https%3A%2F%2Fvimeo.com%2F391719946&amp;image=https%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F856517087_640.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="640" height="286" frameborder="0" scrolling="no"><a href="https://medium.com/media/80162cb4c4b1fb965a39f99803c6a712/href">https://medium.com/media/80162cb4c4b1fb965a39f99803c6a712/href</a></iframe><p>you can also check out or fork the example project here <a href="https://github.com/A11yWatch/with-cookie-example">https://github.com/A11yWatch/with-cookie-example</a></p><h3>Dynamic SSG Styling — hardmode</h3><p>It could be really tricky to setup your pages dynamic without the ability to return headers. For this situation we use CSS media queries to determine the initial look. If you have components like <a href="https://material-ui.com/api/drawer/#css">Material UI</a>’s drawer, you would need to override the classes object on the component and set the styles attached to media quarries. On the components that you have overwrote the styling you then need to have a trigger like useEffect or componentDidMount to wipe off the extra css overrides with the initial look of the application which could be simply just assigning the props using client side detection since the page is already loaded. This is can be very complicated so weigh in the cost if it makes sense just to render the page with SSR by using getInitialProps on the component.</p><h3>Conclusion</h3><p>Ensuring your views to be fully dynamic SSR can be a challenge but using <a href="https://nextjs.org/">Next.js</a> definitely makes it a lot easier. It also does add a layer of complexity when it comes to making a simple website. While it does bring a lot to the table in a positive manner its also important to take note of the cons as well. I highly recommend putting <a href="https://nextjs.org/">Next.js</a> on a standalone server so that way it can be scaled out more efficiently since it&#39;s going to be handling a lot more work then standard client-side frameworks integrated into your application. I will go more into detail about scaling and measuring micro-services in my next article.</p><p><a href="https://jeffmendez.medium.com/the-road-to-a-perfect-lighthouse-score-fe2607719b0f">More</a><br>If you want to hear how I used next.js to get a perfect lighthouse score <a href="https://jeffmendez.medium.com/the-road-to-a-perfect-lighthouse-score-fe2607719b0f">https://jeffmendez.medium.com/the-road-to-a-perfect-lighthouse-score-fe2607719b0f</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bc7eab64f2b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>