Skip to content

Commit 48ba653

Browse files
committed
Add InsightHub Template
Squash Merged From https://github.com/Lina0Elman/InsightHub `main` branch Signed-off-by: Tal Jacob <taljacob2@gmail.com>
1 parent b755d6c commit 48ba653

File tree

111 files changed

+7949
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+7949
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Backend - Deploy coverage report to Pages
2+
3+
on:
4+
push:
5+
branches: ['main']
6+
7+
workflow_dispatch:
8+
9+
concurrency:
10+
group: 'pages'
11+
cancel-in-progress: true
12+
13+
jobs:
14+
deploy:
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
environment:
20+
name: github-pages
21+
url: ${{ steps.deployment.outputs.page_url }}
22+
runs-on: ubuntu-latest
23+
defaults:
24+
run:
25+
working-directory: insighthub-backend
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
- name: Create envfile
30+
uses: SpicyPizza/create-envfile@v2.0.3
31+
with:
32+
envkey_PORT: 3000
33+
envkey_DB_CONNECTION: mongodb://localhost:27017/app
34+
envkey_ACCESS_TOKEN_SECRET: 2a955a8b802eab6c693ba116f5e1bc8d2d2cf5e5e83e579cecb3fc363fb077229a801e7392f348d3c370e2383169cab80f556421d3ec2186def5d36ed5a317b6
35+
envkey_TOKEN_EXPIRATION: 30s
36+
envkey_REFRESH_TOKEN_SECRET: 2a955a8b802eab6c693ba116f5e1bc8d2d2cf5e5e83e579cecb3fc363fb077229a801e7392f348d3c370e2383169cab80f556421d3ec2186def5d36ed5a317b6
37+
envkey_REFRESH_TOKEN_EXPIRATION: 1d
38+
file_name: insighthub-backend/.env
39+
fail_on_empty: true
40+
sort_keys: false
41+
- name: Start MongoDB
42+
uses: supercharge/mongodb-github-action@1.10.0
43+
with:
44+
mongodb-version: '6.0'
45+
- uses: actions/setup-node@v4
46+
with:
47+
node-version: 18
48+
- name: Install dependencies
49+
run: npm i
50+
- name: Run tests
51+
run: npm run test -- --testTimeout=30000
52+
- name: Setup Pages
53+
if: always()
54+
uses: actions/configure-pages@v4
55+
- name: Upload Artifact
56+
if: always()
57+
uses: actions/upload-pages-artifact@v3
58+
with:
59+
path: 'insighthub-backend/coverage/lcov-report'
60+
name: 'github-pages'
61+
- name: Deploy to GitHub Pages
62+
if: always()
63+
id: deployment
64+
uses: actions/deploy-pages@v4
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Backend - Run all tests
2+
3+
on:
4+
push:
5+
branches: ['*']
6+
pull_request:
7+
branches: ['*']
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
working-directory: insighthub-backend
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Create envfile
19+
uses: SpicyPizza/create-envfile@v2.0.3
20+
with:
21+
envkey_PORT: 3000
22+
envkey_DB_CONNECTION: mongodb://localhost:27017/app
23+
envkey_ACCESS_TOKEN_SECRET: 2a955a8b802eab6c693ba116f5e1bc8d2d2cf5e5e83e579cecb3fc363fb077229a801e7392f348d3c370e2383169cab80f556421d3ec2186def5d36ed5a317b6
24+
envkey_TOKEN_EXPIRATION: 30s
25+
envkey_REFRESH_TOKEN_SECRET: 2a955a8b802eab6c693ba116f5e1bc8d2d2cf5e5e83e579cecb3fc363fb077229a801e7392f348d3c370e2383169cab80f556421d3ec2186def5d36ed5a317b6
26+
envkey_REFRESH_TOKEN_EXPIRATION: 1d
27+
envkey_CHAT_AI_TURNED_ON: false
28+
file_name: insighthub-backend/.env
29+
fail_on_empty: true
30+
sort_keys: false
31+
- name: Start MongoDB
32+
uses: supercharge/mongodb-github-action@1.10.0
33+
with:
34+
mongodb-version: '6.0'
35+
- uses: actions/setup-node@v4
36+
with:
37+
node-version: 18
38+
- name: Install dependencies
39+
run: npm i
40+
- name: Run tests
41+
run: npm run test -- --testTimeout=30000
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Frontend - Run build
2+
3+
on:
4+
push:
5+
branches: ['*']
6+
pull_request:
7+
branches: ['*']
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
defaults:
13+
run:
14+
working-directory: insighthub-frontend
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
- name: Create envfile
19+
uses: SpicyPizza/create-envfile@v2.0.3
20+
with:
21+
envkey_VITE_PORT: 5000
22+
envkey_VITE_BACKEND_URL: http://localhost:3000
23+
file_name: insighthub-frontend/.env
24+
fail_on_empty: true
25+
sort_keys: false
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 18
29+
- name: Install dependencies
30+
run: npm i
31+
- name: Run build
32+
run: npm run build

