Deployment & Local Environment Setup Guide
This guide provides instructions for setting up, building, testing, and deploying the Kite messaging system across local development environments and production servers.
System Requirements & Prerequisites
- Operating System: macOS, Linux, or Windows (WSL2 recommended)
- Java Development Kit: JDK 21 or later
- Flutter SDK: Version 3.x or later
- Container Runtime: Docker 24.x and Docker Compose 2.x
- Build Tools: Apache Maven 3.9+ (or included
mvnwwrapper) - Python Runtime: Python 3.10+ (for MkDocs site generation)
1. Infrastructure Provisioning
Provision local infrastructure services (MongoDB database and GridFS storage) using Docker Compose:
# Start MongoDB container in background
docker-compose up -d
# Verify container health
docker-compose ps
2. Environment Variables & Secret Configuration
The backend application requires two key secrets to function securely in development and production environments:
| Environment Variable | Config Property | Description | Default Fallback |
|---|---|---|---|
SECRET_KEY |
jwt.secret.key |
Base64/Secret key string for signing HMAC-SHA256 JWT tokens | default_secret_key_... (Testing only) |
GEMINI_KEY |
langchain4j.google-ai-gemini.chat-model.api-key |
Google AI Gemini API key for LangChain4j AI assistant integration | demo_key |
Option A: IntelliJ IDEA Run Configuration (Recommended for IDE Development)
- Open IntelliJ IDEA.
- Open
KiteBackendApplication.java(src/main/java/com/gwynejsn/kite/KiteBackendApplication.java). - Click Run -> Edit Configurations... in the top menu bar (or press
Cmd + Shift + A/Ctrl + Shift + Aand typeEdit Configurations). - Select Spring Boot -> KiteBackendApplication under the Run/Debug Configurations list.
- In the Environment variables field, enter your key-value pairs separated by semicolons (
;): (Alternatively, click the document icon on the right side of the Environment Variables field to open the interactive key-value editor table). - Click Apply and OK.
- Click Run or Debug to launch the backend with your secrets populated.
Option B: Terminal Export (macOS & Linux)
Export the environment variables in your terminal session before launching Maven:
export SECRET_KEY="your_custom_jwt_secret_key_here"
export GEMINI_KEY="your_actual_gemini_api_key_here"
cd kite-backend
./mvnw spring-boot:run
Option C: Windows Command Prompt & PowerShell
-
Command Prompt (CMD):
-
PowerShell:
Option D: IntelliJ EnvFile Plugin (.env File)
- Install the EnvFile plugin in IntelliJ (
Preferences/Settings->Plugins-> SearchEnvFile). - Create a
.envfile in the root ofkite-backend: - Open Run/Debug Configurations, select KiteBackendApplication, click the EnvFile tab, check Enable EnvFile, and click
+to select your.envfile.
Option E: Spring Boot Command-Line System Arguments
You can also pass environment property overrides directly as command-line arguments to Maven:
cd kite-backend
./mvnw spring-boot:run -Dspring-boot.run.arguments="--jwt.secret.key=your_secret_key --langchain4j.google-ai-gemini.chat-model.api-key=your_gemini_key"
3. Backend Building & Deployment (kite-backend)
Compilation & Static Analysis
cd kite-backend
# Clean and compile Java 21 sources
./mvnw clean compile
# Execute backend unit and integration tests
./mvnw test
Execution
The server will initialize onhttp://localhost:8080/kite/api/v1.
4. Mobile Frontend Setup (kite-flutter/kite)
Dependency Installation & Verification
cd kite-flutter/kite
# Fetch Flutter dependencies
flutter pub get
# Execute Dart static analysis
flutter analyze
# Execute Flutter unit and widget tests
flutter test
Application Execution
5. Documentation Site Building (MkDocs)
Local Documentation Server
To preview the production documentation website locally:
# Install MkDocs Material theme engine
pip install mkdocs-material
# Build static site assets
mkdocs build
# Start live documentation server with hot reloading
mkdocs serve
http://127.0.0.1:8000.