The Svelte frontend build files were being ignored by git, preventing them from being deployed to Vercel. This caused the error "Frontend not available" on the deployed application.
- src/frontend/.gitignore contained
/public/build/- excluding the compiled Svelte output - This is standard practice for development (build files are generated, not committed)
- However, for Vercel deployment, the files need to be either:
- Committed to git, OR
- Generated as part of the Vercel build process
Removed: /public/build/ line
/node_modules/
-/public/build/
.DS_Store
.vercel
*.*.un~
.vscodesrc/frontend/was imported with its own.gitdirectory- Removed
src/frontend/.gitto integrate it into the main repository - This allowed the entire frontend to be tracked in the main git repo
Files created/modified:
.vercelignore- Explicitly allows frontend files:!src/frontend/public/**vercel.json- Simplified to single Python build (Flask serves the frontend)src/index.py- Configured Flask to serve static files fromfrontend/public/
Frontend build artifacts committed to git:
src/frontend/public/build/bundle.js(22.6KB) - Compiled Svelte appsrc/frontend/public/build/bundle.css(22.4KB) - Bundled stylessrc/frontend/public/build/bundle.js.map(108.9KB) - Source mapsrc/frontend/public/index.html(393B) - Entry pointsrc/frontend/public/global.css(1.7KB) - Global stylessrc/frontend/public/favicon.png- Icon
In src/index.py:
frontend_path = os.path.join(os.path.dirname(__file__), 'frontend', 'public')
app = Flask(__name__, static_folder=frontend_path, static_url_path='')
@app.route('/')
@app.route('/<path:path>')
def serve_spa(path):
# Serve static files (CSS, JS, etc.)
if '.' in path:
try:
return send_from_directory(app.static_folder, path)
except:
pass
# Fallback to index.html for SPA routing
return send_from_directory(app.static_folder, 'index.html')-
Check git tracking:
git ls-files src/frontend/public/build/bundle.js
Should show the file is tracked.
-
Verify Flask serves frontend:
- Local:
python src/index.pythen visit http://localhost:5000 - Should see the Svelte attendance app
- Local:
-
Verify Vercel deployment:
- Visit your Vercel app URL (e.g., si-attendance.vercel.app)
- Should see the Svelte UI load
- Click the
/debugendpoint to verify:index_html_loaded: truepublic_dir_exists: true
-
Test API endpoints:
- Sign in form should call
/signin?cwid=X&course=Y - Verify it connects to the backend correctly
- Sign in form should call
2387af4- feat: Include frontend build files and fix git structure for Vercel deployment706c705- chore: Update Python version file
- Verify Vercel has triggered a new deployment (check Vercel dashboard)
- Test the deployed app at your Vercel URL
- If issues persist, check Vercel build logs for any errors
- Python Runtime: 3.12 (via
runtime.txt) - Frontend Framework: Svelte with Rollup bundler
- Backend Framework: Flask with Flask-RESTFUL
- Static Files: Served by Flask at runtime (not as separate Vercel static deployment)
- CORS: Enabled for all origins in Flask
Rather than configuring Vercel to rebuild the frontend on every deployment, we commit the pre-built files. This is practical because:
- Reduces build time on Vercel
- Avoids Node.js dependency on Vercel (Svelte build is local)
- Files are relatively small (~150KB total)
- Ensures deterministic deployments (same build every time)
- Flask serves them as static files efficiently