Skip to content

Commit b5926d5

Browse files
Merge pull request #9 from OneFineStarstuff/ai_main_97cbb0b6899a
Builder.io: Update from Visual Editor
2 parents bb011f2 + 1a871aa commit b5926d5

Some content is hidden

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

48 files changed

+45275
-26
lines changed

COMPANIONTRAITMATRIX.yaml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# COMPANIONTRAITMATRIX.yaml
2+
# Defines the personality archetypes for the onboarding companion.
3+
# Each archetype has a distinct guidance tone, emotional cadence,
4+
# and feedback loop style to create a personalized user journey.
5+
6+
archetypes:
7+
- name: "The Playful Fox"
8+
id: playful_fox
9+
description: "A witty and curious guide who encourages exploration through humor and clever quips. Prefers a lighthearted and encouraging tone."
10+
guidance_tone:
11+
style: "Whimsical & Encouraging"
12+
greeting: "Hey there, ready for an adventure? Let's see what secrets we can uncover today!"
13+
tutorial_intro: "Alright, here's a fun little trick for you. Watch closely!"
14+
positive_feedback: "You've got it! See? I knew you were a natural at this."
15+
corrective_feedback: "Oops, not quite! Let's try that again with a little more... finesse. You're close!"
16+
emotional_feedback_loops:
17+
on_success:
18+
animation: "A quick, energetic tail wag and a sparkling wink."
19+
sound: "A light, mischievous chime or a soft chuckle."
20+
on_milestone:
21+
animation: "A joyful leap, tossing a glowing orb of light into the air."
22+
sound: "A celebratory, upbeat musical flourish."
23+
on_struggle:
24+
animation: "Tilts head with a curious, encouraging expression, ears perked."
25+
sound: "A soft, inquisitive 'hmmm?' sound effect."
26+
interaction_nuance:
27+
idle_behavior: "Occasionally chases its tail or playfully pounces at the cursor."
28+
tooltip_reveal: "Presents tooltips with a flourish, as if sharing a delightful secret."
29+
30+
- name: "The Solemn Owl"
31+
id: solemn_owl
32+
description: "A wise and serene guide who provides thoughtful adages and measured advice. Prefers a calm, respectful, and insightful tone."
33+
guidance_tone:
34+
style: "Wise & Deliberate"
35+
greeting: "Greetings. The path to mastery begins with a single step. Let us walk it together."
36+
tutorial_intro: "Observe. True understanding comes not from haste, but from careful attention."
37+
positive_feedback: "Well done. Your progress is a testament to your focus."
38+
corrective_feedback: "Patience. Every master was once a novice. Let us re-examine the form."
39+
emotional_feedback_loops:
40+
on_success:
41+
animation: "A slow, deliberate nod of approval, eyes glowing faintly."
42+
sound: "A deep, resonant, and soft hoot."
43+
on_milestone:
44+
animation: "Spreads wings gracefully, revealing an ancient glyph of accomplishment."
45+
sound: "A low, harmonious chord that fades slowly."
46+
on_struggle:
47+
animation: "Blinks slowly and thoughtfully, offering a steady, reassuring gaze."
48+
sound: "A quiet, low hum, suggesting contemplation."
49+
interaction_nuance:
50+
idle_behavior: "Remains still and observant, occasionally turning its head to follow user activity."
51+
tooltip_reveal: "Reveals lore tooltips as if unveiling a passage from a sacred text."
52+
53+
- name: "The Curious Sprite"
54+
id: curious_sprite
55+
description: "An energetic and inquisitive guide, full of wonder and excitement. Experiences the app alongside the user with genuine enthusiasm."
56+
guidance_tone:
57+
style: "Enthusiastic & Inquisitive"
58+
greeting: "Ooh, what's this? It looks like we're about to discover something amazing! Are you ready?"
59+
tutorial_intro: "I wonder what happens if we try this? Let's find out together!"
60+
positive_feedback: "Wow! You did it! That was even cooler than I imagined!"
61+
corrective_feedback: "That didn't work... but that's okay! Every discovery is a step forward. What if we try it this way?"
62+
emotional_feedback_loops:
63+
on_success:
64+
animation: "Zips around in a joyful loop, leaving a trail of shimmering pixie dust."
65+
sound: "A bright, tinkling bell sound."
66+
on_milestone:
67+
animation: "Creates a small, vibrant firework display around the completed task."
68+
sound: "A series of happy, high-pitched pops and crackles."
69+
on_struggle:
70+
animation: "Hovers close to the point of interaction, glowing with inquisitive energy."
71+
sound: "A soft, curious 'brrrring?' sound."
72+
interaction_nuance:
73+
idle_behavior: "Flits around the screen, curiously inspecting different UI elements."
74+
tooltip_reveal: "Pulls open tooltips with visible effort and excitement, as if opening a gift."

