This frontend was initialized from the Cloudflare/Astro starter template. I cleaned up the configuration so it's ready to be built and deployed.
- PDF Report Generation: Generate referee reports for U9-U17, Liga 2/3, Youth League, National Championships
- Multi-Locality Support: AJF Ilfov (complete) and FRF (in development)
- Real-time System Status: Live health monitoring of backend templates and services
- Template Integrity Verification: SHA-256 hash checking on all PDF templates and fonts
- Automatic Testing: Auto-test results for all age categories displayed in the UI
- Team Autocomplete: Quick team selection from predefined list
- Dark/Light Theme: User-controlled theme switching
- Dynamic Forms: Category selection adapts based on selected locality
What I changed (cleanup)
- Added a
servicesbinding inwrangler.jsonso the frontend worker can call the API worker internally viaenv.API.fetch(...).
How to run locally
- Install deps:
npm install- Development:
npm run dev- Build for production (this generates
dist/):
npm run buildDeploy
- The
deployscript useswrangler deployfrom this directory. Before deploying, ensure the worker name inwrangler.jsonand the service bindingservicename match the published API worker name (default:ref-tool-worker).
Service binding usage
- The added binding in
wrangler.jsonwill make the API worker available under theenvobject in your Worker. Example inside your Worker entry (module worker):
export default {
async fetch(request: Request, env: any) {
// call the API worker internally (no CORS needed)
const apiRes = await env.API.fetch('https://dummy.example/api/generate-report', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ /* form data */ }),
});
return apiRes;
}
}Notes and next steps
- If you prefer the frontend to call the API over a public URL instead of a service binding, remove the
servicesentry and fetch the deployed API URL directly; ensure CORS is configured on the API. - The backend (API worker) expects PDF templates and fonts in its
public/assets. Ensure the API'swrangler.jsoncpoints to./public(it does) and that you include thereports/andfonts/directories when deploying.
If you'd like, I can:
- Wire a minimal form UI into
src/pages/index.astrothat posts to the API. - Add CI deploy scripts for both frontend and backend.
Generated/updated by automation to prepare the project for deployment.
Recent changes
- Excluded starter placeholder images from assets by updating
public/.assetsignore. - Added a small report generation form to
src/pages/index.astro. It posts JSON to/api/generate-reportand downloads the returned PDF. If your API is deployed at a different URL, update theAPI_URLin the page's script. - Added System Status Component: Real-time monitoring widget shows backend health, template integrity (SHA-256 hashes), and autotest results
- Automatic status checks every 60 seconds
- Minimalist design with expandable details panel
- Visual indicators for healthy/degraded/unhealthy states
- Added Locality Support: Users can now select between AJF Ilfov and FRF (National)
- Dynamic category selection based on chosen locality
- AJF Ilfov: U9, U11, U13, U15 (fully functional)
- FRF: U11-U17, Liga 2/3, Youth League, National Championships (marked as "Incomplet - în dezvoltare")
- Form fields adapt automatically based on category requirements
Blog cleanup
- Removed blog routes and disabled the RSS endpoint. Blog content files remain in
src/content/blog/but are no longer included in the build becausesrc/content.config.tsno longer defines ablogcollection. - Replaced the blog layout with a lightweight placeholder so any residual references don't break the build.
The frontend now includes a comprehensive status monitoring system that:
- Checks Backend Health: Polls
/api/statusendpoint every 60 seconds - Validates Template Integrity: Displays SHA-256 hash validation results for all PDF templates
- Shows Autotest Results: Real-time feedback on PDF generation tests for all age categories
- Visual Status Indicators:
- 🟢 Healthy: All systems operational, tests passing
- 🟡 Degraded: Systems operational but tests failing
- 🔴 Unhealthy: Missing files or hash mismatches detected
Users can expand the status widget to see detailed information about:
- Each PDF template status (U9, U11, U13, U15)
- Font file integrity
- Autotest execution time and errors (if any)
- Timestamp of last check