This commit is contained in:
MangoPig
2026-05-10 16:47:34 +01:00
commit 0fdec18a15
16 changed files with 6944 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

13
Caddyfile Normal file
View File

@@ -0,0 +1,13 @@
{
auto_https off
}
:80 {
handle /health {
respond "ok" 200
}
handle {
reverse_proxy {$FRONTEND_UPSTREAM}
}
}

45
Frontend/Earthfile Normal file
View File

@@ -0,0 +1,45 @@
VERSION 0.8
node-base:
FROM node:24.12.0-alpine
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@10.24.0 --activate
COPY package.json pnpm-lock.yaml ./
deps:
FROM +node-base
RUN pnpm install --frozen-lockfile
build:
FROM +deps
COPY . .
RUN pnpm build
SAVE ARTIFACT dist AS LOCAL ./dist
dev-image:
ARG REGISTRY="registry.mangopig.tech"
ARG IMAGE_NAME="boost-ai/demo-frontend-dev"
ARG TAG="latest"
FROM +deps
COPY . .
ENV HOST=0.0.0.0
ENV PORT=4321
EXPOSE 4321
SAVE IMAGE $IMAGE_NAME:$TAG
SAVE IMAGE --push $REGISTRY/$IMAGE_NAME:$TAG
# image:
# ARG REGISTRY="registry.mangopig.tech"
# ARG IMAGE_NAME="boost-ai/demo"
# ARG TAG="latest"
# FROM nginx:1.29-alpine
# COPY +build/dist /tmp/dist
# RUN rm -rf /usr/share/nginx/html/* && cp -R /tmp/dist/. /usr/share/nginx/html/
# COPY nginx.conf /etc/nginx/conf.d/default.conf
# EXPOSE 80
# SAVE IMAGE boost-ai/demo-frontend:latest
# SAVE IMAGE --push $REGISTRY/$IMAGE_NAME:$TAG

27
Frontend/package.json Normal file
View File

@@ -0,0 +1,27 @@
{
"name": "example-bare",
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"start": "vite start",
"preview": "vite preview"
},
"dependencies": {
"@solidjs/start": "2.0.0-alpha.2",
"@solidjs/vite-plugin-nitro-2": "^0.1.0",
"solid-js": "^1.9.5",
"vite": "^7.0.0"
},
"engines": {
"node": ">=22"
},
"devDependencies": {
"@types/node": "^25.6.2",
"autoprefixer": "^10.5.0",
"cssnano": "^8.0.1",
"postcss": "^8.5.14",
"postcss-preset-env": "^11.2.1",
"sass": "^1.99.0"
}
}

6705
Frontend/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,5 @@
// Path: Frontend/postcss.config.cjs
module.exports = {
plugins: [require("autoprefixer"), require("postcss-preset-env"), require("cssnano")],
};

BIN
Frontend/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

13
Frontend/src/app.tsx Normal file
View File

@@ -0,0 +1,13 @@
// Path: Frontend/src/app.tsx
import { createSignal } from "solid-js";
export default function App() {
const [count, setCount] = createSignal(0);
return (
<main>
<h1>AI</h1>
</main>
);
}

View File

@@ -0,0 +1,6 @@
// Path: src/entry-client.tsx
// @refresh reload
import { mount, StartClient } from "@solidjs/start/client";
mount(() => <StartClient />, document.getElementById("app")!);

View File

@@ -0,0 +1,23 @@
// Path: src/entry-server.tsx
// @refresh reload
import { createHandler, StartServer } from "@solidjs/start/server";
export default createHandler(() => (
<StartServer
document={({ assets, children, scripts }) => (
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
{assets}
</head>
<body>
<div id="app">{children}</div>
{scripts}
</body>
</html>
)}
/>
));

3
Frontend/src/global.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
// Path: src/global.d.ts
/// <reference types="@solidjs/start/env" />

19
Frontend/tsconfig.json Normal file
View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "bundler",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"strict": true,
"noEmit": true,
"types": ["vite/client"],
"isolatedModules": true,
"paths": {
"~/*": ["./src/*"]
}
}
}

17
Frontend/vite.config.ts Normal file
View File

@@ -0,0 +1,17 @@
// Path: Frontend/vite.config.ts
import { solidStart } from "@solidjs/start/config";
import { nitroV2Plugin as nitro } from "@solidjs/vite-plugin-nitro-2";
import { defineConfig } from "vite";
const extraAllowedHosts = (process.env.ALLOWED_HOSTS ?? "")
.split(",")
.map((host) => host.trim())
.filter(Boolean);
export default defineConfig({
plugins: [solidStart(), nitro()],
server: {
allowedHosts: ["localhost", ...extraAllowedHosts],
},
});

38
Makefile Normal file
View File

@@ -0,0 +1,38 @@
SHELL := /bin/bash
.DEFAULT_GOAL := help
.PHONY: help guard-dev-tag down dev dev-build dev-up
FRONTEND_DIR := Frontend
FRONTEND_DIST_DIR := $(FRONTEND_DIR)/dist
BACKEND_DIR := Backend
BACKEND_TMP_DIR := $(BACKEND_DIR)/tmp
EARTHLY ?= earthly
COMPOSE ?= docker compose
help: ## Show this help message
@echo "Usage: make [target]"
@echo ""
@echo "Available targets:"
@awk 'BEGIN {FS = ":.*## "}; /^[a-zA-Z0-9_.-]+:.*## / {printf " %-12s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
guard-dev-tag:
@if [ -z "$(DEV_TAG)" ]; then \
echo "Error: DEV_TAG is not set. Please provide a tag for the development image."; \
exit 1; \
fi
down: ## Stop all servers and clean up temporary files
@DEV_TAG=$${DEV_TAG:-dummy} $(COMPOSE) -f docker-compose.dev.yaml down --remove-orphans
@rm -rf "$(BACKEND_TMP_DIR)" "$(FRONTEND_DIST_DIR)"
dev: guard-dev-tag ## Start the development server
@$(MAKE) dev-build DEV_TAG=$(DEV_TAG)
@$(MAKE) dev-up DEV_TAG=$(DEV_TAG)
dev-build: guard-dev-tag ## Build the development image for the frontend
@cd "$(FRONTEND_DIR)" && $(EARTHLY) +dev-image --REGISTRY="registry.mangopig.tech" --IMAGE_NAME="boost-ai/demo-frontend-dev" --TAG=$(DEV_TAG)
dev-up: guard-dev-tag ## Start the development server using docker compose
@DEV_TAG=$(DEV_TAG) $(COMPOSE) -f docker-compose.dev.yaml up -d --remove-orphans --force-recreate

1
README.md Normal file
View File

@@ -0,0 +1 @@
# BoostAI

28
docker-compose.dev.yaml Normal file
View File

@@ -0,0 +1,28 @@
services:
caddy:
image: caddy:2-alpine
container_name: caddy
restart: unless-stopped
environment:
- FRONTEND_UPSTREAM=frontend-dev:4321
ports:
- "8080:80"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile
depends_on:
- frontend-dev
frontend-dev:
image: boost-ai/demo-frontend-dev:${DEV_TAG:?error DEV_TAG environment variable not set}
container_name: frontend-dev
restart: unless-stopped
volumes:
- ./Frontend:/app
- BoostAI_node_modules:/app/node_modules
command: ["pnpm", "dev", "--host", "0.0.0.0", "--port", "4321"]
environment:
- NODE_ENV=development
- ALLOWED_HOSTS=windows-wsl
volumes:
BoostAI_node_modules: