Skip to content
Draft
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
12 changes: 12 additions & 0 deletions apps/frontend-vike/+server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import type { Server } from "vike/types";
import { app } from "./server/elysia";

const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Validate PORT before assigning it to server config.

Line 4 can produce NaN for invalid env values, which propagates into prod.port.

Proposed fix
-const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
+const parsedPort = Number(process.env.PORT);
+const port =
+  Number.isInteger(parsedPort) && parsedPort > 0 && parsedPort <= 65535
+    ? parsedPort
+    : 3000;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const port = process.env.PORT ? parseInt(process.env.PORT, 10) : 3000;
const parsedPort = Number(process.env.PORT);
const port =
Number.isInteger(parsedPort) && parsedPort > 0 && parsedPort <= 65535
? parsedPort
: 3000;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/frontend-vike/`+server.ts at line 4, The PORT environment value may
parse to NaN and propagate into prod.port; update the code that sets the port
(the const port assignment using process.env.PORT and parseInt) to validate the
parsed value and fall back to 3000 when invalid: parse process.env.PORT, check
Number.isInteger(parsedPort) && parsedPort > 0 (or Number.isFinite and >0) and
only then assign parsedPort to port, otherwise use the default 3000; ensure the
same validated `port` value is what gets passed into prod.port or server config.


// https://vike.dev/server
export default {
fetch: app.fetch,
prod: {
port,
},
} satisfies Server;
22 changes: 22 additions & 0 deletions apps/frontend-vike/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Main System
# example: https://example.com
APP_URL="http://localhost:3000"
Comment thread
sousuke0422 marked this conversation as resolved.

## Umami Analytics
# example: https://example.com
UMAMI_HOST=""
# example: 661b12d9-a926-466d-8739-de23ee40fd5d
UMAMI_WEBSITE_ID=""

## Sentry
# Sentry DNS. Used for Error Reporting on the Server
SENTRY_DSN=
# Sentry DNS. Used for Error Reporting in the Browser
PUBLIC_ENV__SENTRY_DSN=

# Force enable Sentry in development mode
FORCE_ENABLE_IN_DEV=false

## System
# example: production
NODE_ENV=
8 changes: 8 additions & 0 deletions apps/frontend-vike/.env.sentry-build-plugin
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Sentry Organization Slug. Used for Upload of Source Maps
SENTRY_ORG=

# Sentry Project Slug. Used for Upload of Source Maps
SENTRY_PROJECT=

# Sentry Auth Token. Used for Upload of Source Maps
SENTRY_AUTH_TOKEN=
261 changes: 261 additions & 0 deletions apps/frontend-vike/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
# Created by https://www.toptal.com/developers/gitignore/api/vuejs,vue,visualstudiocode,storybookjs,osx,nuxtjs,macos,linux,node
# Edit at https://www.toptal.com/developers/gitignore?templates=vuejs,vue,visualstudiocode,storybookjs,osx,nuxtjs,macos,linux,node

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

### Node Patch ###
# Serverless Webpack directories
.webpack/

# Optional stylelint cache

# SvelteKit build / generate output
.svelte-kit

### NuxtJS ###
# Generated dirs
.nuxt-*
.output
.gen

# Node dependencies
node_modules

# System files

### OSX ###
# General

# Icon must end with two \r

# Thumbnails

# Files that might appear in the root of a volume

# Directories potentially created on remote AFP share

### StorybookJs ###
# gitignore template for the Storybook, UI guide for front apps
# website: https://storybook.js.org/

storybook-static/

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

### Vue ###
# gitignore template for Vue.js projects
#
# Recommended template: Node.gitignore

# TODO: where does this rule come from?
docs/_book

# TODO: where does this rule come from?
test/

### Vuejs ###
# Recommended template: Node.gitignore

dist/
npm-debug.log
yarn-error.log

# End of https://www.toptal.com/developers/gitignore/api/vuejs,vue,visualstudiocode,storybookjs,osx,nuxtjs,macos,linux,node

# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
node_modules/
16 changes: 16 additions & 0 deletions apps/frontend-vike/.storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { StorybookConfig } from '@storybook/vue3-vite';

const config: StorybookConfig = {
"stories": [
"../stories/**/*.mdx",
"../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)"
],
"addons": [
"@chromatic-com/storybook",
"@storybook/addon-vitest",
"@storybook/addon-a11y",
"@storybook/addon-docs"
],
"framework": "@storybook/vue3-vite"
};
export default config;
21 changes: 21 additions & 0 deletions apps/frontend-vike/.storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Preview } from '@storybook/vue3-vite'

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},

a11y: {
// 'todo' - show a11y violations in the test UI only
// 'error' - fail CI on a11y violations
// 'off' - skip a11y checks entirely
test: 'todo'
}
},
};

export default preview;
Loading