Welcome to the development team! This guide will help you set up the project on your local machine and explain the daily workflow for adding features and fixing bugs.
- Node.js (v18+ recommended)
- A Firebase Project (with Auth and Firestore enabled)
- Clone the repository.
- Install dependencies:
npm install
- Copy the environment variables template:
cp .env.example .env
- Fill in the
.envfile with your Firebase configuration. You can find these details in your Firebase Console under Project Settings.
To start the Vite development server:
npm run devThe app will usually be available at http://localhost:5173/.
To build the app for production:
npm run buildWe do not use React Router or Vue Router. Navigation is handled by pageRouter.js.
- The HTML for all pages is typically pre-loaded or injected.
pageRouter.jslistens to navigation clicks, hides all sections, and shows the requested section.- To add a new page:
- Add a section ID in
index.html. - Add the navigation link.
- Register the route in
pageRouter.js.
- Add a section ID in
Never store global data in local variables inside your module. Always use state.js.
import { state } from './modules/state.js';
// Get current exam
const activeExamId = state.selectedExamId;
// Update state
state.setUserRole('admin');Never import Firebase directly into a UI component.
All data reads and writes must pass through firestoreService.js. This is strictly enforced because firestoreService.js handles our critical localforage offline caching layers.
Correct:
import { fetchStudents } from '../firestoreService.js';
const students = await fetchStudents(examId);Because we use Vanilla JS, DOM manipulation is done manually.
- Use
document.getElementByIdordocument.querySelector. - Use the shared builders in
uiComponents.jswhen possible (e.g.,createButton(),renderSkeletonLoader()). - Always clean up event listeners if you dynamically destroy DOM elements to prevent memory leaks.
The project is configured to deploy easily to Firebase Hosting, Vercel, or Netlify.
The standard production build command npm run build optimizes all assets into the dist/ folder, chunking heavy libraries appropriately.