Book description
Craft resilient web applications with Supabase by leveraging advanced features such as authentication, data and user management, and seamless AI integration using its powerful Postgres infrastructure
Key Features
- Learn how to integrate Supabase and Next.js to create powerful and scalable web apps
- Explore real-world scenarios with a multi-tenant ticket system
- Master real-time data handling, secure file storage, and application security enhancement, while discovering the full potential of the database beyond holding data
- Purchase of the print or Kindle book includes a free PDF eBook
Book Description
Discover the powerful capabilities of Supabase, the cutting-edge, open-source platform flipping the script on backend architecture. Guided by David Lorenz, a battle-tested software architect with over two decades of development experience, this book will transform the way you approach your projects and make you a Supabase expert.
In this comprehensive guide, you'll build a secure, production-grade multi-tenant ticket system, seamlessly integrated with Next.js. You’ll build essential skills for effective data manipulation, authentication, and file storage, as well as master Supabase's advanced capabilities including automating tasks with cron scheduling, performing similarity searches with artificial intelligence, testing your database, and leveraging real-time updates.
By the end of the book, you'll have a deeper understanding of the platform and be able to confidently utilize Supabase in your own web applications, all thanks to David's excellent expertise.
What you will learn
- Explore essential features for effective web app development
- Handle user registration, login/logout processes, and user metadata
- Navigate multi-tenant applications and understand the potential pitfalls and best practices
- Discover how to implement real-time functionality
- Find out how to upload, download, and manipulate files
- Explore preventive measures against data manipulation and security breaches, ensuring robust web app security
- Increase efficiency and streamline task automation through personalized email communication, webhooks, and cron jobs
Who this book is for
This book is for developers looking for a hassle-free, universal solution to building robust apps using Supabase and its integration libraries. While a basic understanding of JavaScript is useful, it’s not essential as the book focuses on Supabase for creating high-performance web apps using Next.js. Experienced professionals from non-JavaScript backgrounds will find this book useful. Familiarity with Postgres, although helpful, is not mandatory as the book explains all the SQL statements used.
Table of contents
- Building Production-Grade Web Applications with Supabase
- Foreword
- Contributors
- About the author
- About the reviewers
- Preface
- Part 1:Creating the Foundations of the Ticket System App
-
Chapter 1: Unveiling the Inner Workings of Supabase and Introducing the Book’s Project
- Technical requirements (and some preamble)
- Understanding why Supabase is the stack you want
- Demystifying the inner workings of Supabase with Postgres
- Supabase Studio – the convenient web dashboard
- Supabase Auth (GoTrue) – the authentication handler
- PostgREST – a REST and GraphQL API for your database
- Realtime – elevating the user experience
- Storage – simple and scalable object storage
- Image Proxy – helping to transform images on the fly
- Edge Functions – completing the optimization stack
- pg-meta – an internal helper service for the database
- Kong – the overarching service orchestrator
- Introducing the production-grade ticket system project
- Summary
-
Chapter 2: Setting Up Supabase with Next.js
- Technical requirements
- Getting ready with Next.js
- Installing the Supabase CLI
- Running your first Supabase instance on your machine
- Managing multiple local Supabase instances
- Connecting to Supabase with the Supabase JavaScript client
- Connecting directly to the database
- Using Supabase with TypeScript
- Connecting Supabase to other frameworks
- Summary
-
Chapter 3: Creating the Ticket Management Pages, Layout, and Components
- Technical requirements
- Setting up Pico.css with Next.js
- Building the login form
- Visualizing the Ticket Management UI
- Creating a shared UI layout with navigation elements
- Designing the Ticket List page
- Constructing the Ticket Details page
- Implementing a page to create a new ticket
- Implementing a user overview
- Enhancing the navigation component
- Summary
- Part 2: Adding Multi-Tenancy and Learning RLS
-
Chapter 4: Adding Authentication and Application Protection
- Technical requirements
- Adding authentication protection with Supabase
- Adding a log out button
- Understanding server authentication
- Enhancing the password login
- Authenticating with magic links
- Adding password recovery
- Learning about the Site URL and redirect URLs
- Optional knowledge: adapting built-in templates
- Summary
- Chapter 5: Crafting Multi-Tenancy through Database and App Design
- Chapter 6: Enforcing Tenant Permissions with RLS and Handling Tenant Domains
- Chapter 7: Adding Tenant-Based Signups, including Google Login
- Part 3: Managing Tickets and Interactions
- Chapter 8: Implementing Dynamic Ticket Management
- Chapter 9: Creating a User List with RPCs and Setting Ticket Assignees
-
Chapter 10: Enhancing Interactivity with Realtime Comments
- Technical requirements
- Creating the comments table
- Adding a trigger to set the tenant automatically
- Adding and optimizing RLS policies
- Implementing comment creation
- Listing existing comments from the server
- Implementing Realtime comments
- Embracing additional Realtime insights and learning about potential pitfalls
- Summary
- Chapter 11: Adding, Securing, and Serving File Uploads with Supabase Storage
- Part 4: Diving Deeper into Security and Advanced Features
-
Chapter 12: Avoiding Unwanted Data Manipulation and Undisclosed Exposures
- Technical requirements
- Understanding PostgREST’s OpenAPI Schema exposure
- Being careful with current_user usage and understanding auth.role()
- Generating new Anonymous Keys, Service Role Keys, and database passwords
- Benefiting from Supabase Vault
- Utilizing silent resets to avoid data manipulation
- Enabling column-level security/working with roles
- Understanding security on views and manually created tables
- Changing the max_rows configuration
- Understanding safe-guarded API updates or deletion
- Adding middleware inside Postgres for each API request
- Using the Security Advisor
- Allowing a listing of IPs for database connections
- Enforcing SSL on direct database connections
- Summary
-
Chapter 13: Adding Supabase Superpowers and Reviewing Production Hardening Tips
- Technical requirements
- Making sense of search_path
- Familiarizing yourself with database extensions
- Adding an AI-based semantic ticket search
- Using anonymous sign-ins
- Transforming external APIs into tables with foreign data wrappers
- Using webhooks
- Understanding Edge Functions
- Using cronjobs to notify about due tickets
- Using pg_jsonschema for JSON data integrity
- Testing the database with pgTAP
- Setting the auth.storageKey to avoid migration problems
- Extending supabase.ts with custom typings
- Improving RLS and query performance
- Identifying database performance problems and bloat
- Working with complex table joins
- Reviewing the underestimated benefit of using an external database client
- Understanding migrations
- Utilizing database branching
- Disabling GraphQL or PostgREST (if you don’t need it)
- Using a dead-end built-in mailing setup
- Retrieving table data with the REST API and cURL
- Summary
- Index
- Other Books You May Enjoy
Product information
- Title: Building Production-Grade Web Applications with Supabase
- Author(s):
- Release date: August 2024
- Publisher(s): Packt Publishing
- ISBN: 9781837630684
You might also like
book
Build a Frontend Web Framework (From Scratch)
Learn how a frontend web framework works by coding your own! Web developers use frontend frameworks …
book
Microservice APIs
Strategies, best practices, and patterns that will help you design resilient microservices architecture and streamline your …
book
React Application Architecture for Production
A hands-on guide to help you develop skills and confidence in building and structuring React applications …
book
Full-Stack Web Development with TypeScript 5
Unleash the power of modern web development and master both frontend and backend development by building …