Skip to content

Commit a5eec82

Browse files
authored
feat: add PostgreSQL query and visualization control (#2)
Replace the generic plugin template with a MapLibre GL control that queries PostgreSQL via a DuckDB-backed API and renders results with GeoArrow and deck.gl. Connection strings stay server-side, and an example backend attaches PostgreSQL sources as read-only DuckDB catalogs.
1 parent b8ba3b8 commit a5eec82

43 files changed

Lines changed: 7911 additions & 1190 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-pages.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,21 @@ jobs:
3030
- name: Install dependencies
3131
run: npm ci
3232

33+
- name: Install server dependencies
34+
run: npm --prefix server ci
35+
3336
- name: Run tests
3437
run: npm test
3538

39+
- name: Run server tests
40+
run: npm run server:test
41+
3642
- name: Build library
3743
run: npm run build
3844

45+
- name: Build server
46+
run: npm run server:build
47+
3948
- name: Build examples for deployment
4049
run: npm run build:examples
4150

.github/workflows/publish.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,20 @@ jobs:
2020
- name: Install dependencies
2121
run: npm ci
2222

23+
- name: Install server dependencies
24+
run: npm --prefix server ci
25+
2326
- name: Run tests
2427
run: npm test
2528

29+
- name: Run server tests
30+
run: npm run server:test
31+
2632
- name: Build
2733
run: npm run build
2834

35+
- name: Build server
36+
run: npm run server:build
37+
2938
- name: Publish to npm
3039
run: npx -y npm@latest publish --provenance --access public

Dockerfile

Lines changed: 24 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,33 @@
1-
# Build stage
2-
FROM node:26-alpine AS builder
1+
FROM node:26-alpine AS frontend
32

43
WORKDIR /app
5-
6-
# Copy package files
74
COPY package*.json ./
8-
9-
# Install dependencies
105
RUN npm ci
11-
12-
# Copy source files
136
COPY . .
7+
RUN npm test
8+
RUN npm run build && npm run build:examples
9+
10+
FROM node:26-alpine AS server
1411

15-
# Run tests
12+
WORKDIR /app/server
13+
COPY server/package*.json ./
14+
RUN npm ci
15+
COPY server ./
1616
RUN npm test
17+
RUN npm run build
1718

18-
# Build library and examples
19-
RUN npm run build && npm run build:examples
19+
FROM node:26-alpine
20+
21+
WORKDIR /app
22+
ENV NODE_ENV=production
23+
ENV PORT=3000
24+
ENV STATIC_DIR=/app/dist-examples
25+
26+
COPY --from=server /app/server/package*.json ./server/
27+
COPY --from=server /app/server/node_modules ./server/node_modules
28+
COPY --from=server /app/server/dist ./server/dist
29+
COPY --from=frontend /app/dist-examples ./dist-examples
30+
31+
EXPOSE 3000
2032

21-
# Production stage
22-
FROM nginx:alpine
23-
24-
# Copy built examples to nginx (served under /maplibre-gl-plugin-template/ to match Vite base path)
25-
COPY --from=builder /app/dist-examples /usr/share/nginx/html/maplibre-gl-plugin-template
26-
27-
# Copy custom nginx config
28-
RUN echo 'server { \
29-
listen 80; \
30-
server_name localhost; \
31-
root /usr/share/nginx/html; \
32-
index index.html; \
33-
\
34-
location /maplibre-gl-plugin-template/ { \
35-
try_files $uri $uri/ /maplibre-gl-plugin-template/index.html; \
36-
} \
37-
\
38-
location = / { \
39-
return 302 /maplibre-gl-plugin-template/; \
40-
} \
41-
}' > /etc/nginx/conf.d/default.conf
42-
43-
EXPOSE 80
44-
45-
# Startup script that prints URL and starts nginx
46-
RUN printf '#!/bin/sh\n\
47-
echo ""\n\
48-
echo "======================================================"\n\
49-
echo " MapLibre GL Plugin Template Examples"\n\
50-
echo "======================================================"\n\
51-
echo ""\n\
52-
echo " Server running on port 80"\n\
53-
echo ""\n\
54-
echo " If you ran: docker run -p 8080:80 ..."\n\
55-
echo " Open: http://localhost:8080/maplibre-gl-plugin-template/"\n\
56-
echo ""\n\
57-
echo "======================================================"\n\
58-
echo ""\n\
59-
exec nginx -g "daemon off;"\n' > /start.sh && chmod +x /start.sh
60-
61-
CMD ["/start.sh"]
33+
CMD ["node", "server/dist/index.js"]

0 commit comments

Comments
 (0)