Skip to main content

Introduction

Let’s discover Ib-Spring in less than 5 minutes 😉

What is Ib-Spring?

Ib-Spring is a framework based on spring that we use at Ibonia. It is a layer of code conventions and software architecture above Spring. We added that layer to implement Domain Driven Design (DDD) in our projects as well as good coding practices.

The key features of the framework are:

  1. Authentication & Authorization
  2. Data encryption
  3. Aggregate Root implementation as per DDD
  4. Code scaffolding

Get started

Get started by creating your first Ib-Spring project.

What you’ll need

To use Ib-Spring you need :

  1. Java 17 and you need to set JAVA_HOME variable.
  2. Node 18.19.0
  3. NPM 10.2.3
  4. Yarn (Only if you want to use yarn as your package manager instead of npm)
  5. Git
  6. Maven

Moreover, you “need” a knowledge of Java, Maven, Spring, JPA, and Next with App router.

Create your first project

Before Going further, you need to install the CLI that will help you initialize an Ib-Spring project and will do the scaffolding.

Ib-scaffold CLI

First, you need to install the ib-scaffold CLI.

npm i -g ib-scaffold

or

yarn add ib-scaffold -g

Once you installed the CLI, you can verify the installation by running

ib-scaffold --version

Create project

Once you have installed the CLI, you can create a new project by running

ib-scaffold --new MyProject

You will notice a folder my-project (the project name into Kebab Case) in your working directory. That folders contains the spring project, and inside the latter, you can find a front folder which contains the front end side, made with Next.

Set up your environment

Go to

src/main/resources/env.properties

Configure your variables

PROD_DATABASE_URL=
PROD_DATABASE_USER_NAME=
PROD_DATABASE_USER_PASSWORD=

DEV_DATABASE_URL=
DEV_DATABASE_USER_NAME=
DEV_DATABASE_USER_PASSWORD=

PROD_SMS_APP_URL=
PROD_SMS_APP_LOGIN=
PROD_SMS_APP_PASSWORD=

DEV_SMS_APP_URL=
DEV_SMS_APP_LOGIN=
DEV_SMS_APP_PASSWORD=

TEST_SMS_APP_URL=
TEST_SMS_APP_LOGIN=
TEST_SMS_APP_PASSWORD=

AES_KEY=key
SERVER_PORT=8080

PROD_FRONTEND_BASE_URL=
DEV_FRONTEND_BASE_URL=http://localhost:3000
TEST_FRONTEND_BASE_URL=http://localhost:3000

After that, load the script default.sql (inside the database folder) into your database to get the default structure, plus the default user.

{
"username": "admin",
"password": "Admin_007"
}

Run your project

You can run spring with (Dev profile)

mvn spring-boot:run -Pdev # in the project root

And you can run next with

npm run dev # inside the fron folder

Congrats ✨, now you can start using the framework and generating codes using ib-scaffold CLI.