Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/backend-deploy-coverage-report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Backend - Deploy coverage report to Pages

on:
push:
branches: ['main']

workflow_dispatch:

concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
deploy:
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: insighthub-backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create envfile
uses: SpicyPizza/create-envfile@v2.0.3
with:
envkey_PORT: 3000
envkey_DB_CONNECTION: mongodb://localhost:27017/app
envkey_ACCESS_TOKEN_SECRET: 2a955a8b802eab6c693ba116f5e1bc8d2d2cf5e5e83e579cecb3fc363fb077229a801e7392f348d3c370e2383169cab80f556421d3ec2186def5d36ed5a317b6
envkey_TOKEN_EXPIRATION: 30s
envkey_REFRESH_TOKEN_SECRET: 2a955a8b802eab6c693ba116f5e1bc8d2d2cf5e5e83e579cecb3fc363fb077229a801e7392f348d3c370e2383169cab80f556421d3ec2186def5d36ed5a317b6
envkey_REFRESH_TOKEN_EXPIRATION: 1d
file_name: insighthub-backend/.env
fail_on_empty: true
sort_keys: false
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.10.0
with:
mongodb-version: '6.0'
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm i
- name: Run tests
run: npm run test -- --testTimeout=30000
- name: Setup Pages
if: always()
uses: actions/configure-pages@v4
- name: Upload Artifact
if: always()
uses: actions/upload-pages-artifact@v3
with:
path: 'insighthub-backend/coverage/lcov-report'
name: 'github-pages'
- name: Deploy to GitHub Pages
if: always()
id: deployment
uses: actions/deploy-pages@v4
41 changes: 41 additions & 0 deletions .github/workflows/backend-run-all-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Backend - Run all tests

on:
push:
branches: ['*']
pull_request:
branches: ['*']

jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: insighthub-backend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create envfile
uses: SpicyPizza/create-envfile@v2.0.3
with:
envkey_PORT: 3000
envkey_DB_CONNECTION: mongodb://localhost:27017/app
envkey_ACCESS_TOKEN_SECRET: 2a955a8b802eab6c693ba116f5e1bc8d2d2cf5e5e83e579cecb3fc363fb077229a801e7392f348d3c370e2383169cab80f556421d3ec2186def5d36ed5a317b6
envkey_TOKEN_EXPIRATION: 30s
envkey_REFRESH_TOKEN_SECRET: 2a955a8b802eab6c693ba116f5e1bc8d2d2cf5e5e83e579cecb3fc363fb077229a801e7392f348d3c370e2383169cab80f556421d3ec2186def5d36ed5a317b6
envkey_REFRESH_TOKEN_EXPIRATION: 1d
envkey_CHAT_AI_TURNED_ON: false
file_name: insighthub-backend/.env
fail_on_empty: true
sort_keys: false
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.10.0
with:
mongodb-version: '6.0'
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm i
- name: Run tests
run: npm run test -- --testTimeout=30000
32 changes: 32 additions & 0 deletions .github/workflows/frontend-run-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Frontend - Run build

on:
push:
branches: ['*']
pull_request:
branches: ['*']

jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: insighthub-frontend
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create envfile
uses: SpicyPizza/create-envfile@v2.0.3
with:
envkey_VITE_PORT: 5000
envkey_VITE_BACKEND_URL: http://localhost:3000
file_name: insighthub-frontend/.env
fail_on_empty: true
sort_keys: false
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm i
- name: Run build
run: npm run build
133 changes: 133 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/
package-lock.json

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
/.idea
.DS_Store
29 changes: 29 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node-terminal",
"name": "Backend: Run Script: dev",
"request": "launch",
"command": "npm run dev",
"cwd": "${workspaceFolder}\\insighthub-backend"
},
{
"type": "node-terminal",
"name": "Backend: Run Script: test",
"request": "launch",
"command": "npm run test",
"cwd": "${workspaceFolder}\\insighthub-backend"
},
{
"type": "node-terminal",
"name": "Frontend: Run Script: dev",
"request": "launch",
"command": "npm run dev",
"cwd": "${workspaceFolder}\\insighthub-frontend"
}
]
}
14 changes: 14 additions & 0 deletions insighthub-backend/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## This is an extra file

PORT=<PORT>
DB_CONNECTION=<DB_CONNECTION>
ACCESS_TOKEN_SECRET=<ACCESS_TOKEN_SECRET>
TOKEN_EXPIRATION=<TOKEN_EXPIRATION>
REFRESH_TOKEN_EXPIRATION=<REFRESH_TOKEN_EXPIRATION>
FRONTEND_URL=<FRONTEND_URL>
BACKEND_URL=<BACKEND_URL>
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"}
OPENROUTER_API_KEY=<OPENROUTER_API_KEY>
CHAT_AI_API_URL=<CHAT_AI_API_URL>
OPENROUTER_MODEL_NAME=<OPENROUTER_MODEL_NAME>
CHAT_AI_TURNED_ON=<CHAT_AI_TURNED_ON>
17 changes: 17 additions & 0 deletions insighthub-backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# IDEs
.idea/
.vscode/

# Node
node_modules/
dist/
package-lock.json
openssl-secret.txt
resources

# Environment
.env

# Tests
**/tests/reports
coverage
Loading
Loading