{"id":12,"date":"2025-02-18T02:25:33","date_gmt":"2025-02-18T01:25:33","guid":{"rendered":"https:\/\/mmedojevic.com\/?p=12"},"modified":"2025-02-18T02:25:34","modified_gmt":"2025-02-18T01:25:34","slug":"json-ai-server","status":"publish","type":"post","link":"https:\/\/mmedojevic.com\/index.php\/2025\/02\/18\/json-ai-server\/","title":{"rendered":"JSON AI Server"},"content":{"rendered":"<div class=\"entry\">\n\n\n<p>Quickly build JSON REST endpoints with AI using JSON AI Server. Simply provide a title, short description, and a sample JSON node, and the application will generate the endpoint for you.<\/p>\n\n\n\n<p>This application leverages Spring AI and is written in Kotlin. The frontend, developed with React and TypeScript, is integrated directly into the Spring application. An embedded H2 database eliminates the need for external database dependencies.<\/p>\n\n\n\n<p>While Claude and OpenAI are currently supported, we plan to add support for more Spring AI models soon.<\/p>\n\n\n\n<p>GitHub repository: <a href=\"https:\/\/github.com\/mmedojevicbg\/json-ai-server\">https:\/\/github.com\/mmedojevicbg\/json-ai-server<\/a><br>Docker Hub image: <a href=\"https:\/\/hub.docker.com\/repository\/docker\/mmedojevicbg\/json-ai-server\/general\">https:\/\/hub.docker.com\/repository\/docker\/mmedojevicbg\/json-ai-server<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installation<\/h2>\n\n\n\n<p>Create a file named <code>docker-compose.yml<\/code> with the following content:<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>services:\n  jsonaiserver:\n    image: 'mmedojevicbg\/json-ai-server:latest'\n    container_name: jsonaiserver\n    environment:\n      - 'CLAUDE_API_KEY=claude-api-key'\n      - 'AI_MODEL=claude'\n      - 'H2_FILE_STORAGE=\/var\/lib\/h2\/data'\n    ports:\n      - '15000:40000'\n    volumes:\n      - jsonaiserver_data:\/var\/lib\/h2\/data\nvolumes:\n  jsonaiserver_data:\n<\/code><\/pre>\n\n\n\n<p>To use Claude, set the <code>AI_MODEL<\/code> environment variable to <code>claude<\/code> and provide your Claude API key in the <code>CLAUDE_API_KEY<\/code> environment variable. For OpenAI, set <code>AI_MODEL<\/code> to <code>openai<\/code> and provide your OpenAI API key in the <code>OPENAI_API_KEY<\/code> environment variable.<\/p>\n\n\n\n<p>Once the application starts, access it at http:\/\/localhost:15000. <\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1917\" height=\"995\" src=\"https:\/\/mmedojevic.com\/wp-content\/uploads\/2025\/02\/json-ai-server-home.jpg\" alt=\"\" class=\"wp-image-16\"\/><\/figure>\n\n\n\n<p>Let&#8217;s create a JSON endpoint with AI.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1917\" height=\"997\" src=\"https:\/\/mmedojevic.com\/wp-content\/uploads\/2025\/02\/json-ai-server-add.jpg\" alt=\"\" class=\"wp-image-17\"\/><\/figure>\n\n\n\n<p>Your new endpoint will appear in the list.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1918\" height=\"945\" src=\"https:\/\/mmedojevic.com\/wp-content\/uploads\/2025\/02\/json-ai-server-list.jpg\" alt=\"\" class=\"wp-image-18\"\/><\/figure>\n\n\n\n<p>Clicking the JSON preview link will open the endpoint.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1915\" height=\"992\" src=\"https:\/\/mmedojevic.com\/wp-content\/uploads\/2025\/02\/json-ai-server-json.jpg\" alt=\"\" class=\"wp-image-19\"\/><\/figure>\n\n\n\n<p>Let&#8217;s add in a couple more datasets.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1916\" height=\"946\" src=\"https:\/\/mmedojevic.com\/wp-content\/uploads\/2025\/02\/json-ai-server-list-full.jpg\" alt=\"\" class=\"wp-image-20\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Sample client application<\/h2>\n\n\n\n<p>Let&#8217;s make a sample client application to talk to a JSON API server.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1917\" height=\"948\" src=\"https:\/\/mmedojevic.com\/wp-content\/uploads\/2025\/02\/client-apple.jpg\" alt=\"\" class=\"wp-image-21\"\/><\/figure>\n\n\n\n<p>The output displays the generated data. Let&#8217;s select different category in the dropdown now.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1917\" height=\"995\" src=\"https:\/\/mmedojevic.com\/wp-content\/uploads\/2025\/02\/client-lenovo.jpg\" alt=\"\" class=\"wp-image-22\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Future enhancements<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Support for the rest of AI models (Gemini, DeepSeek, &#8230;)<\/li>\n\n\n\n<li>AI image generation<\/li>\n\n\n\n<li>Improvements trough AI conversation<\/li>\n\n\n\n<li>Full REST API support (add, edit, delete)<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Quickly build JSON REST endpoints with AI using JSON AI Server. Simply provide a title, short description, and a sample JSON node, and the application will generate the endpoint for you. This application leverages Spring AI and is written in Kotlin. The frontend, developed with React and TypeScript, is integrated directly into the Spring application. &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,13,11,12],"tags":[3,9,5,7,4,6,8],"class_list":{"0":"post-12","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-ai","7":"category-kotlin","8":"category-spring","9":"category-spring-ai","10":"tag-ai","11":"tag-h2","12":"tag-kotlin","13":"tag-react","14":"tag-spring","15":"tag-spring-ai","16":"tag-typescript","17":"anons"},"_links":{"self":[{"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":1,"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"predecessor-version":[{"id":23,"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/posts\/12\/revisions\/23"}],"wp:attachment":[{"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mmedojevic.com\/index.php\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}