MFS401 : Table of Contents

Chapter 3

Lesson 2

API Odyssey: REST, GraphQL, and the Art of API Navigation

Foundational

Database connection options (direct, pooling, APIs)

GraphQL Basics

Integrate Typescript using Supabase’s type generation

Advanced

Unstructured data storage

Quiz it to win it

Take the quiz

3 Questions
11 XP

As we have seen so far, Supabase uses Postgres as the underlying database for its services. Aligned with its open-source-first philosophy, Supabase also ensures that the database can be used at its purest form. While Supabase spawns and maintains the database for a project, the developer has the freedom to choose from a wide range of options to interact with the database.

A direct connect to the Database


We can connect to the Postgres database in Supabase directly with the database credentials. When creating the project, Supabase asks the developer to select a database password. We can use that password along with host, port, user, and the database name, to connect to the database directly. There are plenty of platforms to connect to a Postgres database. One of the most popular and recommended in pgAdmin.

We can also use libraries such as node-postgres to directly connect to the database in a Node.js project. We may also use a database ORM (such as Prisma) to interact with the database. ORMs often provide additional type safety and a powerful query API to interact with any database.

Connection pooling in a database


Connecting directly to the database is definitely flexible and powerful. Nonetheless, establishing a connection with the database is an expensive operation in time and resources for the database. Databases also have a limited number of connection slots. Optimizing database connection requests is even harder in a serverless application, since for each serverless invocation, it may require multiple temporary connections. This is where connection pooling comes in handy.

Get started for free today!

No commitments. No contracts. Enjoy all features for a day — join in just three clicks!

No credit card required.

Quiz it to win it

Complete this quiz successfully to proceed to the next lesson and win upto 11XP.

Start quiz for this lesson

Completing this quiz will get you

+11 Experience Points

+5% course progress