Create a SpringBoot, Flyway project in a couple of minutes on Github
Tags: productivity, java, springboot, flyway
Published: 2020-02-12 08:39:08

---
title: Create a SpringBoot, Flyway project in a couple of minutes on Github
published: true
description: You can help your productivity by reusing a base project with all the configurations in place
tags: productivity, java, springboot, flyway
---
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/f4v1r4955elvc5evkst1.png)
<u>WHY?</u>
Starting a new project from scratch is a awesome feeling, and a daunting one when you think of ALL of the configurations, installing you need to do. I was there a lot of times and decided to create a GitHub Template repository for a SpringBoot project that uses Flyway migrations, PostgreSql and Java (at least version 11, but will go with 8 as well) and Maven.

<u>HOW?</u>
The process is straight forward, you create a new repository and work on your project as you would normally do. The difference is when you decide that this is the base of any project with these technologies, then you can keep this snapshot and flag the repository as a "Template Project".
From this moment on, you can Fork, download locally etc and continue with your development but know you can always come back to the base in the future. For me personally this is great, because I spend less time on redundant tasks and more on creating and implementing useful features.

<u>ABOUT THIS PROJECT</u>
The project returns a list of remote developers and lets you search in the list by first name. This was arbitrary for me to choose and you will need to rename and create new objects as needed.

Requirements:
- Java installed. I used Java 11
- Postgresql driver installed
- A terminal (GitBash etc)
- An editor (IntelliJ etc)
- A data scheme already created with name: postgres

<b>Steps for getting started with it in Windows:</b>
1. git clone https://github.com/gabrielaradu/MyTemplateWithSpringAndPersistence.git
2. Add env variables for:
REMOTEDEV_M_DB_SERVER: localhost
REMOTEDEV_M_DB_USER: postgres
REMOTEDEV_M_DB_PASS: admin 
REMOTEDEV_M_DB_PORT: 5433

3. Import/Open your project in your editor
4. Create SpringBoot application config with below details if you want to run the project from outside of a command line
Main Class: com.remote.developers.TemplateProjectApplication
JRE: 11

For more information on how to create more development environments in the project checkout this post: https://dev.to/gabriela/spring-boot-rest-api-and-flyway-migrations-a3a

Try running the unit tests and the integration tests that already exist. They should pass, by the way :)

Flyway is already configured and your first table will be created when running the application. The script is in resources/db.migration/V1__InitDatabase.sql After successfully running the application, an entry will be added in the table "flyway_schema_history". For much more details about Flyway please check their docs: https://flywaydb.org/

5. When you want to add more endpoints you need to allow them in the WebSecurityConfiguration class specifically or else you will get a HttpsStatus 404 back on trying to reach them.

<b>All the names and credentials from above should be renamed and made more complex and unique for your project.</b>

Code can be found here: https://github.com/gabrielaradu/TemplateWithSpringAndPersistence

<u>WHAT'S NEXT?</u>
In time you can add as much functionality as you want. It's your call. 
Happy coding.