#!/bin/sh
set -e

echo "Starting NextGen School Management System..."

cd /app/server

echo "Applying database migrations (idempotent)..."
node src/database/init.js

echo "Starting server on port ${PORT:-3001}..."
exec node src/index.js
