A simple Spring Boot REST API for managing Todo items backed by Google Firebase Firestore. The project demonstrates a layered architecture with optional Firebase ID token authentication.
- Java 17
- Spring Boot 3.4
- Firestore via Firebase Admin SDK
- Layered design: controller → service → repository → Firestore
- Java 17
- Maven
- A Firebase project and service account JSON key
- In Firebase Console go to Project Settings → Service Accounts and generate a new private key JSON.
- Save the file and export the path:
- macOS/Linux:
export GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/service-account.json
- Windows PowerShell:
$env:GOOGLE_APPLICATION_CREDENTIALS="C:\path\service-account.json"
- macOS/Linux:
- Edit
src/main/resources/application.yml
and setfirebase.project-id
to your project id. - Run the application:
./mvnw spring-boot:run
To enable authentication, set security.enabled=true
in application.yml
. When enabled, all requests must include a Firebase ID token in the Authorization: Bearer <token>
header. The UID from the token is used as the userId
for stored todos.
curl -X POST http://localhost:8080/api/todos \
-H "Content-Type: application/json" \
-d '{"title":"Buy milk","description":"2%","priority":"HIGH","dueDate":"2025-08-20T00:00:00Z"}' -i
curl "http://localhost:8080/api/todos?status=OPEN&limit=5"
curl http://localhost:8080/api/todos/{id}
curl -X PUT http://localhost:8080/api/todos/{id} \
-H "Content-Type: application/json" \
-d '{"title":"Buy bread","description":"Whole grain","status":"IN_PROGRESS","priority":"MEDIUM"}'
curl -X PATCH http://localhost:8080/api/todos/{id} \
-H "Content-Type: application/json" \
-d '{"status":"DONE"}'
curl -X DELETE http://localhost:8080/api/todos/{id} -i
- Search parameter
q
performs a simple case-insensitive contains filter on title/description after fetching results from Firestore. - Pagination uses a base64 encoded page token of the last document id.
- Time fields use ISO-8601 instants.