Javacodegeeks iconJavacodegeeksSep 22, 2026 ~6 min source read

How to build a simple Spring Boot CRUD API using Supabase’s PostgreSQL

A practical walkthrough showing how to connect a Spring Boot application to the managed PostgreSQL database provided by Supabase, create an employees table with sample rows, and set up the minimal Maven dependencies and application properties you need to run basic CRUD operations with Spring Data JPA.

Spring Boot CRUD Operations with Supabase

Share this story

Send the public story page.

Useful takeaways from this story.

Supabase exposes a managed PostgreSQL database, so Spring Boot connects to it using the standard PostgreSQL JDBC driver and Spring Data JPA.

Create the employees table in Supabase with BIGSERIAL id, unique email, and a few sample rows to test GET endpoints immediately.

Add three Maven dependencies (spring-boot-starter-web, spring-boot-starter-data-jpa, postgresql runtime) and configure datasource properties in application.properties to point to Supabase.

This tutorial shows the minimal, practical steps to build a Spring Boot CRUD REST API that uses a PostgreSQL database hosted on Supabase. Because Supabase provides a standard PostgreSQL instance, the Spring Boot stack (JDBC driver + Spring Data JPA) connects the same way it would to any Postgres server.

Supabase combines a managed PostgreSQL database with optional services (auth, storage, realtime). For a Spring Boot backend that only needs persistent storage, the important detail is that the database is PostgreSQL, so you can use your usual Spring Data JPA approach and the PostgreSQL JDBC driver.

Create a Supabase project and database

  • Sign up at Supabase and create a new project. Choose a name, set a database password, and pick a region.

Define the employees table and add test data

Use the Supabase SQL Editor to create the employees table with this SQL (as shown in the tutorial):

email VARCHAR(150) NOT NULL UNIQUE,

Create a Spring Boot application (Java 17+ recommended) and add these Maven dependencies:

  • spring-boot-starter-web — for REST API and HTTP handling
  • spring-boot-starter-data-jpa — for JPA repositories and Hibernate support
  • org.postgresql:postgresql (scope runtime) — PostgreSQL JDBC driver used at runtime

These three dependencies are sufficient for a simple CRUD API that uses Spring Data JPA repositories and standard REST controllers.

Add database connection properties to src/main/resources/application.properties and replace placeholders with your Supabase values:

spring.datasource.url=jdbc:postgresql://YOUR_HOST:5432/postgres spring.datasource.username=YOUR_USERNAME spring.datasource.password=YOUR_PASSWORD spring.jpa.hibernate.ddl-auto=validate

spring.jpa.properties.hibernate.format_sql=true

The tutorial uses ddl-auto=validate to ensure mappings match the existing schema. Showing SQL is enabled to help with local debugging.

With the table in place and the Spring Boot app wired to Supabase via JDBC, you can implement a standard JPA @Entity for employees, a Spring Data repository, and REST controller methods to create, read, update, and delete employee records. The article keeps the architecture intentionally simple and uses only Spring Web, Spring Data JPA, and the PostgreSQL driver — no additional frameworks.

  • Replace placeholders with secure environment-based configuration for credentials.
  • Implement the Employee entity, repository interface, and REST endpoints for CRUD operations using Spring Data JPA.
  • Load test data in Supabase or run integration tests that target the Supabase database connection.
  • Consider Supabase features (auth, storage, realtime) if you need them beyond simple persistence.

More context around this story.

Introduction to Solon
Feedblitz iconFeedblitzSep 21, 2026

Introduction to Solon

Learn the fundamentals of Solon, including its architecture, dependency injection, configuration, HTTP handling, persistence, and testing, and see them in practice by building a REST API with MyBatis-Flex and H2. The post Introduction to Solon first appeared on Baeldung .

Spring Boot REST Docs Example
Javacodegeeks iconJavacodegeeksSep 22, 2026

Spring Boot REST Docs Example

Spring Boot REST APIs are commonly documented using tools such as Swagger/OpenAPI. Another useful option is Spring REST Docs, which generates API documentation from tests. In this article, we will create a simple Spring Boot REST API and use Spring REST Docs to document it. The example uses a small Product API so that

Loading more related stories...

Keep reading in the app

Open the app view to save this story, compare related coverage, and continue from the same source.

Open in app