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
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ FRONTEND_URL=http://localhost:3001
THROTTLE_TTL=60000
THROTTLE_LIMIT=60

# Sentry
SENTRY_DSN=your_sentry_dsn_here
GIT_COMMIT_SHA=

# Frontend
NEXT_PUBLIC_API_URL=http://localhost:3000
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_SENTRY_DSN=your_sentry_dsn_here
NEXT_PUBLIC_GIT_COMMIT_SHA=
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:

- name: Build backend
run: npm run build --workspace=apps/backend
env:
GIT_COMMIT_SHA: ${{ github.sha }}

- name: Run unit tests with coverage
run: npx jest --coverage --passWithNoTests
Expand Down Expand Up @@ -125,6 +127,8 @@ jobs:

- name: Build frontend
run: npm run build --workspace=apps/frontend
env:
NEXT_PUBLIC_GIT_COMMIT_SHA: ${{ github.sha }}

chromatic-visual-tests:
name: Frontend - Visual Regression Tests (Chromatic)
Expand Down
52 changes: 51 additions & 1 deletion apps/backend/.env.example
Original file line number Diff line number Diff line change
@@ -1 +1,51 @@
ALLOWED_ORIGINS=http://localhost:3001,http://localhost:3000,https://yourdomain.com
# Server
PORT=3000

# Logging
LOG_LEVEL=info

# Database
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_USER=your_db_user
DATABASE_PASSWORD=your_db_password
DATABASE_NAME=brain-storm

# Auth
JWT_SECRET=your_jwt_secret

# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_CALLBACK_URL=http://localhost:3000/auth/google/callback

# Stellar
STELLAR_NETWORK=testnet
STELLAR_SECRET_KEY=your_stellar_secret_key
STELLAR_HORIZON_URL=https://horizon-testnet.stellar.org

# Soroban
SOROBAN_RPC_URL=https://soroban-testnet.stellar.org
ANALYTICS_CONTRACT_ID=your_analytics_contract_id
TOKEN_CONTRACT_ID=your_token_contract_id

# Redis
REDIS_URL=redis://localhost:6379

# Throttler
THROTTLE_TTL=60000
THROTTLE_LIMIT=100

# Email
EMAIL_ENABLED=false
EMAIL_HOST=smtp.example.com
EMAIL_PORT=587
EMAIL_SECURE=false
EMAIL_USER=your_email_user
EMAIL_PASS=your_email_password
EMAIL_FROM="Brain Storm" <no-reply@brainstorm.app>
FRONTEND_URL=http://localhost:3001

# Sentry
SENTRY_DSN=your_sentry_dsn_here
GIT_COMMIT_SHA=
1 change: 1 addition & 0 deletions apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@nestjs/swagger": "^7.0.0",
"@nestjs/throttler": "^6.0.0",
"@nestjs/typeorm": "^10.0.0",
"@sentry/nestjs": "^8.0.0",
"@stellar/stellar-sdk": "^12.0.0",
"bcrypt": "^5.1.0",
"cache-manager": "^7.2.8",
Expand Down
24 changes: 24 additions & 0 deletions apps/backend/src/instrument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as Sentry from '@sentry/nestjs';
import { nodeProfilingIntegration } from '@sentry/profiling-node';

// Initialize Sentry before any other imports
Sentry.init({
dsn: process.env.SENTRY_DSN,
environment: process.env.NODE_ENV || 'development',
release: process.env.GIT_COMMIT_SHA || 'unknown',
integrations: [
nodeProfilingIntegration(),
],
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
profilesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
beforeSend(event, hint) {
// Filter out sensitive data
if (event.request) {
delete event.request.cookies;
if (event.request.headers) {
delete event.request.headers['authorization'];
}
}
return event;
},
});
1 change: 1 addition & 0 deletions apps/backend/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './instrument';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
Expand Down
4 changes: 4 additions & 0 deletions apps/frontend/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
NEXT_PUBLIC_API_URL=http://localhost:3000
NEXT_PUBLIC_STELLAR_NETWORK=testnet
NEXT_PUBLIC_SENTRY_DSN=your_sentry_dsn_here
NEXT_PUBLIC_GIT_COMMIT_SHA=
2 changes: 2 additions & 0 deletions apps/frontend/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const nextConfig = {
env: {
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
NEXT_PUBLIC_STELLAR_NETWORK: process.env.NEXT_PUBLIC_STELLAR_NETWORK,
NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,
NEXT_PUBLIC_GIT_COMMIT_SHA: process.env.NEXT_PUBLIC_GIT_COMMIT_SHA,
},
images: {
remotePatterns: [
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@sentry/nextjs": "^8.0.0",
"@stellar/freighter-api": "^6.0.1",
"@stellar/stellar-sdk": "^12.0.0",
"axios": "^1.7.0",
Expand Down
23 changes: 23 additions & 0 deletions apps/frontend/sentry.client.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import * as Sentry from '@sentry/nextjs';

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
environment: process.env.NODE_ENV || 'development',
release: process.env.NEXT_PUBLIC_GIT_COMMIT_SHA || 'unknown',
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
integrations: [
Sentry.replayIntegration({
maskAllText: true,
blockAllMedia: true,
}),
],
beforeSend(event, hint) {
// Filter sensitive data
if (event.request) {
delete event.request.cookies;
}
return event;
},
});
8 changes: 8 additions & 0 deletions apps/frontend/sentry.edge.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as Sentry from '@sentry/nextjs';

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
environment: process.env.NODE_ENV || 'development',
release: process.env.NEXT_PUBLIC_GIT_COMMIT_SHA || 'unknown',
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
});
18 changes: 18 additions & 0 deletions apps/frontend/sentry.server.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as Sentry from '@sentry/nextjs';

Sentry.init({
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
environment: process.env.NODE_ENV || 'development',
release: process.env.NEXT_PUBLIC_GIT_COMMIT_SHA || 'unknown',
tracesSampleRate: process.env.NODE_ENV === 'production' ? 0.1 : 1.0,
beforeSend(event, hint) {
// Filter sensitive data
if (event.request) {
delete event.request.cookies;
if (event.request.headers) {
delete event.request.headers['authorization'];
}
}
return event;
},
});