The Panahashi backend is a Ktor application running on the Netty engine. It binds toDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/AndrewwCO/Panahashi-Backend/llms.txt
Use this file to discover all available pages before exploring further.
0.0.0.0:8080 by default and can be run directly with Gradle during development or packaged as a self-contained fat JAR for production deployments.
Prerequisites
Before deploying, make sure you have the following in place:JDK 17
The application requires Java 17 or later. Verify with
java -version.Gradle 8+
The build uses Gradle wrapper (
./gradlew). No local Gradle installation required.Firebase configured
Complete the Firebase setup guide before running the server.
Local development
Running with Gradle starts the server in development mode, which enables hot reload and verbose logging.http://localhost:8080. Confirm it is running:
The JVM flag
-Dio.ktor.development=true is set automatically when using ./gradlew run via applicationDefaultJvmArgs in build.gradle.kts. Do not set this flag in production.Building and running a production JAR
The Gradlebuild task produces a fat JAR that bundles the application and all its dependencies into a single file.
Environment variables
All configuration can be overridden at runtime using environment variables. The values inapplication.conf serve as defaults when a variable is not set.
| Variable | Default | Description |
|---|---|---|
PORT | 8080 | TCP port the server listens on |
FIREBASE_SERVICE_ACCOUNT_PATH | serviceAccountKey.json | Path to the Firebase service account JSON file |
FIREBASE_DATABASE_URL | https://panahashi-default-rtdb.firebaseio.com | Firebase Realtime Database URL |
FIREBASE_STORAGE_BUCKET | panahashi.appspot.com | Firebase Storage bucket name |
Docker deployment
The following multi-stage Dockerfile builds the fat JAR and packages it into a minimal JRE image.Using Application Default Credentials on Google Cloud
When deploying to a Google Cloud environment such as Cloud Run, GKE, or Compute Engine, you can attach a service account to the compute resource instead of shipping a key file. The Firebase Admin SDK will automatically use Application Default Credentials (ADC) from the environment.Attach a service account to your Cloud resource
In the Google Cloud Console, assign a service account with the Firebase Admin role (or equivalent Firestore/Storage/FCM permissions) to your Cloud Run service, GKE workload identity, or VM instance.
Remove the key file reference
Do not set
FIREBASE_SERVICE_ACCOUNT_PATH. When the environment variable is absent and serviceAccountKey.json does not exist on disk, the Firebase Admin SDK falls back to ADC automatically.