A sample skeleton backend app built using Spring Boot kotlin, Expedia Kotlin Graphql, Reactive Web that can be deployed to Google App Engine Flexible environmennt

Overview

spring-kotlin-gql-gae

This is a sample skeleton of a backend app that was built using:

This app can be deployed on Google AppEngine Flex environment with a Google Cloud SQL(MySQL) database.

Getting Started

Running Locally

This section will cover the changes you will need to make to run the project locally.

Clone the project

After cloning the project open it using your favourite IDE. I recommend you InteliJ by Jetbrains

Install Mysql ( Mac OS) ( 🚨 ) Important Step

Install mysql on your machine using homebrew and create a database. I found this post very useful and with all of the information you will need to do that. Note: Remember to record the USER_NAME, PASSWORD and DATABASE_NAME you will create. You will need it later.

Installation TLDR; ( Do the following on your terminal)

  1. brew install mysql
  2. brew services start mysql
  3. mysql_secure_installation
  4. mysql.server start
  5. mysql -u root -p
  6. mysql> CREATE DATABASE <DATABASE_NAME>;
  7. mysql> CREATE USER '<USER>'@'localhost' IDENTIFIED BY '<PASSWORD>';
  8. mysql> GRANT ALL PRIVILEGES ON <DATABASE_NAME>.* TO '<USER>'@'localhost';
  9. mysql> exit

Configure the Database Connection on the project

  1. Open the project then the file **application.yml). The file is located at src/main/resources/application.yml
  2. Edit the spring configuration for the dev profile by adding the information about how to connect to your database
spring:
  config:
    activate:
      on-profile: dev
  r2dbc:
    initialization-mode: always
    url: r2dbc:mysql://localhost:3306/<DATABASE_NAME>
    username: <USER>
    password: <PASSWORD>

Run the application

You can run the application by executing the main function inside the SampleApplication.kt file or by executing the bootRun task that can be accessible through the tasks panel of your IDE if you are using InteliJ.

As it is mentioned on this page, after running the application you will get the following default routes:

Your newly created GraphQL server starts up with following preconfigured default routes:

/graphql - GraphQL server endpoint used for processing queries and mutations /subscriptions - GraphQL server endpoint used for processing subscriptions /sdl - Convenience endpoint that returns current schema in Schema Definition Language format /playground - Prisma Labs GraphQL Playground IDE endpoint

Go to playground and test

If all of your configurations are correct, you should now be able to have the GraphQL explorer by typing the following address on your browser: ***http://localhost:8080/playground.

This will open a Graphql IDE which will allow you to execute your GraphQL Operations and see your schema documentation.

Here are some of the things you can do with what we have setup now:

Create an Account

mutation CreateAccount($input: CreateAccountInput!) {
  createAccount(input: $input){
    account {
      firstName
      lastName
      email
      createdAt
      id
    }
  }
}

*Load an account by Id

query GetAccount($id: ID!) {
  account(id: $id) {
    firstName
    lastName
    email
    createdAt
  }
}

Building your own schema

To build your own schema I recommend you follow the documentation that can be found here. I found that part of the process very clear and as a result I see no need of repeating the steps here.

You might also like...
Spring-with-maven - Spring Boot App with Postgresql and maven

Spring Boot Api Aplikasi ini dibuat menggunakan bahasa kotlin dan untuk database

Android login spring - Android login against spring backend

Android Jetpack Compose login implementation with JWT tokens against our own bac

Kotlin-GraphQL-Apollo - Sencillo cliente para consumir una API GraphQL con Apollo usando Kotlin
Kotlin-GraphQL-Apollo - Sencillo cliente para consumir una API GraphQL con Apollo usando Kotlin

Kotlin GraphQL Apollo Sencillo cliente para consumir una API GraphQL con Apollo

GraphQL Jetpack - A collection of packages for easily writing Java GraphQL server implementations

GraphQL Jetpack A collection of packages for easily writing Java GraphQL server

Mock up social media android application created to interact with a backend Java server using GraphQL.

