Skip to content

Instantly share code, notes, and snippets.

@Dileesha-abilash
Last active July 10, 2026 09:02
Show Gist options
  • Select an option

  • Save Dileesha-abilash/619fac34fca41ee546b79c583331ed34 to your computer and use it in GitHub Desktop.

Select an option

Save Dileesha-abilash/619fac34fca41ee546b79c583331ed34 to your computer and use it in GitHub Desktop.
Easy Tour Server Build and Configuration Process

Easy Tour Application API Documentation

Prerequisites

Before running the application, make sure the following software is installed on your machine:

  • Java Development Kit (JDK) 17
  • Gradle (Wrapper included in the project)

Installation & Setup

1. Install Java 17

Download and install Java 17 from the official website:

https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html

Verify the installation:

java -version

Expected output:

openjdk version "17"

2. Build the Project

Navigate to the root directory of the project and run:

./gradlew build

For Windows:

gradlew.bat build

3. Run the Application

Start the Spring Boot application using:

./gradlew bootRun

For Windows:

gradlew.bat bootRun

Project Configuration

Application configurations can be modified in the following file:

src/main/resources/application.yml

Database Configuration

Configure the datasource connection:

spring:
  datasource:
    url: jdbc:mysql://{ip}:{port}/{database_name}
    username: {username}
    password: {password}

Example

spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/app_db
    username: root
    password: password

File Upload Configuration

Configure multipart upload limits:

spring:
  servlet:
    multipart:
      max-file-size: 5MB
      max-request-size: 30MB
Property Description
max-file-size Maximum allowed file size per upload
max-request-size Maximum total request size

JWT Configuration

Configure JWT authentication settings:

jwt:
  secret: "custom_secret_64_characters"
  access_token_duration: 120000
  refresh_token_duration: 7776000
Property Description
secret Secret key used for JWT signing
access_token_duration Access token expiration time (seconds)
refresh_token_duration Refresh token expiration time (seconds)

File Storage Configuration

Configure upload directories:

file:
  upload-dir: "/var/www/uploads/"
  expenses-dir: "expense_receipts"
  activity-dir: "activity_receipts"
Property Description
upload-dir Base directory for uploaded files
expenses-dir Folder for expense receipt uploads
activity-dir Folder for activity receipt uploads
Note : Need to have necessary permission to access the directories double check the directory before production

Notification Configuration

Configure notification endpoint security:

notification:
  endpoint-key: "secret"
Property Description
endpoint-key Secret key required to send notifications

Server Configuration

Configure the application server port:

server:
  port: 4009

Notification API

Send Notification

Endpoint

POST /notifications/send

Required Headers

Header Description
X-TENANT-ID Tenant identifier of the target user

Example:

X-TENANT-ID: 0

Request Body

{
  "title": "Title Sample",
  "body": "Testing notification message",
  "userId": 1,
  "providerType": "activity_provider",
  "endpointKey": "secret_key"
}

Request Parameters

Field Type Description
title String Notification title
body String Notification message body
userId Integer Target user ID
providerType String Notification provider type
endpointKey String Secret key required for authentication

Example cURL Request

curl --location --request POST 'http://localhost:4009/notifications/send' \
--header 'Content-Type: application/json' \
--header 'X-TENANT-ID: 0' \
--data '{
    "title": "Title Sample",
    "body": "Testing notification message",
    "userId": 1,
    "providerType": "activity_provider",
    "endpointKey": "secret_key"
}'

Recommended Project Structure

project-root/
├── src/
├── build.gradle
├── gradlew
├── gradlew.bat
└── src/main/resources/application.yml

Troubleshooting

Permission Denied for Gradle Wrapper

If you receive a permission error while running ./gradlew:

chmod +x gradlew

Port Already in Use

If port 4009 is already occupied, update the following configuration:

server:
  port: <new_port>

Security Recommendations

  • Use strong JWT secret keys in production.
  • Never commit credentials to version control.
  • Store sensitive values using environment variables or secret managers.
  • Restrict access to the notification endpoint using firewall or API gateway rules.

Environment Requirements

Component Version
Java 17
Spring Boot Compatible with Java 17
Database MySQL
Build Tool Gradle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment