Skip to content

Commit f93fdb8

Browse files
authored
Merge pull request #148 from HyperscapeAI/feature/admin-system-consolidated
feat: admin system and AI content generation consolidation
2 parents e3e2f4f + 63d1bb5 commit f93fdb8

699 files changed

Lines changed: 88593 additions & 81608 deletions

File tree

Some content is hidden

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

.dockerignore

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
node_modules
2+
npm-debug.log
3+
.DS_Store
4+
.env.local
5+
.env.*.local
6+
dist
7+
build
8+
.git
9+
.gitignore
10+
README.md
11+
.vscode
12+
.idea
13+
*.log
14+
coverage
15+
.nyc_output
16+
temp-images
17+
gdd-assets
18+
apps/asset-forge/node_modules
19+
apps/asset-forge/dist
20+
apps/asset-forge/.vite
21+
packages/*/node_modules
22+
packages/*/dist

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ tmp/
5858
# Assets (generated/temporary)
5959
assets/
6060

61+
# Cloned assets repository (too large for codebase)
62+
hyperscape-assets/
63+
6164
# 3D Models from hyperscape/assets repository
6265
packages/client/src/public/models/
6366
packages/client/dist/models/

.gitignore.local

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Local-only ignores (not committed to repo)
2+
# Add this to your global git config:
3+
# git config core.excludesfile .gitignore.local
4+
5+
# Temporary assets clone
6+
.temp-assets/
7+
hyperscape-assets/

