Skip to content

Commit 128bfda

Browse files
committed
Add analytics skeleton and healthcheck
1 parent 9651684 commit 128bfda

18 files changed

Lines changed: 362 additions & 0 deletions
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
module.exports = {
2+
parser: '@typescript-eslint/parser',
3+
parserOptions: {
4+
project: 'tsconfig.json',
5+
tsconfigRootDir: __dirname,
6+
sourceType: 'module',
7+
},
8+
plugins: ['@typescript-eslint/eslint-plugin'],
9+
extends: [
10+
'plugin:@typescript-eslint/recommended',
11+
'plugin:prettier/recommended',
12+
],
13+
root: true,
14+
env: {
15+
node: true,
16+
jest: true,
17+
},
18+
ignorePatterns: ['.eslintrc.js'],
19+
rules: {
20+
'@typescript-eslint/interface-name-prefix': 'off',
21+
'@typescript-eslint/explicit-function-return-type': 'off',
22+
'@typescript-eslint/explicit-module-boundary-types': 'off',
23+
'@typescript-eslint/no-explicit-any': 'off',
24+
},
25+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# compiled output
2+
/dist
3+
/node_modules
4+
5+
# Logs
6+
logs
7+
*.log
8+
npm-debug.log*
9+
pnpm-debug.log*
10+
yarn-debug.log*
11+
yarn-error.log*
12+
lerna-debug.log*
13+
14+
# OS
15+
.DS_Store
16+
17+
# Tests
18+
/coverage
19+
/.nyc_output
20+
21+
# IDEs and editors
22+
/.idea
23+
.project
24+
.classpath
25+
.c9/
26+
*.launch
27+
.settings/
28+
*.sublime-workspace
29+
30+
# IDE - VSCode
31+
.vscode/*
32+
!.vscode/settings.json
33+
!.vscode/tasks.json
34+
!.vscode/launch.json
35+
!.vscode/extensions.json
36+
# Sentry Config File
37+
.sentryclirc
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<div align="center">
2+
3+
<a href="">![E2E Tests](https://img.shields.io/github/actions/workflow/status/GTBitsOfGood/juno/e2e-tests.yml?style=for-the-badge)</a>
4+
<a href="">![GitHub Releases](https://img.shields.io/github/v/release/GTBitsOfGood/juno?include_prereleases&style=for-the-badge)</a>
5+
<a href="">![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge&logo=typescript&logoColor=white)</a>
6+
7+
</div>
8+
9+
<h3 align="center">
10+
@juno/analytics-service
11+
</h3>
12+
13+
<div align="center">
14+
15+
[Bits of Good](https://bitsofgood.org/)'s central infrastructure API, integrating several in-house services to simplify and streamline project development.
16+
17+
<br />
18+
<a href="https://github.com/GTBitsOfGood/juno/blob/ryder/documentation-overhaul/README.md"><strong>« Back to main README</strong></a>
19+
20+
</div>
21+
22+
## Analytics Service
23+
24+
README in progress!
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://json.schemastore.org/nest-cli",
3+
"collection": "@nestjs/schematics",
4+
"sourceRoot": "src",
5+
"compilerOptions": {
6+
"deleteOutDir": true,
7+
"assets": ["../proto/analytics-service/*.proto"],
8+
"watchAssets": true
9+
}
10+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"name": "analytics-service",
3+
"version": "0.0.1",
4+
"description": "",
5+
"author": "",
6+
"private": true,
7+
"license": "UNLICENSED",
8+
"scripts": {
9+
"build": "nest build && npm run sentry:sourcemaps",
10+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
11+
"start": "nest start",
12+
"start:dev": "pnpm start --watch",
13+
"start:debug": "pnpm start --debug --watch",
14+
"start:prod": "node dist/main",
15+
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
16+
"test": "jest",
17+
"test:watch": "jest --watch",
18+
"test:cov": "jest --coverage",
19+
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
20+
"test:e2e": "jest --config ./test/jest-e2e.json --runInBand",
21+
"test:e2e:watch": "jest --config ./test/jest-e2e.json --runInBand --watchAll",
22+
"tsc": "tsc",
23+
"sentry:sourcemaps": "sentry-cli sourcemaps inject --org bits-of-good-development --project juno-analytics-service ./dist && sentry-cli sourcemaps upload --org bits-of-good-development --project juno-analytics-service ./dist"
24+
},
25+
"dependencies": {
26+
"@grpc/grpc-js": "^1.9.7",
27+
"@grpc/proto-loader": "^0.7.10",
28+
"@nestjs/common": "^10.0.0",
29+
"@nestjs/config": "^3.1.1",
30+
"@nestjs/core": "^10.0.0",
31+
"@nestjs/microservices": "^10.2.7",
32+
"@nestjs/platform-express": "^10.0.0",
33+
"@sendgrid/mail": "^8.1.3",
34+
"@sentry/cli": "^2.36.3",
35+
"@sentry/nestjs": "^8.29.0",
36+
"@sentry/profiling-node": "^8.29.0",
37+
"axios": "^1.7.7",
38+
"juno-proto": "file:../proto",
39+
"reflect-metadata": "^0.1.13",
40+
"rxjs": "^7.8.1"
41+
},
42+
"devDependencies": {
43+
"@nestjs/cli": "^10.0.0",
44+
"@nestjs/schematics": "^10.0.0",
45+
"@nestjs/testing": "^10.0.0",
46+
"@types/bcrypt": "^5.0.2",
47+
"@types/express": "^4.17.17",
48+
"@types/jest": "^29.5.2",
49+
"@types/jsonwebtoken": "^9.0.5",
50+
"@types/node": "^20.3.1",
51+
"@types/supertest": "^2.0.12",
52+
"@typescript-eslint/eslint-plugin": "^6.0.0",
53+
"@typescript-eslint/parser": "^6.0.0",
54+
"eslint": "^8.42.0",
55+
"eslint-config-prettier": "^9.0.0",
56+
"eslint-plugin-prettier": "^5.0.0",
57+
"jest": "^29.5.0",
58+
"prettier": "^3.0.0",
59+
"source-map-support": "^0.5.21",
60+
"supertest": "^6.3.3",
61+
"ts-jest": "^29.1.0",
62+
"ts-loader": "^9.4.3",
63+
"ts-node": "^10.9.1",
64+
"tsconfig-paths": "^4.2.0",
65+
"typescript": "^5.1.3"
66+
},
67+
"jest": {
68+
"moduleFileExtensions": [
69+
"js",
70+
"json",
71+
"ts"
72+
],
73+
"rootDir": "src",
74+
"testRegex": ".*\\.spec\\.ts$",
75+
"transform": {
76+
"^.+\\.(t|j)s$": "ts-jest"
77+
},
78+
"collectCoverageFrom": [
79+
"**/*.(t|j)s"
80+
],
81+
"coverageDirectory": "../coverage",
82+
"testEnvironment": "node"
83+
}
84+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
describe('AppController', () => {
2+
beforeEach(async () => {});
3+
});
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Controller } from '@nestjs/common';
2+
import { AppService } from './app.service';
3+
4+
@Controller()
5+
export class AppController {
6+
constructor(private readonly appService: AppService) {}
7+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Module } from '@nestjs/common';
2+
import { AppController } from './app.controller';
3+
import { AppService } from './app.service';
4+
import { SentryModule } from '@sentry/nestjs/setup';
5+
import { HealthModule } from './modules/health/health.module';
6+
7+
@Module({
8+
imports: [SentryModule.forRoot(), HealthModule],
9+
controllers: [AppController],
10+
providers: [AppService],
11+
})
12+
export class AppModule {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { Injectable } from '@nestjs/common';
2+
@Injectable()
3+
export class AppService {}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import * as Sentry from '@sentry/nestjs';
2+
import { nodeProfilingIntegration } from '@sentry/profiling-node';
3+
4+
// Ensure to call this before importing any other modules!
5+
Sentry.init({
6+
dsn: process.env.SENTRY_DSN,
7+
integrations: [
8+
// Add our Profiling integration
9+
nodeProfilingIntegration(),
10+
],
11+
12+
// Add Tracing by setting tracesSampleRate
13+
// We recommend adjusting this value in production
14+
tracesSampleRate: 1.0,
15+
16+
// Set sampling rate for profiling
17+
// This is relative to tracesSampleRate
18+
profilesSampleRate: 1.0,
19+
});

0 commit comments

Comments
 (0)