Svelte-Chat-Plugin
The sveltekit plugin for svelte-chat solution
Swift description
Plugin for svelte-chat which in conjuction with @svelte-chat/gui makes remakable chat experiences which at least can handle cases from your online shop etc...
- This plugin is required to handle communication demanded by frontend solution part which is the @svelte-chat/gui
- Use only with @svelte-chat/gui to make full svelte-chat solution
Prerequisites
- SvelteKit app,
- MongoDB configured on port 27017
Installation (as always - for npm)
$ npm i @svelte-chat/plugin
You're one step in front of finish line (whole soultion implementation isn't accounted):
1st: Use svelteChatPlugin which embedds all source functionalities (with administration included)
// vite.config.{js,ts}
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
// Import plugin from module
import { svelteChatPlugin } from "@svelte-chat/plugin";
export default defineConfig({
plugins: [sveltekit(), svelteChatPlugin()]
});
Fine grainded configuration
Fine grained configuartion covers for moment ports configuration for: basic app communication, admin app and all these optionally and separately.
You have to pass config as JSON content for your Device Environment Variable SVELTE_CHAT
Configuration JSON Overlay:
{
/* Admin app - Where serves app under whose you can manage clien cases */
"admin_server": {
"port": 10502
},
/* App communcation - so where your client-side will be call, to get and send informations */
"server": {
"port": 10501
}
}
As Device ENV "SVELTE_CHAT":
Ok, So when we defined what you can configure, to make this work and end fine-grained configuration you must pass such short config to device environment varaible SVELTE_CHAT
How to run app correctly?
Always will be correct for bash CLI (beyond powershell and cmd):
- Developement mode
$ ORIGIN="admin_server.port" npm run dev
- In production as node app (after transiple sveltekit to node.js handler by use @sveltejs/adapter-node):
$ ORIGIN="admin_server.port" node .
- Be aware:
-
ORIGIN="admin_server.port" - where is determined "admin_server.port" gives location where your admin_server exists. E.g:
- Default value should always be 10502 -> in space when you didn't configured Fine grainded configuration admin_server.port number,
- When you change Fine grainded configuration admin_server.port number you should put that value here
This isn't my idea but determined via how transpiled to node.js sveltekit app works. Please don't be angry on me 😍!
-
ORIGIN="admin_server.port" - where is determined "admin_server.port" gives location where your admin_server exists. E.g:
Other worth informations
- Default Admin App port is 10502,
- Default App communcation port is 10501 (for this port will be call @svelte-chat/gui client),
- It works fully as a vite sveltekit plugin,
- To store all datas we use MongoDB local database on default port 27017
Contribution:
You feel will to help in solution evolution. Don't be shy and pull issue with demand like: I would like take the participation in evolution because ...[cause]
License
All what you should know about Copyrights is that all code base is under Apache 2.0