Skip to content

justedlev/spring-boot-firebase-admin

logo

Spring Boot Firebase Admin

language framework Maven Central license issues stars

📋 About

A lightweight and production-ready Spring Boot starter for seamless integration with Firebase Admin SDK.

This project simplifies Firebase configuration in Spring Boot applications by providing auto-configuration, sensible defaults, and flexible credential management.

🍃 Spring Boot Compatibility

Version Spring Boot Status
0.x.x 3.5.x ⚠️ Beta
1.x.x 2.7.x N/A
2.x.x 3.5.x N/A
3.x.x 4.x.x N/A

✨ Features

  • ✅ Auto-configures FirebaseApp
  • ✅ Provides ready-to-use beans:
    • FirebaseAuth
    • FirebaseDatabase
    • FirebaseMessaging
  • ✅ Supports multiple credential sources:
    • classpath
    • filesystem
  • ✅ Modular and extensible design
  • ✅ Works with multi-module Spring Boot projects
  • ✅ Minimal configuration required

📦 Usage

Maven

<dependency>
    <groupId>io.github.justedlev</groupId>
    <artifactId>firebase-spring-boot-starter</artifactId>
    <version>0.1.0</version>
</dependency>

⚙️ Quick Start

  1. Add configuration
firebase:
  apps:
    default:
      project-id: <your-project-id>
      auth:
        enabled: true
      db:
        enabled: true
      messaging:
        enabled: false
  1. Inject Firebase beans
@RestController
@RequestMapping("/demo")
@RequiredArgsConstructor
public class DemoController {
    private final FirebaseAuth firebaseAuth;

    @GetMapping("/firebase/status")
    public String status() {
        return "Firebase initialized: " + (firebaseAuth != null);
    }
}

📚 Configuration Reference

Warning

Property marked * is required

Note

By default, you can use the predefined FirebaseApp properties using firebase.apps.default.*

Property Description Default
firebase.enabled Enable Firebase integration true
firebase.apps.<app-name>.name* Unique name for the Firebase app [DEFAULT]
firebase.apps.<app-name>.database-auth-variable-override The value to use for the auth variable in the security rules for Realtime Database actions. -
firebase.apps.<app-name>.database-url The Realtime Database URL to use for data storage. https://${firebase.apps.default.project-id}-default-rtdb.firebaseio.com
firebase.apps.<app-name>.project-id* Firebase project ID -
firebase.apps.<app-name>.storage-bucket The full name of an existing Google Cloud Storage bucket, excluding any protocol prefixes -
firebase.apps.<app-name>.service-account-id Service account email address string -
firebase.apps.<app-name>.credentials* Credentials used to authenticate the SDK file:${user.home}/.firebase/${firebase.apps.default.project-id}.json
firebase.apps.<app-name>.connect-timeout Connect timeout -
firebase.apps.<app-name>.read-timeout Read timeout -
firebase.apps.<app-name>.write-timeout Write timeout -
firebase.apps.<app-name>.auth.enabled Enabling FirebaseAuth bean false
firebase.apps.<app-name>.db.enabled Enabling FirebaseDatabase bean false
firebase.apps.<app-name>.messaging.enabled Enabling FirebaseMessaging bean false

Tip

When firebase.apps.<app-name>.database-url is configured, the firebase.apps.<app-name>.db.enabled property is not required.

🤝 Contributing

Please see CONTRIBUTING.md

📄 License

This project is licensed under the Apache License 2.0.

⚠️ Disclaimer

This project is not affiliated with or endorsed by Google Firebase or Spring.

⭐ Support

If you find this project useful:

  • ⭐ Star the repository
  • 🐛 Report issues
  • 💡 Suggest features

About

A lightweight Firebase Admin SDK integration for Spring Boot

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages