├── README.md └── index.html /README.md: -------------------------------------------------------------------------------- 1 | # PocketBase x htmx x python (comming back soon) AI Chat App 2 | 3 | A simple chat application built with HTMx, JavaScript, and the PocketBase API, styled using Tailwind CSS. there is a python AI chatbot listening as well. 4 | I was initially just testing to see if i could make a simple chat app using only htmx to send requests directly to and from pocketbase. this would mean my whole project would be one html file and the pocketbase admin ui. i worked on it for 30 min. 5 | the problem i pocketbase send json back but htmx expects html. though i was able to get the ai to send back html 6 | if someone is intrested in the same thing as me here. get in contact with me here. i'll gladly work with you. 7 | 8 | edit: i was able to get the json to display as html. but i still need to figure out how to send json to pocketbase. i've removed the ai for now. i'll add it back later. now this whole project is just one html file and the pocketbase admin ui. Anyone can send pull requests. i'll merge them as long as they are good. 9 | 10 | here is the current one: 11 | ## images 12 | - latest version: 13 | - ![Screenshot 2023-12-13 093218](https://github.com/valiantlynx/htmx-chat/assets/86688436/ba79b3b4-8608-4292-81e3-f976ea814579) 14 | 15 | - version 1 16 | - ![image](https://github.com/valiantlynx/htmx-chat/assets/86688436/d3c45b12-87b3-43df-879b-92b8bd33fc9d) 17 | 18 | 19 | ## Table of Contents 20 | 21 | 22 | - [PocketBase x htmx x python(comming back soon) AI Chat App](#pocketbase-x-htmx-x-pythoncomming-back-soon-ai-chat-app) 23 | - [images](#images) 24 | - [Table of Contents](#table-of-contents) 25 | - [Features](#features) 26 | - [Demo](#demo) 27 | - [Progress](#progress) 28 | - [Installation](#installation) 29 | - [usage](#usage) 30 | - [Contributing](#contributing) 31 | - [License](#license) 32 | - [for cloning into monorepo](#for-cloning-into-monorepo) 33 | - [cors work around in the head](#cors-work-around-in-the-head) 34 | 35 | ## Features 36 | 37 | - Send and receive chat messages. 38 | - Real-time chat updates using htmx. 39 | - Stylish and responsive UI with Tailwind CSS. 40 | - Messages are stored and retrieved using the PocketBase API. 41 | - Easily customizable and extendable. 42 | 43 | ## Demo 44 | 45 | You can try out a live demo of the chat app [here](https://valiantlynx.github.io/htmx-chat/). 46 | 47 | ## Progress 48 | 49 | i've been able to show the messages returned from pocketbase(as json) into the chat and looks good. 50 | i will return the ai to listen to the chats and answer. 51 | 52 | ## Installation 53 | 54 | 1. Clone this repository to your local machine: 55 | 56 | ```bash 57 | git clone https://github.com/valiantlynx/htmx-chat.git 58 | ``` 59 | 2. Navigate to the project directory: 60 | ```bash 61 | cd chat-app 62 | 63 | ``` 64 | 3. Open the index.html file in your web browser or serve it using a local development server. 65 | 66 | ## usage 67 | 1. Open the chat app in your web browser. 68 | 69 | 2. Enter your message in the input field and click the "Send" button to send a message. 70 | 71 | 3. Received messages will be displayed in the chat container. 72 | 73 | 74 | ## Contributing 75 | 76 | Contributions are welcome! If you'd like to contribute to this project, please follow these steps: 77 | 78 | 1. Fork the repository. 79 | 80 | 2. Create a new branch for your feature or bug fix: 81 | 82 | ```bash 83 | git checkout -b feature/your-feature-name 84 | ``` 85 | 86 | 3. Make your changes and commit them: 87 | 88 | ```bash 89 | git commit -m "Add your feature description" 90 | ``` 91 | 92 | 4. Push your changes to your forked repository: 93 | ```bash 94 | git push origin feature/your-feature-name 95 | ``` 96 | 5. Create a pull request from your forked repository to the main project repository. 97 | Please make sure to follow the project's code of conduct and contribute in a respectful and constructive manner. 98 | 99 | ## License 100 | This project is licensed under the MIT License - do what the fuck you want. just give me credit. 101 | 102 | 103 | ## for cloning into monorepo 104 | ```bash 105 | git subtree add --prefix=apps/htmx-chat https://github.com/valiantlynx/htmx-chat.git main --squash 106 | git subtree pull --prefix=apps/htmx-chat https://github.com/valiantlynx/htmx-chat.git main --squash 107 | git subtree push --prefix=apps/htmx-chat https://github.com/valiantlynx/htmx-chat.git main 108 | ``` 109 | 110 | ### cors work around in the head 111 | ´´´js 112 | 118 | ´´´ 119 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Pocketbase X htmx Chat 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 |
20 | 21 | 22 | 24 | 26 | 27 | 28 | 29 | 30 | 31 | 33 | 34 | 35 | 36 | 37 |
38 |

Pocketbase X htmx Chat

39 |

Powered by htmx and Pocketbase.

40 |

This is a simple chat app that uses htmx to send and receive messages. This one html 41 | file is all there is to it.

42 |

The chat messages are sent and received using htmx and stored in a Pocketbase 43 | collection. The chat messages are rendered using Nunjucks templates.

44 |
When it comes to realtime. the simplest i know is gunDB
45 | 46 | 47 | 48 |
49 |
50 |
51 | 52 | 53 |
54 |
55 | 56 | 57 |
58 |
59 | 60 | 61 | 88 |
89 | 90 | 91 | --------------------------------------------------------------------------------