Skip to content
Closed
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
8 changes: 8 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"permissions": {
"allow": [
"WebFetch(domain:github.com)",
"Bash(npm run lint:*)"
]
}
}
8 changes: 8 additions & 0 deletions .github/workflows/backend-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ on:
paths:
- 'packages/backend/**'
- 'packages/shared-schema/**'
- 'packages/db/**'
- '.github/workflows/backend-tests.yml'
pull_request:
paths:
- 'packages/backend/**'
- 'packages/shared-schema/**'
- 'packages/db/**'
- '.github/workflows/backend-tests.yml'

jobs:
Expand Down Expand Up @@ -44,6 +46,12 @@ jobs:
- name: Install dependencies
run: npm ci

- name: Build shared-schema
run: npm run build --workspace=@boardsesh/shared-schema

- name: Build db package
run: npm run build --workspace=@boardsesh/db

- name: Run backend integration tests
run: npm run test:run --workspace=boardsesh-backend
env:
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ on:
paths:
- 'packages/web/**'
- 'packages/shared-schema/**'
- 'packages/db/**'
- '.github/workflows/test.yml'
pull_request:
branches: [ main, develop ]
paths:
- 'packages/web/**'
- 'packages/shared-schema/**'
- 'packages/db/**'
- '.github/workflows/test.yml'

jobs:
Expand All @@ -30,6 +32,12 @@ jobs:
- name: Install dependencies
run: npm ci --legacy-peer-deps

- name: Build shared-schema
run: npm run build --workspace=@boardsesh/shared-schema

- name: Build db package
run: npm run build --workspace=@boardsesh/db

- name: Run linting
run: npm run lint

Expand All @@ -55,7 +63,13 @@ jobs:

- name: Install dependencies
run: npm ci --legacy-peer-deps


- name: Build shared-schema
run: npm run build --workspace=@boardsesh/shared-schema

- name: Build db package
run: npm run build --workspace=@boardsesh/db

- name: Run tests with coverage
run: npm run test:run --workspace=@boardsesh/web -- --coverage

Expand Down
55 changes: 55 additions & 0 deletions Dockerfile.backend
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Build stage for the backend service in monorepo
FROM node:22-alpine AS builder

WORKDIR /app

# Copy package files for all workspaces
COPY package*.json ./
COPY packages/shared-schema/package*.json ./packages/shared-schema/
COPY packages/db/package*.json ./packages/db/
COPY packages/backend/package*.json ./packages/backend/

# Install all dependencies (including workspace dependencies)
RUN npm ci

# Copy source code for shared-schema, db, and backend only
COPY packages/shared-schema ./packages/shared-schema
COPY packages/db ./packages/db
COPY packages/backend ./packages/backend

# Build in dependency order: shared-schema -> db -> backend
RUN npm run build --workspace=@boardsesh/shared-schema
RUN npm run build --workspace=@boardsesh/db
RUN npm run build --workspace=boardsesh-backend

# Production stage
FROM node:22-alpine

WORKDIR /app

# Copy package files (need full workspace structure for npm to resolve)
COPY package*.json ./
COPY packages/shared-schema/package*.json ./packages/shared-schema/
COPY packages/db/package*.json ./packages/db/
COPY packages/backend/package*.json ./packages/backend/

# Copy built shared-schema and db dist BEFORE npm ci (so main entry points exist)
COPY --from=builder /app/packages/shared-schema/dist ./packages/shared-schema/dist
COPY --from=builder /app/packages/db/dist ./packages/db/dist

# Install production dependencies only
RUN npm ci --omit=dev --workspace=boardsesh-backend --workspace=@boardsesh/shared-schema --workspace=@boardsesh/db

# Copy built backend files
COPY --from=builder /app/packages/backend/dist ./packages/backend/dist

# Expose port
EXPOSE 8080

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:8080/health || exit 1

# Start the server
WORKDIR /app/packages/backend
CMD ["node", "dist/index.js"]
54 changes: 54 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
services:
postgres:
image: postgres:17
command: '-d 1'
volumes:
- db_data:/var/lib/postgresql/data
ports:
- '5432:5432'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
POSTGRES_DB: main
healthcheck:
test: ['CMD-SHELL', 'pg_isready -U postgres']
interval: 10s
timeout: 5s
retries: 5

neon-proxy:
image: ghcr.io/timowilhelm/local-neon-http-proxy:main
environment:
- PG_CONNECTION_STRING=postgres://postgres:password@postgres:5432/main
- POSTGRES_DB=main
ports:
- '4444:4444'
depends_on:
postgres:
condition: service_healthy

db_setup:
build:
context: .
dockerfile: ./packages/db/docker/Dockerfile
volumes:
- ./packages/db/docker:/db
- ./packages/db/drizzle:/app/drizzle
- ./packages/db/drizzle.config.ts:/app/drizzle.config.ts
- ./packages/db/src/schema:/app/src/schema
- ./packages/db/package.json:/app/package.json
environment:
- POSTGRES_URL=postgres://postgres:password@postgres:5432/main
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
- POSTGRES_HOST=postgres
- POSTGRES_PORT=5432
- POSTGRES_DATABASE=main
- POSTGRES_URL_NON_POOLING=postgres://postgres:password@postgres:5432/main
depends_on:
postgres:
condition: service_healthy
command: /db/setup-development-db.sh

volumes:
db_data:
Loading