With the Skills You Already Have Original photo by on SpaceX Unsplash Update 10/24/18: Deploy A Backend App As An Android Engineer — Iterate Faster With Ktor There’s a lot that can be done as a mobile developer working with existing APIs to spin up a proof of concept. Although when logic needs to run constantly in the background to check data for a condition a backend app is a better fit as you don’t want to turn your mobile device into a mobile server. If you ask a backend engineer working at a startup to a medium sized company company in San Francisco you may receive the suggestion to learn Javascript (specifically Node.js), with the promise of it being quick to write once familiar with Javascript and easy to deploy. After asking a handful of Node.js developers I had the same conversation with my friend , who has been doing Node for a few years. I was expecting the same answer as she reaffirmed the above estimating it would take me ~2–3 weeks to ramp up with Javascript (Js). Then, she suggested an alternative: Fawn It‘s useful to learn Js, but you already know how to do this in Java and can build it today. Me: Fawn was right. Most Android engineers have the skills to build basic backend apps given the best practices and libraries they already have. For instance, Retrofit can be used to make network requests with RxJava to handle the stream of incoming and outgoing data and do advanced manipulations while keeping the code bloat free with Kotlin. Using this approach I’ve started deploying backend instances to collect and manipulate data from multiple APIs. I’m working with Google Cloud Platform’s (GCP) AppEngine with Firebase integration to save data that can be accessed easily from a mobile/web client. Firebase can also integrate directly with Google’s for further analytics ( ). BigQuery From Firestore to BigQuery with Firebase Functions Google Cloud Platform is easy to use once setup and insanely powerful. That said, knowing what you need to know is a research project in itself. After you have a rough outline of the steps required for your project then you can begin filtering through documentation and guides for the ones that match the end goal. The hope is that the steps and resources below save you a significant portion of time and allow you to jump right to the execution phase. Hosting a Kotlin server app appears to have more setup than what I’ve seen advertised for Node.js with “one-click” deploys as seen on , but once the process is setup with IntelliJ it takes under a minute to start the deploy. If you get into more complex computation there is also the inherit benefit of multi-threading with Kotlin/Java. Digital Ocean Overview Figuring out the required steps required a scavenger hunt. I sifted through overlapping Google and IntelliJ documentation and guides regarding AppEngine Flexible vs Standard (still unsure of the important difference, I just know Flexible integrates well with both IntelliJ and GCP), Apache and Maven integration, Java website hosting, etc. None of the notes simply outlined how a Kotlin/Java needs to be formatted in order to be hosted onto a server. Once the app logic is finished build a file which is what will run on the server. .JAR Once the file is built you can test whether it runs successfully locally in IntelliJ. .JAR Deploy a file to the server with deployment configurations which will run on the server until paused or stopped. .JAR Now into the details… which takes less than 1 minute to setup a redeploy. The good news is after an app is setup for the first time you can skip to Step 4: Managing The Server Setup Local Development Environment — Step 1 of 4 GCP AppEngine Setup 1. Follow the steps for Install the latest Cloud Tools… a) Unzip directory and store in Library directory > call one level outside of cloud directory. ./google-cloud-sdk/install.sh b) Restart Terminal for commands to work. gcloud 2. Install App Engine and Login. sudo gcloud components install app-engine-java ... gcloud auth application-default login IntelliJ Configuration Follow the steps under Configuring your development environment . (Make sure to download the IntelliJ plugin and restart). Use an existing gradle or maven project in IntelliJ or create a new IntelliJ project Google Cloud Tools Create GCP Project And Integrate With IntelliJ — Step 2 of 4 GCP Setup Create under New Project GCP console with Quickstart steps and ensure Billing is enabled for the project. Integrate With IntelliJ Setup normal Java build configuration under with Edit Configurations projectModuleName_main. Either enable current open project with GCP, start a new one , or use an existing project from a GitHub repo. choose AppEngine > select to create when given the choice and make sure it’s under > when adding framework support choose (not _ or _ ) For current open project: Tools > Google Cloud Tools > Add AppEngine Support > Google Flexible .yaml src/main/appengine/app.yaml projectModuleName projectName main projectName test app.yaml If the app is handling a task in order to populate data for a backend service that does not process user network requests than making sure only one instance is running is important. Otherwise multiple instances can populate the backend with duplicate data. (see ) Configuring your App with app.yaml manual_scaling:instances: 1 Generate Deployable JAR — Step 3 of 4 Packaging the application in a JAR > > > > > > File Project Structure Project Settings Artifacts + Jar From modules with dependencies… : Module projectModuleName_main : MainClass YourMainClassWithMainMethod Manifest: src/main/ manifestName _jar Output directory: projectName /out/artifacts/ jarName Build and run JAR Build > > > Build Artifacts… Action Build Run Jar: > : and select JAR Application ( > > ) Run Edit Configurations + Before launch: + Build Artifacts artifactName Configure And Deploy to GCP — Step 4 of 4 Deployment Configuration : Deployment archive yourPathRoute/projectJarName.jar : select from GCP Project select from file path app.yaml: Run! Debugging It may fail the first time if Billing is not set up > click the link in the output and enable Billing. (7/25/2018) There is a bug in the deploy process with AppEngine if there is a .json file used in the app. AppEngine will not process .json files included in the .jar despite the .jar reading the files successfully when being ran on it’s own in IntelliJ. I’ve outlined a involving creating an object and converting it to json using the . This is relevant when needing to use .json files to authenticate services such as Firebase. workaround on Stackoverflow Gson library Managing The Server You can control your server in the under > Start/Stop server: Google Cloud Console AppEngine Versions. Redeploy future versions Stop the current version of the server app under > AppEngine Versions. Under which will rebuild the . Build > Build Artifacts… > Rebuild JAR. Deploy with same AppEngine configuration above since it should be pointing to the same path. .JAR Scaling AppEngine will take care of scaling automatically so it is important to understand the and monitor the app if you are doing more than just prototyping. pricing I’m Adam Hurwitz — hit the clapping hands icon and check out the rest of my writing if you enjoyed the above. Thanks for reading! Resources GCP Install the latest Cloud Tools… Quickstart GCP console How Instances are Managed Configuring your App with app.yaml AppEngine Pricing IntelliJ Configuring your development environment Creating a new App Engine project Adding (GCP) Framework Support (to IntelliJ) Creating a new (IntelliJ) application (to use with GCP) Checking out an existing (IntelliJ) project (to use with GCP) JAR Packaging the Application in a JAR Deploying to the App Engine Flexible Environment Firebase From Firestore to BigQuery with Firebase Functions Online Communities stackoverflow.com/questions/tagged/google-cloud-kotlin Cloud Kotlin Google Group Google Cloud Platform Support GoogleCloudPlatform/kotlin-samples G / oogleApis google-cloud-java / GoogleCloudPlatform app-gradle-plugin