The Community Board Project Authorship: author: dnglokpor date: may 2022 Project Summary: The Community Board Project consists of a Java Spring Boot b

Maintenance mode library for spring boot web and security projects.

spring-boot-starter-maintenance spring-boot-starter-maintenance is a maintenance mode library for spring boot web and security projects. Download Grad

Spring Boot built using Kotlin, H2, Postgres, Hibernate and JPA

Spring-Boot-Kotlin-Sample Spring Boot built using Kotlin, H2, Postgres, Hibernate and JPA Getting Started Reference Documentation For further referenc

This is a skeleton project for Zircon users that can be used to get started with Zircon.
This is a skeleton project for Zircon users that can be used to get started with Zircon.

Zircon Kotlin Skeleton Project This is a skeleton project for Zircon users that can be used to get started with Zircon. Getting started This project w

Candroid Browser is a replacement web browser for Candroid. It is designed to replace the AOSP browser, but not Google Chrome. It will be based on a privacy friendly WebKit engine fork.
Candroid Browser is a replacement web browser for Candroid. It is designed to replace the AOSP browser, but not Google Chrome. It will be based on a privacy friendly WebKit engine fork.

Candroid Browser Candroid Browser is a replacement web browser for Candroid. It is designed to replace the AOSP browser, but not Google Chrome. It wil

Comments
  • Add additional mysql instructions to README

    Add additional mysql instructions to README

    Add the following:

    1. brew install mysql
    2. brew services start mysql
    3. mysql_secure_installation
    4. mysql.server start
    5. mysql -u root -p
    6. mysql> CREATE DATABASE <DATABASE_NAME>;
    7. mysql> CREATE USER '<USER>'@'localhost' IDENTIFIED BY '<PASSWORD>';
    8. mysql> GRANT ALL PRIVILEGES ON <DATABASE_NAME>.* TO '<USER>'@'localhost';
    9. mysql> exit

    The key piece missing was to create the user with 'userid'@'localhost'. The @localhost bit was critical

    opened by DanielJette 1
Owner
Dario Mungoi
Senior Android Developer @Shopify
Dario Mungoi
Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

Template to accelerate the creation of new apps using Spring Boot 3, MongoDB & GraphQL.

André Ramon 1 Feb 13, 2022
Michal Kubele 0 Jan 6, 2022
My personal template for a Spring Boot REST reactive webapp

My personal spring boot kotlin reactive template Features Spring Security implementation with JWT access and refresh token MongoDB database Project Co

Dušan 2 Dec 1, 2021
Event-driven application uses React, reactive Spring Boot WebFlux, R2DBC, MySQL and Liquibase

Product delivery Event-driven application uses React, reactive Spring Boot WebFlux, R2DBC, MySQL and Liquibase Status: IN PROGRESS if [[ "" != `docker

Maksim Kostromin 2 Aug 17, 2022
An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL

graphql-kotlin-spring-server An application that simulate the Swedish Transport Agency, implemented with Spring Boot, Kotlin and GraphQL Running the s

null 0 Oct 31, 2021
GraphQL for Java with Spring Boot made easy.

GraphQL for Java with Spring Boot made easy.

Netflix, Inc. 2.5k Jan 9, 2023
Victor Hugo 1 Feb 2, 2022
Reactive setup with Spring WebFlux , Kotlin, Postgres and Spring Data R2DBC

Reactive Spring with Kotlin and Pg Spring WebFlux with Netty instead of Spring Web with Tomcat Mono and Flux in all layers (controller, service, repo)

Bimal Raj Gyawali 7 Dec 9, 2022
Shoppe - Kotlin and Ktor app, which can easily be deployed to Heroku

[ ?? Work in progress ??‍♀️ ⛏ ?? ??️ ?? ?? ?? ] Shoppe Kotlin Multiplatform App

Adrian Witaszak 33 Jul 12, 2022
Aagent-new-service-parent - A Springboot Rest Webservice Project that can be deployed to a Docker container

Webservice in a Docker Container A Springboot Rest Webservice Project that can b

ReeceRiley-aa 0 Jan 4, 2022