Skip to content

Commit f2189fd

Browse files
committed
feat: migrate to Sentry.io monitoring, upgrade to Node 22, add folders to Swagger docs
- Replace Prometheus/Grafana monitoring with Sentry.io for error tracking and performance monitoring - Add PostgreSQL integration and source maps with automatic upload in production builds - Implement automated Sentry release tracking via GitHub Actions - Upgrade Node.js from 20 to 22 across all Docker images and CI/CD workflows - Add folders endpoints to OpenAPI/Swagger documentation (GET, POST, PUT, DELETE, reorder) - Add API_URL configuration for Swagger docs server URL - Remove all Prometheus metrics code and grafana/ directory - Remove New Relic change tracking workflow - Fix TypeScript and ESLint errors in WebSocket and database modules
1 parent 3d79f46 commit f2189fd

31 files changed

+1489
-2162
lines changed

.env.example

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ PORT=3000
4545
# Environment
4646
NODE_ENV=development
4747

48+
# API URL (for OpenAPI/Swagger documentation)
49+
# This sets the server URL shown in the Swagger docs
50+
# Development (default):
51+
API_URL=http://localhost:3000
52+
# Production example:
53+
# API_URL=https://api.typelets.com
54+
4855
# ================================================================
4956
# SECURITY CONFIGURATION
5057
# ================================================================
@@ -118,14 +125,18 @@ FREE_TIER_NOTE_LIMIT=100# Note count limit for free users (default: 100)
118125
# LOGGING & MONITORING
119126
# ================================================================
120127

121-
# Prometheus Metrics API Key (REQUIRED for production)
122-
# Protects /metrics endpoint from unauthorized access with Basic Auth
123-
# Generate with: openssl rand -hex 32
124-
# Configure in Grafana data source: Basic Auth with username "metrics" and password <key>
125-
METRICS_API_KEY=your-secure-metrics-api-key-here-min-32-chars
128+
# Sentry.io Error Tracking (OPTIONAL)
129+
# Get your DSN from: https://sentry.io/settings/bata-labs/projects/typelets-api/keys/
130+
# Format: https://<key>@<org-id>.ingest.us.sentry.io/<project-id>
131+
# SENTRY_DSN=https://your-sentry-dsn-here
132+
# Error tracking, performance monitoring, and profiling are enabled by default
133+
# Errors are automatically captured and sent to Sentry with full context
126134

127-
# Debug Logging
128-
# DEBUG=false # Set to true for verbose logging (not recommended in production)
135+
# Sentry Auth Token (REQUIRED for production builds with source maps)
136+
# Get from: https://sentry.io/settings/account/api/auth-tokens/
137+
# Scope needed: project:releases, project:write
138+
# SENTRY_AUTH_TOKEN=your-sentry-auth-token-here
139+
# This is only needed during production builds to upload source maps
129140

130141
# Application Logging
131142
# Structured logs are automatically generated for:
@@ -135,6 +146,7 @@ METRICS_API_KEY=your-secure-metrics-api-key-here-min-32-chars
135146
# - Billing limit violations
136147
# - WebSocket connection events
137148
# - File upload events
149+
# All console logs are also captured by Sentry for centralized monitoring
138150

139151
# ================================================================
140152
# DEVELOPMENT HELPERS

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212

1313
strategy:
1414
matrix:
15-
node-version: [20.x, 22.x]
15+
node-version: [22.x]
1616

1717
steps:
1818
- uses: actions/checkout@v4

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
- name: Setup Node.js
3535
uses: actions/setup-node@v4
3636
with:
37-
node-version: "20"
37+
node-version: "22"
3838

3939
- name: Setup pnpm
4040
uses: pnpm/action-setup@v4

.github/workflows/new-relic-change-tracking.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
- name: Setup Node.js
2222
uses: actions/setup-node@v4
2323
with:
24-
node-version: "20"
24+
node-version: "22"
2525

2626
- name: Setup pnpm
2727
uses: pnpm/action-setup@v4
@@ -32,6 +32,9 @@ jobs:
3232
run: pnpm install
3333

3434
- name: Build
35+
env:
36+
NODE_ENV: production
37+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
3538
run: NODE_OPTIONS="--max-old-space-size=8192" pnpm run build
3639

3740
- name: Release
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Sentry Release Tracking
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
sentry-release:
9+
runs-on: ubuntu-latest
10+
name: Create Sentry Release
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0 # Fetch all history for commit tracking
16+
17+
- name: Set Release Version from Tag
18+
run: echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
19+
20+
- name: Install Sentry CLI
21+
run: curl -sL https://sentry.io/get-cli/ | bash
22+
23+
- name: Create Sentry Release
24+
env:
25+
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
26+
SENTRY_ORG: bata-labs
27+
SENTRY_PROJECT: typelets-api
28+
run: |
29+
# Create new release
30+
sentry-cli releases new "${{ env.RELEASE_VERSION }}"
31+
32+
# Associate commits with the release (auto-detect from git)
33+
sentry-cli releases set-commits "${{ env.RELEASE_VERSION }}" --auto
34+
35+
# Finalize the release
36+
sentry-cli releases finalize "${{ env.RELEASE_VERSION }}"
37+
38+
echo "✅ Sentry release ${{ env.RELEASE_VERSION }} created successfully"

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# [1.10.0](https://github.com/typelets/typelets-api/compare/v1.9.0...v1.10.0) (2025-10-18)
22

3-
43
### Features
54

6-
* add Folders to Swagger and organize monitoring configs ([a483df0](https://github.com/typelets/typelets-api/commit/a483df02a05c9cc0251ee66533a0a326484a2218))
5+
- add Folders to Swagger and organize monitoring configs ([a483df0](https://github.com/typelets/typelets-api/commit/a483df02a05c9cc0251ee66533a0a326484a2218))
76

87
# [1.9.0](https://github.com/typelets/typelets-api/compare/v1.8.2...v1.9.0) (2025-10-17)
98

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Multi-stage build for Node.js backend
2-
FROM node:20-alpine AS builder
2+
FROM node:22-alpine AS builder
33

44
WORKDIR /app
55

@@ -19,7 +19,7 @@ COPY . .
1919
RUN pnpm build
2020

2121
# Production stage
22-
FROM node:20-alpine AS production
22+
FROM node:22-alpine AS production
2323

2424
WORKDIR /app
2525

0 commit comments

Comments
 (0)