-
Query Postgres Data in the Fastest Way Possible with Covering Indexes
9th July 2024Learn how to drastically speed up your PostgreSQL queries with Covering Indexes in this comprehensive tutorial. Discover the fundamentals of Indexes, step-by-step instructions to create Covering Indexes, and how to benchmark your performance improvements. This guide transforms complex concepts into easy-to-follow steps that you can apply to your own database-driven applications.
-
How to use Indexing to Optimize your Postgres Queries
3rd July 2024Learn how to enhance PostgreSQL query performance dramatically by implementing Indexes for your database tables. Indexes are powerful tools that allow databases to retrieve data more efficiently, reducing query times significantly. This tutorial covers the basics of creating indexes, benchmarking their performance improvements, and understanding their impact on query execution. Discover practical examples and best practices to optimize your Postgres queries and improve overall application performance. Mastering indexes can transform how you manage database operations and boost the responsiveness of your database-driven applications instantly.
-
Automatically generate values for created and updated columns in Postgres
17th January 2024Audit columns help to understand when data was changed and by whom. In this article, we explore some options for automatically generating values for created_at, created_by, updated_at and updated_by columns in a postgres database table.
-
Forwarding cookies from Server Components to Route Handlers with Next.js App Router
9th July 2023When using cookies and the Next.js App Router, headers are not automatically forwarded from Server Components to Route Handlers. Thankfully, we can easily attach the headers sent from the browser to the Server Component, through to our Route Handler — making the user's auth session available throughout our entire Next.js app! 🚀
-
Use On-conflict to Upsert in PostgreSQL
9th February 2023Upserting is a convenient way to combine inserting and updating into a single idempotent statement - one that can be run multiple times with the same outcome. PostgreSQL makes this very easy with an insert statement, by using the on conflict condition.
-
Create a select trigger in PostgreSQL
2nd February 2023Triggers can be used to call a PostgreSQL function any time data is inserted, updated or deleted. But what about select? In this article, we go deep on some easy-to-copy-pasta SQL to implement our own tracking for views on blog posts.
-
Call Remix loaders on demand with useRevalidate
17th January 2023Remix loaders are functions that run server-side to fetch data before rendering a route. As of v1.10.0 the useRevalidator hook can be used to programatically call loader functions for all active routes.
-
Fix client server hydration error in Next.js
4th August 2022When conditionally rendering UI based on state that is only available in the browser, we need to dynamically import the component, and tell Next.js this should only be rendered client-side (disable SSR).
-
Create a simple cookie with Remix
6th July 2022Cookies allow state to be shared between the browser and server. In this article, we look at creating a simple cookie with Remix to display different messages based on whether the user has visited the page before.
-
Store data in a cookie with sessions and Remix
6th July 2022Sessions allow us to store arbitrary bits of json data in our cookies. Remix makes this super simple with the createCookieSessionStorage function, which creates helper functions for creating, reading and deleting sessions.
-
Use Next.js 12.2 On-Demand ISR and Supabase Function Hooks to automatically refresh stale data
30th June 2022Next.js 12.2 introduces stable on-demand Incremental Static Regeneration (ISR). In this article we look at using Function Hooks in Supabase to subscribe to changes in the database and automatically revalidate stale pages.
-
How I built the back-end for Netlify's Matterday project with Supabase
17th June 2022By using Netlify and Supabase together you save a huge amount of dev time. In this article, Jon reflects on why Supabase was the right tool to build the Matterday project!
-
Using a Row Level Security Policy to Limit the Number of Rows Inserted Per User
8th June 2022Constraints help to stop users racking up a huge AWS bill, but they also provide differentiation for monetisation tiers. In this article, we look at limiting the number of rows a user can write to a particular table, using Row Level Security access policies.
-
Add authentication to Remix and Supabase app
26th April 2022Supabase makes authentication supa simple with the Supabase UI library. In this article, we look at installing this package, wrapping our application in a magic Provider to do the heavy lifting and building a login page — allowing our users to create an account and sign in.
-
Create an isomorphic Supabase client in Remix with Environment Variables
8th April 2022Environment Variables are a way to make values globally available within the environment our code is running in - either the client's browser or on the web server hosting our app. Environment variables are often used to store secrets - such as an API key. In this article, we look at how to make our secret values available on the server — loaders and actions in Remix — and how to expose public values — such as our Supabase url and anon key — to the browser.
-
Implementing subscriptions with Stripe
19th May 2021This week we wrap up our SaaS project by building subscriptions in Stripe. We also look at building a customer portal and creating gated content in our Next.js app.
-
Processing payments with Stripe and webhooks
12th May 2021This week is all about processing card payments with Stripe. We look at creating a session and subscribing to webhooks in order to know when a user has purchased a course.
-
Social login with GitHub and Auth0 rules
5th May 2021This week is all about Auth0's awesomeness! We implement social login so our users can authenticate with an existing GitHub account, rather than creating yet another username and password for our application. We also look at implementing webhooks with Auth0 that let our Next.js app know when a new user logs in for the first time! We can use this to create a local User in our Prisma database to store additional information - such as courses they have purchased!
-
Authentication with Auth0 and Next.js
28th April 2021This week we learn about authentication and how awesome Auth0 is! We use their nextjs-auth0 library to wrap our Next.js application, which gives us access to some really nice auth helper functions. This really helps to abstract away the complexity of authentication, and let's us focus on building a really good product - what our users are paying us for!
-
Hosting on Vercel, automatic deploys with GitHub and configuring custom domains
21st April 2021This week we are focusing on all things hosting! We will step through hosting our next.js application on Vercel, automatically triggering new deploys when we make code changes in GitHub, and configuring a custom domain to fit our brand!
-
Tech stack and initial project setup
14th April 2021This week is all about choosing our tech stack and setting up our initial project. We will be using Next.js, API routes (serverless functions), Prisma, PostgreSQL with Supabase and Tailwind. The majority of our SaaS project will be static, therefore, we will be using Next's pregeneration to generate static content at build time.
-
Getting a job in the tech industry
24th June 2020Getting your first job in the tech industry can be hard! I have put together a list of things that I have found particularly useful in getting people's attention and convincing them to take the time to meet with me.
-
Using custom hooks to reduce component complexity
5th May 2020Want to learn how React hooks work? In this article we learn a bit about the built-in useState and useEffect hooks. We then look at implementing our own custom react hook that can abstract away our complex fetching and caching logic.
-
Simple caching with local storage
3rd March 2020We can massively improve the performance of our application for our users. All we need to do is stop requesting the same data over and over again, expecting our users to be entertained by a loading spinner instead of displaying them the content they are looking for! In this article we look at how easy it is to implement caching using localStorage so we can display that content faster and keep our users happy!