Skip to main content

Development Setup

Prerequisites

ToolVersionPurpose
Node.js22+ (Alpine for Docker)JavaScript runtime
pnpm10.16.1Package manager
GitLatestVersion control

Getting Started

# Clone the repository
git clone <repo-url>
cd dtx-portal

# Install dependencies (all workspaces)
pnpm install

# Start development server
pnpm dev
# → http://localhost:3000

The dev server starts Vite with:

  • Hot Module Replacement (HMR)
  • API proxy to localhost:8080 (gateway)
  • SDG API proxy to localhost:50032

Available Scripts

Root Level

ScriptCommandWhat it Does
pnpm devpnpm --filter portal devStart Vite dev server on :3000
pnpm buildpnpm --filter portal buildTypeScript check + Vite production build
pnpm previewpnpm --filter portal previewPreview production build locally
pnpm lintpnpm --filter portal lintRun ESLint on all TS/TSX
pnpm type-checkpnpm --filter portal type-checkTypeScript check (tsc --noEmit)
pnpm testpnpm --filter portal testRun Vitest tests
pnpm test:uipnpm --filter portal test:uiVitest with visual UI dashboard

UI Package

ScriptWhat it Does
pnpm --filter @dtx/ui buildType check UI package
pnpm --filter @dtx/ui devWatch mode type checking
pnpm --filter @dtx/ui lintLint UI package
pnpm --filter @dtx/ui lint:fixAuto-fix lint issues

Dev Server Proxy Configuration

During development, Vite proxies API calls to backend services:

In deployed environments, Nginx handles proxying to all 8 backend services.


Linting & Code Quality

ESLint Configuration

Format: ESLint 9 flat config (eslint.config.js)

PluginPurpose
@eslint/jsRecommended JS rules
@typescript-eslintTypeScript-specific rules
eslint-plugin-react-hooksReact Hooks rules
eslint-plugin-react-refreshHMR compatibility warnings

Key Rules:

  • @typescript-eslint/no-unused-vars: error (ignores _ prefixed args)
  • react-refresh/only-export-components: warn (for HMR compatibility)
  • No Prettier — formatting is handled by ESLint only

Testing

Framework

ToolVersionPurpose
Vitest3.2.4Test runner
@testing-library/react16.3.0Component testing
@testing-library/jest-dom6.8.0DOM assertion matchers
@testing-library/user-event14.6.1User interaction simulation
jsdom27.0.0Browser environment
@vitest/ui3.2.4Visual test dashboard

Configuration

// apps/portal/vitest.config.ts
export default defineConfig({
plugins: [react()],
test: {
globals: true, // No need to import describe/it/expect
environment: 'jsdom', // Browser-like environment
setupFiles: './src/test/setup.ts',
css: true, // Process CSS imports
},
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
'@dtx/ui': path.resolve(__dirname, '../../packages/ui/src'),
'@dtx/utils': path.resolve(__dirname, '../../packages/utils/src'),
},
},
});

Status: Testing infrastructure is configured. Test coverage is being built out.


Docker Build

Multi-stage build: Node 22 Alpine for building, Nginx Alpine for serving.

# Stage 1: Build
FROM node:22-alpine AS builder
WORKDIR /app
RUN npm install -g pnpm@10.16.1
COPY . .
RUN pnpm install --no-frozen-lockfile
RUN cd apps/portal && pnpm vite build --mode production

# Stage 2: Serve with Nginx
FROM nginx:alpine
COPY --from=builder /app/apps/portal/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]

Nginx Reverse Proxy

Nginx serves static files and proxies API calls to backend services:

LocationProxies To
/proxy/pipeline/Pipeline Service :50002
/proxy/operator/Operator Service :50001
/proxy/schema/Schema Registry :50031
/proxy/sdg/SDG Service :50032
/proxy/kafka/Kafka Service :50034
/proxy/cache/Cache Service :50035
/proxy/expressions/Expression Service :50001
/proxy/observability/Observability :50010
/api/API Gateway :8080

Deployment

Environments

EnvironmentServerPortContainer
DEV100.91.186.8930000dtx-portal-dev
TEST100.110.45.4130000dtx-portal-test
ProductionTBDTBDTBD

Deployment Process

Deploy via shell scripts:

  • deploy-dev.sh — Deploy to DEV environment
  • deploy-test.sh — Deploy to TEST environment

No CI/CD pipeline is configured yet. Deployments are manual.