{"id":21672488,"url":"https://github.com/redis-developer/redis-om-autocomplete-demo","last_synced_at":"2025-05-08T21:44:16.531Z","repository":{"id":104843898,"uuid":"525889024","full_name":"redis-developer/redis-om-autocomplete-demo","owner":"redis-developer","description":"Redis OM Spring Autocomplete/Autosuggest Demo","archived":false,"fork":false,"pushed_at":"2023-03-30T21:55:54.000Z","size":535,"stargazers_count":6,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-08T21:44:10.523Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/redis-developer.png","metadata":{"files":{"readme":"README.asc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-17T17:20:45.000Z","updated_at":"2024-08-31T17:50:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"f4ecfb38-a53b-496b-b3a7-1bc532ad437f","html_url":"https://github.com/redis-developer/redis-om-autocomplete-demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fredis-om-autocomplete-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fredis-om-autocomplete-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fredis-om-autocomplete-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/redis-developer%2Fredis-om-autocomplete-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/redis-developer","download_url":"https://codeload.github.com/redis-developer/redis-om-autocomplete-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253154086,"owners_count":21862453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-25T13:29:32.988Z","updated_at":"2025-05-08T21:44:16.514Z","avatar_url":"https://github.com/redis-developer.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":":toc:\n:toc-placement!:\n:imagesdir: ./images\n\n= Redis OM Spring Autocomplete Demo\n\nA Spring Boot demo of autocomplete functionality using Redis OM Spring.\n\ntoc::[]\n== Cloning the project\n\nTo check out the project use the following git command to ensure the submodule is cloned along with the main repository:\n\n====\n[source,bash]\n----\ngit clone git@github.com:redis-developer/redis-om-autocomplete-demo.git\n----\n====\n\n== What You Will build\n\nYou will build an application that uses Redis JSON document and the `@Document`\nannotation to provide a https://redis.io[Redis]-powered data layer for a Spring Boot API backend serving\nAirport Codes and States using RediRediSearch auto-complete engine.\n\nThe UI is a simple JS webapp using the https://reactjs.org[React] JavaScript library for building user interfaces. The webapp can be found under\nthe `src/main/webapp`.\n\n\n.Redis OM Autocomplete Webapp\nimage::redis-om-autocomplete-loop.gif['Redis OM Autocomplete Webapp', 640, 400]\n\n== What You Need\n\n* Java 17 or higher (http://www.oracle.com/technetwork/java/javase/downloads/index.html[JDK Java SE 17] or later)\n* http://maven.apache.org/download.cgi[Maven 3.2+]\n* You can also import the code straight into your IDE:\n** https://spring.io/guides/gs/sts[Spring Tool Suite (STS)]\n** https://spring.io/guides/gs/intellij-idea/[IntelliJ IDEA]\n* Spring Boot 3.0.2\n* A https://redis.io[Redis] database with the https://redisearch.io[RediSearch] module version 1.0.0 or higher installed.  We've provided a `docker-compose.yml` with Redis Stack for this. You can also https://redis.com/try-free/[sign up for a free 30Mb database with Redis Enterprise Cloud] - be sure to check the box to configure a Redis Stack instance, follow https://developer.redis.com/create/rediscloud/[this guide].\n* Optional: https://redis.com/redis-enterprise/redis-insight/[RedisInsight], a free data visualization and database management tool for Redis.  When downloading RedisInsight, be sure to select version 2.x.\n\n== Setting up a Redis Stack Instance\n\nBefore you can build the API, you need to set up the Redis Stack instance that will host our data.\nThe server is freely available at https://redis.io/download.\n\nThere are many ways to get going with Redis but by far the three easiest are:\n\n=== 🥞Redis Stack on Docker Locally\n\nRedis OM Spring relies on the power of the [RediSearch][redisearch-url] and [RedisJSON][redis-json-url] modules.\nWe have provided a docker compose YAML file for you to quickly get started. To launch the docker compose application, on the command line (or via Docker Desktop), clone this repository and run (from the root folder):\n\n====\n[source,bash]\n----\ndocker compose up\n----\n====\n\nThis launches Redis Stack; Redis Stack Server on port 6379, and Redis Insight 8001.\n\n=== 🌥️Redis Cloud\n\nIf you're using Redis Enterprise Cloud, you'll need the hostname, port number, and password for your database.  Use these to set the `application.properties` configuration like this:\n\n====\n[source,bash]\n----\nspring.redis.host=\u003chost\u003e\nspring.redis.port=\u003cport\u003e\nspring.redis.password=\u003cpassword\u003e\n----\n====\n\nFor example if your Redis Enterprise Cloud database is at port `9139` on host `enterprise.redis.com` and your password is `5uper53cret` then you'd set `REDIS_OM_URL` as follows:\n\n====\n[source,bash]\n----\nspring.redis.host=enterprise.redis.com\nspring.redis.port=9139\nspring.redis.password=5uper53cret\n----\n====\n\n== Spring Boot Skeleton\n\nThe app starting skeleton was created using the https://start.spring.io[Spring Initializr].\n\n== API Controller\n\nThe main API controller can be found at `src/main/java/com/redis/om/autocomplete/controllers/AirportsController.java`.\n\n== Entry point into the React App\n\nWe provide a Spring MVC controller that serves the HTML template hosting the React App. This controller can be found at `src/main/java/com/redis/om/autocomplete/controllers/WebAppController.java`.\n\n.src/main/java/com/redis/om/autocomplete/controllers/WebAppController.java\n====\n[source,java,highlight=1,3,5]\n----\n@Controller\npublic class WebAppController {\n    @GetMapping\n    public String index() {\n        return \"index\";\n    }\n}\n----\n\n\u003c1\u003e `@Controller` marks this class as a Spring MVC controller.\n\u003c2\u003e `@GetMapping` flags the `index()` method to serve GET request on the `/` route.\n\u003c3\u003e It returns `index` as the name of the template, which Spring Boot's autoconfigured view resolver will map to `src/main/resources/templates/index.html`.\n====\n\nLearn more about the React App in its https://github.com/redis-developer/redis-om-autocomplete/blob/main/src/main/webapp/README.asc[README].\n\n== Building and Launching the Application\n\nYou can now launch the app either by running the `main()` method of `com.redis.om.autocomplete.AutocompleteApplication` inside your IDE or by typing `./mvnw spring-boot:run` on the command line. (`mvnw.bat` for Windows users).\n\nThe output should show both the webapp (React) being bundled and the server-side (Spring Boot.. duh):\n\n====\n[source,text]\n----\n➜ ./mvnw clean spring-boot:run\n[INFO] Scanning for projects...\n[INFO]\n[INFO] -------------------\u003c com.redis.om:autocomplete-demo \u003e-------------------\n[INFO] Building Redis OM Spring Autocomplete Demo 0.0.1-SNAPSHOT\n[INFO] --------------------------------[ jar ]---------------------------------\n[INFO]\n[INFO] --- maven-clean-plugin:3.2.0:clean (default-clean) @ autocomplete-demo ---\n[INFO] Deleting /Users/bsb/Code/redis-om-autocomplete-demo/target\n[INFO]\n[INFO] \u003e\u003e\u003e spring-boot-maven-plugin:2.7.0:run (default-cli) \u003e test-compile @ autocomplete-demo \u003e\u003e\u003e\n[INFO]\n[INFO] --- frontend-maven-plugin:1.12.1:install-node-and-npm (install node and npm) @ autocomplete-demo ---\n[INFO] Installing node version v18.6.0\n[INFO] Unpacking /Users/bsb/.m2/repository/com/github/eirslett/node/18.6.0/node-18.6.0-darwin-x64.tar.gz into /Users/bsb/Code/redis-om-autocomplete-demo/target/node/tmp\n[INFO] Copying node binary from /Users/bsb/Code/redis-om-autocomplete-demo/target/node/tmp/node-v18.6.0-darwin-x64/bin/node to /Users/bsb/Code/redis-om-autocomplete-demo/target/node/node\n[INFO] Installed node locally.\n[INFO] Installing npm version 8.17.0\n[INFO] Unpacking /Users/bsb/.m2/repository/com/github/eirslett/npm/8.17.0/npm-8.17.0.tar.gz into /Users/bsb/Code/redis-om-autocomplete-demo/target/node/node_modules\n[INFO] Installed npm locally.\n[INFO]\n[INFO] --- frontend-maven-plugin:1.12.1:npm (npm install) @ autocomplete-demo ---\n[INFO] Running 'npm install' in /Users/bsb/Code/redis-om-autocomplete-demo/src/main/webapp\n[INFO]\n[INFO] up to date, audited 525 packages in 1s\n[INFO]\n[INFO] 36 packages are looking for funding\n[INFO]   run `npm fund` for details\n[INFO]\n[INFO] found 0 vulnerabilities\n[INFO]\n[INFO] --- frontend-maven-plugin:1.12.1:webpack (webpack build) @ autocomplete-demo ---\n[INFO] Running 'webpack.js ' in /Users/bsb/Code/redis-om-autocomplete-demo/src/main/webapp\n[INFO] asset bundle.js 1.43 MiB [compared for emit] (name: app) 1 related asset\n[INFO] asset bundle.css 231 KiB [compared for emit] (name: app) 1 related asset\n[INFO] Entrypoint app 1.65 MiB (1.92 MiB) = bundle.css 231 KiB bundle.js 1.43 MiB 2 auxiliary assets\n[INFO] orphan modules 609 KiB (javascript) 975 bytes (runtime) [orphan] 25 modules\n[INFO] runtime modules 1.25 KiB 6 modules\n[INFO] modules by path ./node_modules/ 1.34 MiB 98 modules\n[INFO] modules by path ./src/ 7.43 KiB\n[INFO]   ./src/app.js 5.5 KiB [built] [code generated]\n[INFO]   ./src/services/airports_api.js 1.92 KiB [built] [code generated]\n[INFO] modules by path ./scss/*.scss 50 bytes (javascript) 230 KiB (css/mini-extract)\n[INFO]   ./scss/app.scss 50 bytes [built] [code generated]\n[INFO]   css ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./scss/app.scss 230 KiB [built] [code generated]\n[INFO] webpack 5.74.0 compiled successfully in 6801 ms\n...\n\n  .   ____          _            __ _ _\n /\\\\ / ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\\n( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\\n \\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )\n  '  |____| .__|_| |_|_| |_\\__, | / / / /\n =========|_|==============|___/=/_/_/_/\n :: Spring Boot ::                (v2.7.0)\n\n2022-08-17 09:00:53.060  INFO 49420 --- [  restartedMain] c.r.o.a.AutocompleteApplication          : Starting AutocompleteApplication using Java 17.0.3 on BSB.local with PID 49420 (/Users/bsb/Code/redis-om-autocomplete-demo/target/classes started by briansam-bodden in /Users/bsb/Code/redis-om-autocomplete-demo)\n...\n2022-08-17 09:00:56.560  INFO 49420 --- [  restartedMain] c.r.om.spring.RedisModulesConfiguration  : Creating Indexes......\n2022-08-17 09:00:56.566  INFO 49420 --- [  restartedMain] c.r.om.spring.RedisModulesConfiguration  : Found 1 @Document annotated Beans...\n2022-08-17 09:00:56.566  INFO 49420 --- [  restartedMain] c.r.om.spring.RedisModulesConfiguration  : Found @Document annotated class: com.redis.om.autocomplete.domain.Airport\n2022-08-17 09:00:56.574  INFO 49420 --- [  restartedMain] c.r.om.spring.RedisModulesConfiguration  : Found 0 @RedisHash annotated Beans...\n2022-08-17 09:00:56.581  INFO 49420 --- [  restartedMain] c.r.o.a.AutocompleteApplication          : Started AutocompleteApplication in 3.903 seconds (JVM running for 4.358)\n2022-08-17 09:09:31.316  INFO 49420 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'\n2022-08-17 09:09:31.316  INFO 49420 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'\n2022-08-17 09:09:31.317  INFO 49420 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 1 ms\n----\n====\n\n== Play with the App\n\nThe Server-Side Endpoint is found at `0` and the\nReact webapp is mounted at the root at `http://localhost:8080`. The Database is\npreloaded with a list of Airports containing the airport name, code and state. Enjoy!\n\n== 🧭Interact with the API\n\nYou can interact with the API directly with CURL or through the http://localhost:8080/swagger-ui/index.html[Swagger interface].\n\n== See Also\n\nThe following guides may also be helpful:\n\n* https://redis.io/docs/stack/get-started/tutorials/stack-spring/[Redis OM Spring Tutorial]\n* https://spring.io/guides/gs/spring-data-reactive-redis/[Accessing Data Reactively with Redis]\n* https://spring.io/guides/gs/messaging-redis/[Messaging with Redis]\n* https://spring.io/guides/gs/spring-boot/[Building an Application with Spring Boot]\n\n== Credit\n\nCreated by https://github.com/bsbodden[Brian Sam-Bodden] @ https://redis.com[Redis]","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fredis-om-autocomplete-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fredis-developer%2Fredis-om-autocomplete-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fredis-developer%2Fredis-om-autocomplete-demo/lists"}