Dockerfile.api

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM oven/bun:1
2+
3+
# Install Python and build dependencies for native modules
4+
RUN apt-get update && apt-get install -y \
5+
python3 \
6+
python3-pip \
7+
make \
8+
g++ \
9+
&& rm -rf /var/lib/apt/lists/*
10+
11+
WORKDIR /app
12+
13+
# Copy package files (bun.lockb may not exist)
14+
COPY package.json ./
15+
COPY bun.lock* ./
16+
COPY apps/api/package.json ./apps/api/
17+
18+
# Install dependencies
19+
RUN bun install
20+
21+
# Copy application code
22+
COPY apps/api ./apps/api
23+
24+
# Expose port
25+
EXPOSE 3004
26+
27+
# Health check
28+
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
29+
CMD curl -f http://localhost:3004/api/health || exit 1
30+
31+
# Start command (overridden by docker-compose)
32+
CMD ["bun", "run", "dev"]

apps/api/.dockerignore

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Dependencies
2+
node_modules
3+
npm-debug.log
4+
yarn-error.log
5+
bun.lockb
6+
7+
# Development
8+
.env
9+
.env.local
10+
.env.*.local
11+
12+
# IDE
13+
.vscode
14+
.idea
15+
*.swp
16+
*.swo
17+
*~
18+
19+
# OS
20+
.DS_Store
21+
Thumbs.db
22+
23+
# Git
24+
.git
25+
.gitignore
26+
.gitattributes
27+
28+
# Documentation
29+
README.md
30+
*.md
31+
!env.example
32+
33+
# Temporary files
34+
temp-images/*
35+
!temp-images/.gitkeep
36+
37+
# Build artifacts
38+
dist
39+
build
40+
.cache
41+
42+
# Testing
43+
coverage
44+
.nyc_output
45+
*.test.js
46+
*.spec.js
47+
48+
# Docker
49+
Dockerfile
50+
.dockerignore
51+
docker-compose.yml
52+
53+
# Logs
54+
logs
55+
*.log

apps/api/.env.example

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
# =============================================================================
2+
# ASSET FORGE API - Environment Configuration
3+
# =============================================================================
4+
5+
# -----------------------------------------------------------------------------
6+
# AI PROVIDERS
7+
# -----------------------------------------------------------------------------
8+
9+
# OpenAI (Required for direct access)
10+
# Get your key at: https://platform.openai.com/api-keys
11+
OPENAI_API_KEY=sk-...
12+
13+
# Meshy AI (Required for 3D model generation)
14+
# Get your key at: https://www.meshy.ai/api
15+
MESHY_API_KEY=...
16+
17+
# Vercel AI Gateway (Optional - Recommended)
18+
# Provides unified access to all AI providers with analytics and cost tracking
19+
# Get your key at: https://vercel.com/docs/ai-gateway
20+
# If set, this will be used instead of direct provider keys
21+
AI_GATEWAY_API_KEY=
22+
23+
# Anthropic (Optional - For Claude models)
24+
# Get your key at: https://console.anthropic.com/
25+
ANTHROPIC_API_KEY=
26+
27+
# OpenRouter (Optional - For multi-provider access)
28+
# Get your key at: https://openrouter.ai/
29+
OPENROUTER_API_KEY=
30+
31+
# -----------------------------------------------------------------------------
32+
# DATABASE (PostgreSQL)
33+
# -----------------------------------------------------------------------------
34+
35+
# Database connection (auto-configured by docker-compose)
36+
DB_HOST=postgres
37+
DB_PORT=5432
38+
DB_NAME=asset_forge
39+
DB_USER=asset_forge
40+
DB_PASSWORD=asset_forge_dev_password_2024
41+
42+
# Note: For production, change these credentials and use strong passwords!
43+
44+
# -----------------------------------------------------------------------------
45+
# SERVER CONFIGURATION
46+
# -----------------------------------------------------------------------------
47+
48+
# API Server
49+
PORT=3004
50+
NODE_ENV=development
51+
52+
# Frontend URL (for CORS)
53+
FRONTEND_URL=http://localhost:3000
54+
55+
# Image Server URL (for Meshy.ai to access concept art)
56+
# In development: http://localhost:3004
57+
# In production: Your public domain
58+
IMAGE_SERVER_URL=http://localhost:3004
59+
60+
# -----------------------------------------------------------------------------
61+
# MESHY CONFIGURATION
62+
# -----------------------------------------------------------------------------
63+
64+
# Meshy API Settings
65+
MESHY_POLL_INTERVAL_MS=5000
66+
MESHY_TIMEOUT_MS=300000
67+
68+
# Quality-specific timeouts
69+
MESHY_TIMEOUT_STANDARD_MS=300000
70+
MESHY_TIMEOUT_HIGH_MS=450000
71+
MESHY_TIMEOUT_ULTRA_MS=600000
72+
73+
# Quality-specific models
74+
MESHY_MODEL_STANDARD=meshy-4
75+
MESHY_MODEL_HIGH=meshy-5
76+
MESHY_MODEL_ULTRA=meshy-5
77+
MESHY_MODEL_DEFAULT=meshy-5
78+
79+
# -----------------------------------------------------------------------------
80+
# AUTHENTICATION (Optional - For production)
81+
# -----------------------------------------------------------------------------
82+
83+
# Privy (for user authentication)
84+
# PRIVY_APP_ID=
85+
# PRIVY_APP_SECRET=
86+
87+
# -----------------------------------------------------------------------------
88+
# FEATURES FLAGS
89+
# -----------------------------------------------------------------------------
90+
91+
# Enable specific features
92+
ENABLE_GPT4_ENHANCEMENT=true
93+
ENABLE_RETEXTURING=true
94+
ENABLE_RIGGING=true
95+
96+
# -----------------------------------------------------------------------------
97+
# DEVELOPMENT
98+
# -----------------------------------------------------------------------------
99+
100+
# Debug logging
101+
DEBUG=false
102+
LOG_LEVEL=info
103+
104+
# -----------------------------------------------------------------------------
105+
# PRODUCTION SETTINGS (when deployed)
106+
# -----------------------------------------------------------------------------
107+
108+
# SSL/Security
109+
# FORCE_HTTPS=true
110+
# SSL_CERT_PATH=
111+
# SSL_KEY_PATH=
112+
113+
# Rate Limiting
114+
# RATE_LIMIT_MAX_REQUESTS=100
115+
# RATE_LIMIT_WINDOW_MS=60000
116+
117+
# Monitoring
118+
# SENTRY_DSN=
119+
# NEW_RELIC_LICENSE_KEY=
120+
121+
# =============================================================================
122+
# QUICK START
123+
# =============================================================================
124+
#
125+
# 1. Copy this file to .env:
126+
# cp .env.example .env
127+
#
128+
# 2. Fill in your API keys:
129+
# - OPENAI_API_KEY (required)
130+
# - MESHY_API_KEY (required)
131+
# - AI_GATEWAY_API_KEY (optional but recommended)
132+
#
133+
# 3. Start services:
134+
# ./start-services.sh
135+
#
136+
# 4. Test the API:
137+
# curl http://localhost:3004/api/health
138+
#
139+
# =============================================================================
140+
# AI GATEWAY BENEFITS
141+
# =============================================================================
142+
#
143+
# Setting AI_GATEWAY_API_KEY provides:
144+
# ✅ Unified access to all AI providers (OpenAI, Anthropic, Google, etc.)
145+
# ✅ Built-in analytics and cost tracking
146+
# ✅ Per-user usage tracking
147+
# ✅ Automatic rate limiting
148+
# ✅ Price comparison across providers
149+
# ✅ OIDC authentication on Vercel deployments
150+
#
151+
# Learn more: AI_GATEWAY_GUIDE.md
152+
#
153+
# =============================================================================

apps/api/Dockerfile

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Multi-stage Docker build for Asset Forge API Server
2+
# Uses Bun runtime for optimal performance
3+
4+
# Stage 1: Base image with dependencies
5+
FROM oven/bun:1 AS base
6+
WORKDIR /app
7+
8+
# Install system dependencies
9+
RUN apt-get update && apt-get install -y \
10+
ca-certificates \
11+
&& rm -rf /var/lib/apt/lists/*
12+
13+
# Stage 2: Dependencies
14+
FROM base AS deps
15+
WORKDIR /app
16+
17+
# Copy package files
18+
COPY package.json ./
19+
20+
# Install dependencies
21+
RUN bun install --frozen-lockfile --production
22+
23+
# Stage 3: Production image
24+
FROM base AS runner
25+
WORKDIR /app
26+
27+
# Create non-root user for security
28+
RUN addgroup --system --gid 1001 nodejs
29+
RUN adduser --system --uid 1001 apiserver
30+
31+
# Copy dependencies from deps stage
32+
COPY --from=deps /app/node_modules ./node_modules
33+
34+
# Copy application code
35+
COPY --chown=apiserver:nodejs . .
36+
37+
# Create directories for runtime data
38+
RUN mkdir -p gdd-assets temp-images && \
39+
chown -R apiserver:nodejs gdd-assets temp-images
40+
41+
# Switch to non-root user
42+
USER apiserver
43+
44+
# Expose API port
45+
EXPOSE 3004
46+
47+
# Health check
48+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
49+
CMD node -e "require('http').get('http://localhost:3004/health', (r) => r.statusCode === 200 ? process.exit(0) : process.exit(1))"
50+
51+
# Environment variables
52+
ENV NODE_ENV=production
53+
ENV API_PORT=3004
54+
55+
# Start the server
56+
CMD ["bun", "run", "start"]

0 commit comments

Comments
 (0)