Skip to content

kotlin-dev-studio/vitstore_api

Repository files navigation

Spring boot, Kotlin, Hibernate, Flyway, MariaDB

Architecture

We are using MVC from this reference.

Pull requests template

Please check out here.

Run the application

  • Clone project from repository git clone git@github.com:kotlin-dev-studio/vitstore_api.git

  • Build gradle in build.gradle.kts

  • Spring boot configuration:

cp src/main/resources/application-dev.yml.example src/main/resources/application-dev.yml
cp src/main/resources/application-test.yml.example src/main/resources/application-test.yml
  • Start mariadb container

Make sure stop mysql server on your machine! Required: Docker >= 19.x.x, docker-compose >= 1.25.x

# Start docker container
cd docker
docker-compose up

# Stop docker container
docker-compose down
  • Generate migration file

Rule: All the migration scripts must follow a particular naming convention - V<VERSION_NUMBER>__.sql in the folder /src/main/resources/db/migration/.

Checkout the Official Flyway documentation to learn more about naming convention.

Eg. V1__CreateTableUsers.sql

CREATE TABLE IF NOT EXISTS users(
    id bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
    username varchar(100) NOT NULL, 
    first_name varchar(50) NOT NULL,
    last_name varchar(50) DEFAULT NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  • SSH into docker container
docker exec -it vitstore_db mysql -u root -p # input password from application.yml

# Dev environment
use vitstore_dev;
select * from users;
select * from flyway_schema_history;

Klint

  • Configuration file .editorconfig reference

  • Command check and format:

./gradlew ktlintCheck
./gradlew ktlintFormat

Swagger API Document

Mailcatcher

Prevent send mail from development environment to public.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •