Skip to content
This repository was archived by the owner on Aug 20, 2025. It is now read-only.
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ node_modules/
.DS_Store
.env
dist/
src/public/js/*
public/js/*
nohup.out
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lint-staged
9 changes: 0 additions & 9 deletions .prettierrc

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ WORKDIR /app
COPY package*.json ./

# Install dependencies
RUN npm ci --only=production
RUN npm ci

# Copy source code
COPY . .
Expand All @@ -22,7 +22,7 @@ RUN npm run build
FROM nginx:alpine

# Copy built files from builder stage
COPY --from=builder /app/src/public /usr/share/nginx/html
COPY --from=builder /app/dist /usr/share/nginx/html

# Copy nginx configuration
COPY nginx.conf /etc/nginx/nginx.conf
Expand Down
7 changes: 7 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"vcs": {
"enabled": true,
"clientKind": "git",
"useIgnoreFile": true
}
}
7 changes: 3 additions & 4 deletions src/public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>⚡️ Core Game Visualizer</title>
<link rel="stylesheet" href="/css/styles.css" />
<link rel="stylesheet" href="/src/css/styles.css" />
</head>
<body>
<script src="https://cdn.jsdelivr.net/npm/fireworks-js@2.x/dist/index.umd.js"></script>
<script type="module" src="/js/renderer/fireworksRenderer.js"></script>
<script type="module" src="/js/main.js"></script>
<script type="module" src="/src/ts/renderer/fireworksRenderer.ts"></script>
<script type="module" src="/src/ts/main.ts"></script>

<div class="container">
<div class="top-bar">
Expand Down
68 changes: 37 additions & 31 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,19 @@ events {
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Ensure ETag headers are generated so clients can revalidate quickly
etag on;

# Gzip compression for text-based / compressible assets
gzip on; # Enable gzip
gzip_comp_level 6; # Balance (1=fastest, 9=slowest). 6 is a good trade-off.
gzip_min_length 1024; # Only compress responses >= 1KB
gzip_vary on; # Add Vary: Accept-Encoding for proxies/CDNs
gzip_proxied any; # Allow compression for all proxied requests
gzip_disable "msie6"; # Disable for very old browsers
# Types to compress (avoid already-compressed formats like images, woff2)
gzip on;
gzip_comp_level 6;
gzip_min_length 1024;
gzip_vary on;
gzip_proxied any;
gzip_disable "msie6";
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/rss+xml
Expand All @@ -31,42 +27,52 @@ http {
font/otf
image/svg+xml;

sendfile on;
keepalive_timeout 65;
sendfile on;
keepalive_timeout 65;

server {
listen 80;
server_name localhost;
listen 80;
server_name _;

root /usr/share/nginx/html;
index index.html;

# SPA / root handler
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}

# HTML should never be aggressively cached so new deployments are seen immediately
location ~* \.html$ {
root /usr/share/nginx/html;
add_header Cache-Control "no-cache, no-store, must-revalidate" always;
# Never cache the HTML entrypoint
location = /index.html {
add_header Cache-Control "no-store, no-cache, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
}

# Handle static assets (non-hashed filenames) with a short cache + revalidation.
# We avoid 'immutable' and long max-age because filenames do not contain content hashes.
# Using a modest max-age allows brief client-side caching while ETag enables fresh checks.
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|ttf|woff|woff2)$ {
root /usr/share/nginx/html;
# Provide a single authoritative Cache-Control header (avoid duplicate via 'expires').
# max-age=300 (5 minutes) balances freshness and some caching; adjust as needed.
# Never cache the service worker
location = /sw.js {
add_header Cache-Control "no-store, no-cache, must-revalidate" always;
add_header Pragma "no-cache" always;
add_header Expires "0" always;
}

# Long-cache only hashed JS/CSS (immutable)
location ~* "-[A-Za-z0-9]{8,}\.(?:js|css)(?:\.map)?$" {
add_header Cache-Control "public, max-age=31536000, immutable" always;
}

# Short TTL for non-hashed JS/CSS
location ~* "\.(?:js|css)$" {
add_header Cache-Control "public, max-age=600, must-revalidate" always;
}

# Short TTL for images and fonts
location ~* "\.(?:png|jpg|jpeg|gif|ico|svg|ttf|woff|woff2)$" {
add_header Cache-Control "public, max-age=600, must-revalidate" always;
}

# Error pages
error_page 500 502 503 504 /50x.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
root /usr/share/nginx/html;
}
}
}
Loading