.gitignore

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+
package-lock.json
45+
46+
# Snowpack dependency directory (https://snowpack.dev/)
47+
web_modules/
48+
49+
# TypeScript cache
50+
*.tsbuildinfo
51+
52+
# Optional npm cache directory
53+
.npm
54+
55+
# Optional eslint cache
56+
.eslintcache
57+
58+
# Optional stylelint cache
59+
.stylelintcache
60+
61+
# Microbundle cache
62+
.rpt2_cache/
63+
.rts2_cache_cjs/
64+
.rts2_cache_es/
65+
.rts2_cache_umd/
66+
67+
# Optional REPL history
68+
.node_repl_history
69+
70+
# Output of 'npm pack'
71+
*.tgz
72+
73+
# Yarn Integrity file
74+
.yarn-integrity
75+
76+
# dotenv environment variable files
77+
.env
78+
.env.development.local
79+
.env.test.local
80+
.env.production.local
81+
.env.local
82+
83+
# parcel-bundler cache (https://parceljs.org/)
84+
.cache
85+
.parcel-cache
86+
87+
# Next.js build output
88+
.next
89+
out
90+
91+
# Nuxt.js build / generate output
92+
.nuxt
93+
dist
94+
95+
# Gatsby files
96+
.cache/
97+
# Comment in the public line in if your project uses Gatsby and not Next.js
98+
# https://nextjs.org/blog/next-9-1#public-directory-support
99+
# public
100+
101+
# vuepress build output
102+
.vuepress/dist
103+
104+
# vuepress v2.x temp and cache directory
105+
.temp
106+
.cache
107+
108+
# Docusaurus cache and generated files
109+
.docusaurus
110+
111+
# Serverless directories
112+
.serverless/
113+
114+
# FuseBox cache
115+
.fusebox/
116+
117+
# DynamoDB Local files
118+
.dynamodb/
119+
120+
# TernJS port file
121+
.tern-port
122+
123+
# Stores VSCode versions used for testing VSCode extensions
124+
.vscode-test
125+
126+
# yarn v2
127+
.yarn/cache
128+
.yarn/unplugged
129+
.yarn/build-state.yml
130+
.yarn/install-state.gz
131+
.pnp.*
132+
/.idea
133+
.DS_Store

.vscode/launch.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node-terminal",
9+
"name": "Backend: Run Script: dev",
10+
"request": "launch",
11+
"command": "npm run dev",
12+
"cwd": "${workspaceFolder}\\insighthub-backend"
13+
},
14+
{
15+
"type": "node-terminal",
16+
"name": "Backend: Run Script: test",
17+
"request": "launch",
18+
"command": "npm run test",
19+
"cwd": "${workspaceFolder}\\insighthub-backend"
20+
},
21+
{
22+
"type": "node-terminal",
23+
"name": "Frontend: Run Script: dev",
24+
"request": "launch",
25+
"command": "npm run dev",
26+
"cwd": "${workspaceFolder}\\insighthub-frontend"
27+
}
28+
]
29+
}

insighthub-backend/.env.template

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## This is an extra file
2+
3+
PORT=<PORT>
4+
DB_CONNECTION=<DB_CONNECTION>
5+
ACCESS_TOKEN_SECRET=<ACCESS_TOKEN_SECRET>
6+
TOKEN_EXPIRATION=<TOKEN_EXPIRATION>
7+
REFRESH_TOKEN_EXPIRATION=<REFRESH_TOKEN_EXPIRATION>
8+
FRONTEND_URL=<FRONTEND_URL>
9+
BACKEND_URL=<BACKEND_URL>
10+
FIREBASE_SERVICE_ACCOUNT={"type": "service_account","project_id": <id>,"private_key_id": <id>,"private_key": <key>,"client_email": <email>,"client_id": <clientId>,"auth_uri": "https://accounts.google.com/o/oauth2/auth","token_uri": "https://oauth2.googleapis.com/token","auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs","client_x509_cert_url": <>,"universe_domain": "googleapis.com"}
11+
OPENROUTER_API_KEY=<OPENROUTER_API_KEY>
12+
CHAT_AI_API_URL=<CHAT_AI_API_URL>
13+
OPENROUTER_MODEL_NAME=<OPENROUTER_MODEL_NAME>
14+
CHAT_AI_TURNED_ON=<CHAT_AI_TURNED_ON>

insighthub-backend/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# IDEs
2+
.idea/
3+
.vscode/
4+
5+
# Node
6+
node_modules/
7+
dist/
8+
package-lock.json
9+
openssl-secret.txt
10+
resources
11+
12+
# Environment
13+
.env
14+
15+
# Tests
16+
**/tests/reports
17+
coverage

0 commit comments

Comments
 (0)