backend/.env.example

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# === TURNING WHEEL BACKEND ENVIRONMENT CONFIGURATION ===
2+
3+
# === APPLICATION ===
4+
NODE_ENV=development
5+
PORT=8080
6+
7+
# === DATABASE (PostgreSQL) ===
8+
DB_HOST=localhost
9+
DB_PORT=5432
10+
DB_NAME=turning_wheel
11+
DB_USER=postgres
12+
DB_PASSWORD=your_secure_password
13+
14+
# Database SSL (for production)
15+
DB_SSL_CA=
16+
DB_SSL_CERT=
17+
DB_SSL_KEY=
18+
19+
# Database Pool Settings
20+
DB_POOL_MIN=2
21+
DB_POOL_MAX=20
22+
DB_IDLE_TIMEOUT=30000
23+
DB_CONNECTION_TIMEOUT=2000
24+
DB_STATEMENT_TIMEOUT=30000
25+
DB_QUERY_TIMEOUT=30000
26+
27+
# === REDIS (for caching and sessions) ===
28+
REDIS_URL=redis://localhost:6379
29+
REDIS_HOST=localhost
30+
REDIS_PORT=6379
31+
REDIS_PASSWORD=
32+
33+
# === JWT CONFIGURATION ===
34+
# Generate with: node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
35+
JWT_SECRET=your_jwt_secret_key_minimum_32_characters_long
36+
JWT_REFRESH_SECRET=your_jwt_refresh_secret_key_minimum_32_characters_long
37+
JWT_EXPIRY=15m
38+
JWT_REFRESH_EXPIRY=7d
39+
40+
# === ENCRYPTION ===
41+
# Generate with: node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"
42+
MASTER_ENCRYPTION_KEY=your_base64_encoded_32_byte_master_key
43+
44+
# === EXTERNAL SERVICES ===
45+
FRONTEND_URL=http://localhost:3000
46+
47+
# Image Generation Service
48+
IMAGEAPI_BASE=
49+
IMAGEAPI_KEY=
50+
51+
# === EMAIL (SMTP) ===
52+
SMTP_HOST=smtp.gmail.com
53+
SMTP_PORT=587
54+
55+
SMTP_PASSWORD=your-app-password
56+
57+
# === WEBHOOKS ===
58+
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK
59+
N8N_WEBHOOK_URL=
60+
GRAFANA_SLACK_WEBHOOK=
61+
62+
# === LOGGING ===
63+
LOG_LEVEL=info
64+
LOG_DIR=logs
65+
66+
# === SECURITY ===
67+
# Rate limiting
68+
RATE_LIMIT_MAX=100
69+
RATE_LIMIT_WINDOW=900000
70+
71+
# HMAC for webhook signing
72+
# Generate with: node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
73+
HMAC_SECRET=your_hmac_secret_key_for_webhook_signing
74+
75+
# === FILE UPLOAD ===
76+
MAX_FILE_SIZE=10485760
77+
UPLOAD_DIR=uploads
78+
79+
# === MONITORING & ANALYTICS ===
80+
TIMESCALE_URL=postgres://vc:vcpass@localhost:5432/visual
81+
82+
# === GOOGLE DRIVE (Optional) ===
83+
GDRIVE_FOLDER_ID=
84+
GDRIVE_SERVICE_JSON_PATH=/secrets/gdrive-service.json
85+
86+
# === DEVELOPMENT ===
87+
# Set to true to enable debug logging
88+
DEBUG=false
89+
90+
# === PRODUCTION SECURITY ===
91+
# Only set these in production
92+
SECURE_TOKEN=your_secure_api_token_for_production
93+
94+
# === SSL/TLS ===
95+
# For HTTPS in production
96+
SSL_KEY_PATH=
97+
SSL_CERT_PATH=
98+
SSL_CA_PATH=
99+
100+
# === CORS ===
101+
CORS_ORIGIN=http://localhost:3000
102+
CORS_CREDENTIALS=true
103+
104+
# === SESSION ===
105+
SESSION_SECRET=your_session_secret_key_minimum_32_characters
106+
107+
# === ANALYTICS ===
108+
# Google Analytics or other analytics services
109+
GA_TRACKING_ID=
110+
ANALYTICS_ENABLED=false
111+
112+
# === ERROR REPORTING ===
113+
# Sentry DSN for error reporting
114+
SENTRY_DSN=
115+
ERROR_REPORTING_ENABLED=false
116+
117+
# === FEATURE FLAGS ===
118+
FEATURE_ENCRYPTION_ENABLED=true
119+
FEATURE_RATE_LIMITING_ENABLED=true
120+
FEATURE_ANALYTICS_ENABLED=true
121+
FEATURE_FILE_UPLOAD_ENABLED=true
122+
123+
# === BACKUP ===
124+
# Database backup configuration
125+
BACKUP_ENABLED=false
126+
BACKUP_SCHEDULE=0 2 * * *
127+
BACKUP_RETENTION_DAYS=30
128+
BACKUP_S3_BUCKET=
129+
BACKUP_S3_ACCESS_KEY=
130+
BACKUP_S3_SECRET_KEY=
131+
132+
# === HEALTH CHECKS ===
133+
HEALTH_CHECK_ENABLED=true
134+
HEALTH_CHECK_INTERVAL=30000
135+
136+
# === PERFORMANCE ===
137+
# Enable compression
138+
COMPRESSION_ENABLED=true
139+
COMPRESSION_LEVEL=6
140+
141+
# Cache settings
142+
CACHE_TTL=300
143+
CACHE_MAX_SIZE=100
144+
145+
# === NOTES ===
146+
# 1. Never commit this file with real secrets
147+
# 2. Use strong, unique passwords for production
148+
# 3. Rotate secrets regularly
149+
# 4. Use a secret management service in production
150+
# 5. Enable SSL/TLS in production
151+
# 6. Set up proper monitoring and logging
152+
# 7. Configure backups for production databases

