Skip to content

Commit 795f29b

Browse files
authored
Merge pull request AOSSIE-Org#96 from M4dhav/dev
Add Meilisearch integration
2 parents 7ddeb32 + 0db961e commit 795f29b

File tree

28 files changed

+1471
-2
lines changed

28 files changed

+1471
-2
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
.DS_Store
22
livekit.log
3-
appwrite
3+
appwrite/
44
.vscode/
55
**/.env
66
**/node_modules/
7-
**/resonate-service-account.json
7+
**/resonate-service-account.json
8+
meili_data/

appwrite.json

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,77 @@
444444
"entrypoint": "src/main.js",
445445
"commands": "npm install",
446446
"path": "functions/start-friend-call"
447+
},
448+
{
449+
"$id": "68c2c4e20013c58af2c9",
450+
"execute": [
451+
"any"
452+
],
453+
"name": "Sync Stories with Meilisearch",
454+
"enabled": true,
455+
"logging": true,
456+
"runtime": "node-16.0",
457+
"scopes": [
458+
"databases.read",
459+
"collections.read",
460+
"documents.read"
461+
],
462+
"events": [
463+
"databases.stories.collections.670259e900321c12a5a2.documents.*.create",
464+
"databases.stories.collections.670259e900321c12a5a2.documents.*.delete",
465+
"databases.stories.collections.670259e900321c12a5a2.documents.*.update"
466+
],
467+
"schedule": "",
468+
"timeout": 15,
469+
"entrypoint": "src/main.js",
470+
"commands": "npm install",
471+
"path": "functions/sync-stories-with-meilisearch"
472+
},
473+
{
474+
"$id": "68c2ddc8001dded982ef",
475+
"execute": [
476+
"any"
477+
],
478+
"name": "Sync Users with Meilisearch",
479+
"enabled": true,
480+
"logging": true,
481+
"runtime": "node-16.0",
482+
"scopes": [
483+
"databases.read",
484+
"collections.read",
485+
"documents.read"
486+
],
487+
"events": [
488+
"databases.64a1319104a149e16f5c.collections.64a52f0a6c41ded09def.documents.*.create",
489+
"databases.64a1319104a149e16f5c.collections.64a52f0a6c41ded09def.documents.*.delete",
490+
"databases.64a1319104a149e16f5c.collections.64a52f0a6c41ded09def.documents.*.update"
491+
],
492+
"schedule": "",
493+
"timeout": 15,
494+
"entrypoint": "src/main.js",
495+
"commands": "npm install",
496+
"path": "functions/sync-users-with-meilisearch"
497+
},
498+
{
499+
"$id": "68c3d37e003118410c75",
500+
"execute": [
501+
"any"
502+
],
503+
"name": "Sync All Documents with Meilisearch",
504+
"enabled": true,
505+
"logging": true,
506+
"runtime": "node-16.0",
507+
"scopes": [
508+
"databases.read",
509+
"collections.read",
510+
"documents.read"
511+
],
512+
"events": [],
513+
"schedule": "",
514+
"timeout": 15,
515+
"entrypoint": "src/main.js",
516+
"commands": "npm install",
517+
"path": "functions/sync-all-documents-with-meilisearch"
447518
}
448519
],
449520
"buckets": [
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variable files
76+
.env
77+
.env.development.local
78+
.env.test.local
79+
.env.production.local
80+
.env.local
81+
82+
# parcel-bundler cache (https://parceljs.org/)
83+
.cache
84+
.parcel-cache
85+
86+
# Next.js build output
87+
.next
88+
out
89+
90+
# Nuxt.js build / generate output
91+
.nuxt
92+
dist
93+
94+
# Gatsby files
95+
.cache/
96+
# Comment in the public line in if your project uses Gatsby and not Next.js
97+
# https://nextjs.org/blog/next-9-1#public-directory-support
98+
# public
99+
100+
# vuepress build output
101+
.vuepress/dist
102+
103+
# vuepress v2.x temp and cache directory
104+
.temp
105+
.cache
106+
107+
# Docusaurus cache and generated files
108+
.docusaurus
109+
110+
# Serverless directories
111+
.serverless/
112+
113+
# FuseBox cache
114+
.fusebox/
115+
116+
# DynamoDB Local files
117+
.dynamodb/
118+
119+
# TernJS port file
120+
.tern-port
121+
122+
# Stores VSCode versions used for testing VSCode extensions
123+
.vscode-test
124+
125+
# yarn v2
126+
.yarn/cache
127+
.yarn/unplugged
128+
.yarn/build-state.yml
129+
.yarn/install-state.gz
130+
.pnp.*
131+
132+
# Directory used by Appwrite CLI for local development
133+
.appwrite
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"trailingComma": "es5",
3+
"tabWidth": 2,
4+
"semi": true,
5+
"singleQuote": true
6+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# ⚡ Node.js Sync with Meilisearch Function
2+
3+
Syncs documents in an Appwrite database collection to a Meilisearch index.
4+
5+
## 🧰 Usage
6+
7+
### GET /
8+
9+
Returns HTML page where search can be performed to test the indexing.
10+
11+
### POST /
12+
13+
Triggers indexing of the Appwrite database collection to Meilisearch.
14+
15+
**Response**
16+
17+
Sample `204` Response: No content.
18+
19+
## ⚙️ Configuration
20+
21+
| Setting | Value |
22+
| ----------------- | ------------- |
23+
| Runtime | Node (18.0) |
24+
| Entrypoint | `src/main.js` |
25+
| Build Commands | `npm install` |
26+
| Permissions | `any` |
27+
| Timeout (Seconds) | 15 |
28+
29+
## 🔒 Environment Variables
30+
31+
### APPWRITE_DATABASE_ID
32+
33+
The ID of the Appwrite database that contains the collection to sync.
34+
35+
| Question | Answer |
36+
| ------------- | --------------------------------------------------------- |
37+
| Required | Yes |
38+
| Sample Value | `612a3...5b6c9` |
39+
| Documentation | [Appwrite: Databases](https://appwrite.io/docs/databases) |
40+
41+
### APPWRITE_COLLECTION_ID
42+
43+
The ID of the collection in the Appwrite database to sync.
44+
45+
| Question | Answer |
46+
| ------------- | -------------------------------------------------------------------------------- |
47+
| Required | Yes |
48+
| Sample Value | `7c3e8...2a9f1` |
49+
| Documentation | [Appwrite: Collections](https://appwrite.io/docs/products/databases/collections) |
50+
51+
### MEILISEARCH_ENDPOINT
52+
53+
The host URL of the Meilisearch server.
54+
55+
| Question | Answer |
56+
| ------------ | ----------------------- |
57+
| Required | Yes |
58+
| Sample Value | `http://127.0.0.1:7700` |
59+
60+
### MEILISEARCH_ADMIN_API_KEY
61+
62+
The admin API key for Meilisearch.
63+
64+
| Question | Answer |
65+
| ------------- | ------------------------------------------------------------------------ |
66+
| Required | Yes |
67+
| Sample Value | `masterKey1234` |
68+
| Documentation | [Meilisearch: API Keys](https://docs.meilisearch.com/reference/api/keys) |
69+
70+
### MEILISEARCH_INDEX_NAME
71+
72+
Name of the Meilisearch index to which the documents will be synchronized.
73+
74+
| Question | Answer |
75+
| ------------ | ---------- |
76+
| Required | Yes |
77+
| Sample Value | `my_index` |
78+
79+
### MEILISEARCH_SEARCH_API_KEY
80+
81+
API Key for Meilisearch search operations.
82+
83+
| Question | Answer |
84+
| ------------- | ------------------------------------------------------------------------ |
85+
| Required | Yes |
86+
| Sample Value | `searchKey1234` |
87+
| Documentation | [Meilisearch: API Keys](https://docs.meilisearch.com/reference/api/keys) |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
declare global {
2+
namespace NodeJS {
3+
interface ProcessEnv {
4+
MEILISEARCH_ENDPOINT: string;
5+
MEILISEARCH_ADMIN_API_KEY: string;
6+
}
7+
}
8+
}
9+
10+
export { };

0 commit comments

Comments
 (0)