Ktor Plugin to simplify connecting ktor to firebase admin

License

Firetor

Firetor is Ktor plugin to help you simplified connecting to firebase admin

Dependency

Firetor was distributed through jitpack and this sample is using gradle.kts file.

Configured this code in build.gradle.kts

repositories {
    ...
    maven("https://jitpack.io")
}
dependencies {
    ...
    implementation("com.github.KylixEza:firetor:$firetor_version")
}

firetor_version depends on released tag, you can check released tag in jitpack banner above.

Setup

This is some steps to configure Firetor:

  • Go to your firebase console
  • Create new project
  • Go to project dashboard and choose Project Settings
  • Choose Service accounts tab and click button Generate new private key
  • Save admin key into proper folder
  • Moved that admin key to resource folder in your Ktor Project
  • Create new Kotlin file in plugins package named Firetor

Firetor.kt

fun Application.configureFiretor() {
    install(Firetor) {
        setAdminKey("your-admin-key-file-name.json")
        setBasicConfiguration {
            //Setup other Firebase Options configuration manually
        }
    }
}
FunctionParametersParameter TypeExampleMandatory
setAdminKey()fileNameString“firetor-sample-admin-key.json”Yes
enableFirebaseStorage()bucketUrlString“firetor-sample.appspot.com”No
setBasicConfiguration()configFirbaseOptions.Builder.() -> FirebaseOptions.Builder?setDatabaseUrl(“”)No

Application.kt

fun main() {
    ...
}

fun Application.module() {
    ...
    configureFiretor()
}

Firetor still has access to configure other firebase options such as setDatabaseUrl, setThreadManager, setGoogleCredendtials, etc. But you need to setup that manually through setBasicConfiguration() function and you can write your own code as stated in firebase’s documentation

Features

Contributing

Please fork this repository and contribute back using pull request.

Any contributions, large or small, major features, bug fixes, are welcomed and appreciated but will be thoroughly reviewed .

Contact

kylix-eza-saputra-1bb1b7192
k_ylix
#Kylix3272

Don’t forget to ⭐ this repository to motivates me to share more open source library

GitHub

View Github

Leave a Reply

Your email address will not be published. Required fields are marked *