Prerequisites
Before setting up the Playground project locally, ensure you have the following installed:- Node.js (v14 or higher recommended)
- npm (comes with Node.js)
- Git for version control
- A modern web browser (Chrome, Firefox, or Edge)
- A code editor (VS Code recommended)
Project Structure
The Playground project follows a straightforward file structure:Key Application Pages
The project includes multiple HTML pages for different features:index.html- Main dashboard/landing pagelogin.html- User authentication pageCalculadora.html- Calculator toolHerramientas.html- Utilities and toolsPlantillas.html- Templates managerProcedimientos.html- Procedures documentationHorariosStop.html- Stop Jeans schedulesConfiguraciones.html- User settingsPagos.html- Payments managementVarios.html- Miscellaneous featuresMusica.html- Music playerjuego.html- Game page (BlackJack)
JavaScript Modules
The application uses modular JavaScript architecture:- Authentication:
Autorizacion.js,CerrarSesion.js,scriptLogin.js - Firebase Integration:
FirebaseMonitor.js,FirebaseWrapper.js,firebase-messaging-sw.js - Features:
scriptCalculadora.js,scriptHerramientas.js,scriptProcedimientos.js, etc. - UI Components:
Header.js,Marquee.js,Notificador.js - Configuration:
PreferenciasGlobales.js,scriptConfiguraciones.js - Utilities:
Almuerzo.js,ics.js,botonIA.js,botonFirebase.js
Installation Steps
1. Clone the Repository
2. Install Dependencies
Install all required npm packages:firebase(^10.12.2) - Firebase SDK for webfirebase-admin(^12.0.0) - Firebase Admin SDK for server-side operationsfile-saverjs(^1.3.6) - File download functionalityics(^3.7.6) - iCalendar file generationtableexport(^5.2.0) - Table export functionality
3. Configure Firebase
The application requires Firebase configuration for authentication and real-time database features. You’ll need to:- Create a Firebase project at Firebase Console
- Enable Firebase Authentication
- Set up Firebase Realtime Database
- Enable Firebase Cloud Messaging for push notifications
- Update the Firebase configuration in your JavaScript files
4. Start Local Development Server
Since this is a static web application, you can use any local web server: Using Python:- Install the “Live Server” extension
- Right-click on
index.html - Select “Open with Live Server”
5. Access the Application
Open your browser and navigate to:Environment Variables
For local development with Netlify Functions, create a.env file in the project root:
The
.env file should be added to .gitignore to prevent accidental commits of sensitive data.Testing Netlify Functions Locally
To test the scheduled notification function locally:1. Install Netlify CLI
2. Run Functions Locally
3. Test the Function
The notification function can be triggered at:Common Issues and Troubleshooting
Firebase Authentication Errors
Problem: “Firebase: Error (auth/configuration-not-found)” Solution: Ensure Firebase is properly initialized with valid credentials.CORS Issues
Problem: Cross-Origin Request Blocked errors Solution: Use a proper local server instead of opening HTML files directly (file:// protocol).
Missing Dependencies
Problem: Module not found errors Solution: Runnpm install to ensure all dependencies are installed.
Service Worker Registration Fails
Problem: Firebase messaging service worker won’t register Solution: Ensure you’re running onlocalhost or https:// (service workers require secure contexts).
Development Workflow
- Make Changes: Edit HTML, CSS, or JavaScript files
- Test Locally: Refresh browser to see changes (or use live reload)
- Test Firebase Features: Ensure authentication and database operations work
- Test Functions: Use Netlify CLI to test serverless functions
- Commit Changes: Use Git to commit your changes
- Deploy: Push to trigger automatic deployment (see Deployment)
Next Steps
- Learn about deployment configuration
- Explore project dependencies
- Review the Firebase Realtime Database structure
- Understand the notification scheduling system
