A web-based editor with real-time autocomplete suggestions using a Trie data structure, Go, and HTMX.
├── .github/ │ └── copilot-instructions.md ├── view/ │ ├── index.css │ └── index.html ├── go.mod ├── main.go ├── trie.go └── README.md
main.go
: HTTP server and request handlerstrie.go
: Trie data structure implementationview/index.html
: Frontend interface with HTMX integration
- Real-time autocomplete suggestions using a Trie data structure
- Case-insensitive word suggestions
- Dynamic word learning from user input
- Responsive design for mobile devices
- Server-side implementation in Go
- Frontend using HTMX for seamless interactions
- Ensure Go 1.23.3 or later is installed
- Clone the repository
- Run the server:
- Open http://localhost:8080 in your browser
The application uses a Trie data structure
to store and search words efficiently. As users type in the editor, HTMX sends requests to the autocompleteHandler which searches the trie for matching prefixes and returns suggestions.
The server automatically learns new words from user input (words longer than 2 characters) and adds them to the trie for future suggestions.
GET /
: Serves the main editor interfaceGET /autocomplete?q={query}
: Returns autocomplete suggestions for the given query
Go 1.23.3 HTMX 1.5.0 TailwindCSS 2.2.19