Next.js 16 (App Router, server actions) + Firestore. Razorpay Payment Links (mocked until keys are set), MSG91 WhatsApp.
Built from the admin (A1–A9) and Sector / Mohalla (Login, M1–M8) wireframes on main.
- console.firebase.google.com → create a project (Spark plan is fine).
- Build → Firestore Database → Create database → production mode (deny-all rules; the app uses the Admin SDK, which bypasses them).
- Note the Project ID (Project settings → General).
- Project settings → Service accounts → Generate new private key → save the JSON outside this folder.
cp .env.example .env.local(Windows:copy .env.example .env.local) and fill inNEXT_PUBLIC_FIREBASE_PROJECT_ID,GOOGLE_APPLICATION_CREDENTIALS=/full/path/to/that.jsonand the fourB2_*lines. Leave the emulator, Razorpay and MSG91 lines empty (both run as mocks).npm inode --env-file=.env.local scripts/seed.mjs(admin50450028/Password; pass<username> <password>to change)npm run dev→ http://localhost:3000- Day-to-day use (fast):
npm run buildonce after eachgit pull, thennpm start.npm run devcompiles every page on first visit and ships unminified code, so it feels slow; use it only while changing code.
npm i && npm i -g firebase-tools
cp .env.example .env.local # uncomment FIRESTORE_EMULATOR_HOST, set any project id
npm run emulators # terminal 1 (needs Java)
node --env-file=.env.local scripts/seed.mjs
npm run dev # terminal 2 → http://localhost:3000- Login: username + password in Firestore
users/{username}, stored as an scrypt hash. Plain-text passwords (e.g. fromseed.mjs) sign in once and are re-saved hashed. 5 wrong tries lock that username for 15 minutes. Sessions are random tokens insessions/{token}. Admin sets and resets passwords on the Users screen. - Holds: a new booking holds its slots for 10 minutes (
HOLD_MINUTES). Holds lapse lazily: every reader treats a pending lock pastholdUntilas free, so there's no cron. If a payment arrives after the hold lapsed and the slot was taken meanwhile, the booking is marked Refund due (Payments page). Razorpay links expire at 16 min (their minimum is 15). - Booking wizard (
/book→/book/review): state lives in the URL. Household is picked from the sector's household master. The booking's sector is the household's sector, so Admin can book for any sector. - Households: HOF ID (8–10 digits) is the doc id, so it's unique across sectors. A HOF registered to one sector can't be overwritten from another. CSV import is previewed in the browser, then re-validated on the server.
- Double booking: every venue/date/slot is a doc in
locks/({venueId}_{date}_{M|E|D}). A booking creates all its locks in one Firestore transaction withtx.create, so concurrent attempts can't both succeed. Hall full day = M + E locks. Slot is held at creation (statuspending); payment flips it toconfirmed. - Access: Firestore rules deny all client access. Every read/write runs server-side with the Admin SDK after
requireUser()/requireAdmin(). Sector users only get their own sector's booking details (/bookings/[id]404s otherwise). - Payments:
lib/razorpay.ts. WithRAZORPAY_KEY_IDunset, links point to/mock-pay/..., which calls the samemarkPaid()the webhook does. Going live: set the 3 keys, add webhook{APP_URL}/api/razorpay/webhookforpayment_link.paid. - WhatsApp:
lib/whatsapp.ts, via MSG91. WithMSG91_AUTHKEYunset, it logs to the console. Four templates are needed (hold = payment link, confirmed = receipt PDF as a document header, cancelled, reminder). Variables are listed in the file. Nothing is sent to households without WhatsApp consent (they get SMS instead). - Booking reminders:
POST /api/cron/reminderssends theremindertemplate 5 days and again 2 days before a confirmed booking's first date. A free GitHub Actions schedule calls it daily at 10:00 IST (.github/workflows/booking-reminders.yml; no Firebase Function). Setup: one random value saved as the App Hosting secretCRON_SECRET(firebase apphosting:secrets:set CRON_SECRET, then uncomment it inapphosting.yaml) and as the GitHub repo secretCRON_SECRET(gh secret set CRON_SECRET). Test with Actions → Booking reminders → Run workflow. - Receipt: on payment the PDF is generated (no dependency) and uploaded to a public Backblaze B2 bucket
(
lib/b2.ts). WhatsApp sends that PDF itself as the message's document; the SMS fallback sends the link. Without B2 env vars, or if an upload fails, the link falls back to/r/{bookingDocId}/pdf, which the app generates live. - Cancellations: unpaid hold → creator/admin releases it directly. Paid → creator requests, admin approves and records the manual refund.
- Audit: every mutation writes to
audit/within the same transaction. - Invoice numbers: GST-style
HB/26-27/0001: sequential, restart each financial year (April–March, IST), ≤16 characters. SetGST_INVOICE_PREFIXandTRUST_GSTIN(printed on receipts). No tax breakup is calculated. - SMS fallback: when WhatsApp fails, or the household has no WhatsApp consent, the same message goes by MSG91 SMS
(
lib/sms.ts, needs DLT-approved template IDs). Households have no email address, so there's no email fallback. - Reports: Payments shows revenue by Sector / Mohalla for the selected period; Expenses shows income vs expenses per venue per month.
- Imports (households, maintenance blocks, Miqaat list): CSV or Excel (.xlsx), parsed in the browser
(
read-excel-file), previewed with a server-side check (no writes), then only valid rows are imported. - Expenses: bills upload to the same B2 bucket (
bills/{id}/…); the report sets income (confirmed bookings by event date) against expenses per venue per month. Payments export is a real .xlsx (write-excel-file).
Needs the Blaze (pay-as-you-go) plan; a small trust app usually stays within the free tier. From the project folder:
npm i -g firebase-toolsthenfirebase login- Edit
apphosting.yaml: put yourB2_BUCKET_ID/B2_BUCKET_NAMEvalues in place ofCHANGE-ME; commit and push. firebase apphosting:secrets:set B2_KEY_IDandfirebase apphosting:secrets:set B2_APP_KEY(paste the values when asked; answer yes to granting access).firebase apphosting:backends:create→ connect GitHub repohussain0811/husainin-baug-wireframes, branchmain, root directory/. Pick the region closest to India that it offers.- When the first rollout finishes, copy the backend URL into
APP_URLinapphosting.yaml; commit and push (every push tomainredeploys). firebase deploy --only firestore:rules(deny-all rules; the server uses the Admin SDK).
Firestore data is shared with any local run that uses the same project. Seed once:
node --env-file=.env.local scripts/seed.mjs <username> <password>.
A static presentation site for client review of the Husainin Baug Hall & Room Booking wireframes. It contains 18 clickable screens covering three areas:
- Login
- Admin (A1–A9): dashboard, booking options, hall/room configuration, sector/mohalla setup, payments, users, cancellations, Miqaat details, expenses
- Sector / Mohalla user (M1–M8): dashboard, booking flow, payment and WhatsApp, bookings list, households, cancellation, and the WhatsApp message as seen on a phone
The overview page (index.html) shows every screen as a thumbnail and in a full-screen viewer.
Each screen is also a normal web page: links inside the wireframes navigate between screens, and when a
screen is opened on its own a small pill at the bottom-right offers ← Overview, previous / next screen
and the screen title (press [ / ] for previous / next; the × button hides it).
No build step, framework or server code is needed: it is plain HTML, CSS and JavaScript.
site/
├── index.html Overview page (gallery + full-screen viewer)
├── 404.html "Page not found" page, links back to the overview
├── .nojekyll Tells GitHub Pages to serve files as-is (no Jekyll processing)
├── README.md This file
├── screens.json Canvas metadata: screen titles, order and page groups
├── assets/
│ ├── presentation.css Styles for the overview page
│ ├── presentation.js Gallery / viewer behaviour for the overview page
│ ├── screen-nav.css Floating navigation pill + page-fill rules for the screens
│ └── screen-nav.js Pill (only when not inside an iframe) and placeholder-link handling
└── screens/
├── Login.html
├── Main.html (A1 Admin dashboard)
├── A2_Booking.html … A9_Miqaat.html
└── M1_Dashboard.html … M8_WhatsApp_Mobile.html
Screen order (used by the overview and the prev / next links): Login, Main, A2_Booking, A3_Venues,
A4_Mohalla, A5_Payments, A6_Users, A8_Cancellations, A9_Miqaat, A7_Expenses, M1_Dashboard, M2_Booking,
M3_BookingReview, M4_Payment, M5_Bookings, M6_Households, M7_Cancel, M8_WhatsApp_Mobile.
If you add, remove or rename a screen, update screens.json and the SCREENS list at the top of
assets/screen-nav.js.
Links such as "Forgot password?", "Sign in with OTP" and the WhatsApp "Pay" button are intentional
placeholders (href="#..."); they do nothing when clicked.
Option A — just open it: double-click site/index.html (or any file in site/screens/) to open it in a browser.
Most things work directly from disk. Some browsers restrict iframes or fetch on file:// URLs, so if the
overview looks empty, use option B.
Option B — run a tiny local web server (recommended; matches GitHub Pages behaviour):
npx serve site
# then open the URL it prints, usually http://localhost:3000Alternatives if you don't have Node.js: python -m http.server 8000 --directory site and open
http://localhost:8000.
-
Create a repository on GitHub (e.g.
husainin-baug-wireframes). It can be public, or private if your GitHub plan supports Pages for private repositories. -
Push the contents of
site/to themainbranch, so thatindex.htmlsits at the repository root (not inside asite/folder):cd site git init git add . git commit -m "Wireframe presentation site" git branch -M main git remote add origin https://github.com/<your-account>/husainin-baug-wireframes.git git push -u origin main
Make sure the hidden
.nojekyllfile is included (git add .does include it). -
On GitHub, open the repository → Settings → Pages.
-
Under Build and deployment, set Source to Deploy from a branch, then choose Branch:
mainand folder/ (root), and click Save. -
Wait a minute or two. The site will be published at
https://<your-account>.github.io/husainin-baug-wireframes/(the address is shown at the top of the Pages settings). Share that link with the client.
To update the site later, edit the files, commit and git push again; Pages redeploys automatically.
Alternative — /docs folder: if the wireframes live inside a larger repository, copy the contents of
site/ into a docs/ folder at that repository's root, push to main, and in Settings → Pages choose
Branch: main and folder /docs.
All links in the site are relative, so it works both at a project URL (/<repo>/) and on a custom domain.
The overview page header and footer contain placeholder text — the client name, your company / studio name, and the version or date label of this review round. To change them:
- Open
index.htmlin any text editor. - Search for
<!-- EDITABLE— every placeholder (version/date, "[Client]", "[Your company]", next steps, footer contact) is marked with that comment. Replace the text next to it and keep the surrounding HTML tags unchanged. - Also update the
<title>near the top ofindex.htmlif you want the browser tab to show the client name. - Save, refresh the browser to check, then commit and push to republish.
The wireframe screens themselves (screens/*.html) are the reviewed designs; avoid editing them unless the
design changes.