A minimal client–server key–value store that saves data as JSON.
It supports nested keys (JSON path as an array) and arbitrary JSON values (objects, arrays, numbers, booleans, null, strings).
The server is concurrent, safely handles multiple clients, and persists data to disk.
- JSON over TCP: client sends one JSON request per connection; server replies with one JSON response and closes the socket.
- Operations:
get— read by key or pathset— create/update value at key/pathdelete— remove key/pathexit— stop the server
- JCommander — parse
-t/-k/-vand-in <file>modes - Nested keys:
keycan be a string ("name") or an array["person","surname"]. - Any JSON value: store objects, arrays, numbers, booleans,
null, or strings. - Persistence: data is stored at
src/server/data/db.json. - Concurrency: multiple clients;
getis concurrent,set/deleteare serialized via aReadWriteLock. - Predictable logs (for tests/CI):
- Server:
Server started! - Client:
Client started!,Sent: ...,Received: ...
- Server:
The arguments will be passed to the client in the following format:
java Main -t <type> -k <key> [-v <value>]
-tspecifies the type of request (get, set, or delete).-kspecifies the key.-vspecifies the value (only needed for set requests).-inspecifies the file name at/client/data directorywhich contains request
For example:
java Main -t set -k "text" -v "Here is some text to store on the server"java Main -in "userRequest.json"