A multithreaded JSON-based key-value database built with Java and Gradle. The project implements client-server communication over sockets, supporting commands like set, get, delete, and exit. In the advanced stages, it supports nested JSON keys and path-based access.
✅ Lightweight JSON database (stores and retrieves any JSON data)
✅ Nested key access (e.g., ["person","name"])
✅ Multithreaded TCP server
✅ Client-server communication with JSON messages
✅ Supports set, get, delete, and exit commands
✅ Configured as a multi-module Gradle project
├── common/ → shared JSON utilities & communication logic
├── server/ → TCP server that manages the database
└── client/ → CLI client that sends requests to the server
./gradlew build
Run in one terminal:
./gradlew :server:run
Output:
Server started!
In another terminal, run:
./gradlew :client:run --args="-t set -k text -v 'Hello World!'"
Output:
Client started!
Sent: {
"type":"set",
"key":"text",
"value":"Hello World!"
}
Received: {"response":"OK"}
🧩 Example JSON Input (via file)
You can also use a .json input file:
./gradlew :client:run --args="-in getFile.json"
Command Description Example set Store a value -t set -k text -v "Hello World!" get Retrieve a value -t get -k text delete Remove a key -t delete -k text exit Stop the server -t exit 🧬 Nested JSON ExampleSet nested object:
./gradlew :client:run --args='-in setPerson.json'
Contents of setPerson.json:
{
"type": "set",
"key": "person",
"value": {
"name": "Elon Musk",
"car": { "model": "Tesla Roadster", "year": "2018" },
"rocket": { "name": "Falcon 9", "launches": "87" }
}
}
Get nested field:
./gradlew :client:run --args='-in getSurname.json'
getSurname.json:
{
"type": "get",
"key": ["person","car","model"]
}
Java 17+
Gradle (multi-module build)
Gson (for JSON parsing)
ExecutorService (for concurrency)
Andrei Biahun