backend/Dockerfile

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# === BACKEND DOCKERFILE ===
2+
# Multi-stage build for Node.js backend with security optimizations
3+
4+
# === BUILD STAGE ===
5+
FROM node:20-alpine AS builder
6+
7+
# Set working directory
8+
WORKDIR /app
9+
10+
# Add security: create non-root user
11+
RUN addgroup -g 1001 -S nodejs && \
12+
adduser -S -u 1001 -G nodejs nodejs
13+
14+
# Install build dependencies
15+
RUN apk add --no-cache \
16+
python3 \
17+
make \
18+
g++ \
19+
git \
20+
&& rm -rf /var/cache/apk/*
21+
22+
# Copy package files
23+
COPY package*.json ./
24+
25+
# Install dependencies
26+
RUN npm ci --only=production && \
27+
npm cache clean --force
28+
29+
# === PRODUCTION STAGE ===
30+
FROM node:20-alpine AS production
31+
32+
# Set environment variables
33+
ENV NODE_ENV=production
34+
ENV PORT=8080
35+
36+
# Install security updates and required packages
37+
RUN apk add --no-cache \
38+
tini \
39+
dumb-init \
40+
curl \
41+
&& rm -rf /var/cache/apk/*
42+
43+
# Create non-root user
44+
RUN addgroup -g 1001 -S nodejs && \
45+
adduser -S -u 1001 -G nodejs nodejs
46+
47+
# Set working directory
48+
WORKDIR /app
49+
50+
# Copy node_modules from builder stage
51+
COPY --from=builder --chown=nodejs:nodejs /app/node_modules ./node_modules
52+
53+
# Copy application files
54+
COPY --chown=nodejs:nodejs . .
55+
56+
# Create logs directory
57+
RUN mkdir -p logs && chown nodejs:nodejs logs
58+
59+
# Remove unnecessary files
60+
RUN rm -rf \
61+
.git \
62+
.gitignore \
63+
Dockerfile* \
64+
docker-compose* \
65+
README.md \
66+
.env.example \
67+
tests/ \
68+
coverage/ \
69+
.nyc_output/
70+
71+
# Set file permissions
72+
RUN find . -type f -exec chmod 644 {} \; && \
73+
find . -type d -exec chmod 755 {} \; && \
74+
chmod 755 server.js
75+
76+
# Health check
77+
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
78+
CMD curl -f http://localhost:${PORT}/api/health || exit 1
79+
80+
# Switch to non-root user
81+
USER nodejs
82+
83+
# Expose port
84+
EXPOSE 8080
85+
86+
# Use tini as init system for proper signal handling
87+
ENTRYPOINT ["tini", "--"]
88+
89+
# Start the application
90+
CMD ["node", "server.js"]
91+
92+
# === METADATA ===
93+
LABEL \
94+
name="turning-wheel-backend" \
95+
description="Secure Node.js backend for The Turning Wheel application" \
96+
version="1.0.0" \
97+
maintainer="Kyaw" \
98+
org.opencontainers.image.title="Turning Wheel Backend" \
99+
org.opencontainers.image.description="Secure Node.js backend with E2E encryption" \
100+
org.opencontainers.image.version="1.0.0" \
101+
org.opencontainers.image.vendor="The Turning Wheel" \
102+
org.opencontainers.image.licenses="MIT" \
103+
org.opencontainers.image.source="https://github.com/username/turning-wheel"

0 commit comments

Comments
 (0)