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.