feat: Single-port deployment with improved error handling and SvelteKit static build

- Frontend now uses @sveltejs/adapter-static for production builds
- Backend serves both API and static files from single port (originally port 3000)
- Removed all throw statements from services to avoid Elysia prototype errors
- Fixed favicon serving and SvelteKit assets path handling
- Added ecosystem.config.js for PM2 process management
- Comprehensive deployment documentation (PM2 + HAProxy)
- Updated README with single-port architecture
- Created start.sh script for easy production start
This commit is contained in:
2026-01-16 13:58:03 +01:00
parent 413a6e9831
commit 907dc48f1b
12 changed files with 683 additions and 132 deletions

View File

@@ -30,8 +30,7 @@ async function verifyPassword(password, hash) {
* @param {string} userData.email - User email
* @param {string} userData.password - Plain text password
* @param {string} userData.callsign - Ham radio callsign
* @returns {Promise<Object>} Created user object (without password)
* @throws {Error} If email already exists
* @returns {Promise<Object|null>} Created user object (without password) or null if email exists
*/
export async function registerUser({ email, password, callsign }) {
// Check if user already exists
@@ -42,7 +41,7 @@ export async function registerUser({ email, password, callsign }) {
.limit(1);
if (existingUser) {
throw new Error('Email already registered');
return null;
}
// Hash password
@@ -79,13 +78,13 @@ export async function authenticateUser(email, password) {
.limit(1);
if (!user) {
throw new Error('Invalid email or password');
return null;
}
// Verify password
const isValid = await verifyPassword(password, user.passwordHash);
if (!isValid) {
throw new Error('Invalid email or password');
return null;
}
// Return user without password hash