Skip to content
Nairitya-x15Public

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Madhouse — Hostel IV site (static, no backend at all)

This is a plain static site (HTML/CSS/JS, no server, no database you run, no Firebase) that reads its editable content live from a Google Sheet, and sends complaints/bookings through Google Forms. There is no login page anywhere — access control is just Google's own sharing permissions on the Sheet.

Why this works without any backend

  • Content pages (notices, about, council, guides, gallery): the site fetches a published Google Sheet as CSV in the browser and renders it. Editing a cell in Sheets updates the site the next time someone loads the page — no redeploy, no code.
  • Complaints & bookings: embedded Google Forms. Submissions land automatically in that Form's own response Sheet, which the warden/council can open directly to see and triage them.
  • Who can edit what: controlled entirely by who you share the Google Sheet with as an Editor. Everyone else — including every student on the live site — can only ever view it, because the site itself has no write access and no admin UI to abuse.

1. Set up the Google Sheet

  1. Create a new Google Sheet. Name it whatever you like (e.g. "Madhouse Site Content").

  2. Create these tabs (exact names matter — the site looks them up by name), each with a header row exactly as shown:

    Settings (two columns, one row per setting)

    Key Value
    officeEmail hostel4@example.iitb.ac.in
    emergencyPhone +91 22 2576 1234
    wardenOfficePhone +91 22 2576 1200
    maintenanceEmail maint.h4@example.iitb.ac.in
    locationText Hostel IV, IIT Bombay · Powai
    officeLocationText Hostel IV Office, Ground Floor, IIT Bombay
    instagramUrl (link or blank)
    youtubeUrl (link or blank)
    linkedinUrl (link or blank)
    facebookUrl (link or blank)
    aboutIntro (a paragraph of text)

    Notices

    Text Active Order
    GC 2026 registrations are open TRUE 0

    Timeline

    Year Title Text Order
    1961 Foundation Hostel IV is established... 0

    Values

    Title Text Order
    Loud pride We show up for GC... 0

    Gallery

    Tag Title Description ImageURL VideoURL Order
    GC · 2026 General Championship The stands, the chants... (Drive link, see §3) 0

    Council

    Role Name Category Email Phone Tone Photo Featured Order
    Warden Dr. A. Sharma Administration warden.h4@... +91... tone-one (Drive link, see §3, or blank) TRUE 0

    Category must be one of: Administration, Maintenance, Culture, Tech, Sports, Web. Tone is optional — leave it blank and the site assigns one automatically. Photo is optional — a Google Drive share link to that person's photo (see §3). Leave blank to show the initials avatar instead. If the link is broken or the photo fails to load, the site also falls back to the initials avatar automatically. Featured = TRUE shows that person in the homepage preview.

    Guides (one row per guide item — repeat the section columns on every row for that section)

    | SectionSlug | SectionLabel | SectionIcon | SectionIntro | SectionOrder | ItemTitle | ItemText | ItemLinkLabel | ItemLinkURL | ItemOrder | |---|---|---|---|---|---|---|---| | lan | LAN & Wi-Fi setup | Wifi | Get connected in under five minutes... | 0 | Ethernet (wired) | Connect the LAN cable... | IITB Wired LAN Setup | https://www.cc.iitb.ac.in/page/n-wired | 0 | | lan | LAN & Wi-Fi setup | Wifi | Get connected in under five minutes... | 0 | Wi-Fi | Join the 'IITB-WiFi' network... | IITB Wi-Fi Setup | https://www.cc.iitb.ac.in/page/configurewireless | 1 | | rules | Hostel rules | Shield | The short version... | 1 | Quiet hours | 11:30 PM – 7:00 AM... | | | 0 |

    Valid SectionIcon values: Wifi, Shield, Utensils, BookOpen.

    mess is supported as a normal Guides section. Use SectionOrder 2 to place it after Hostel rules.

    Booking (one row per bookable item)

    CategorySlug CategoryLabel CategoryIcon CategoryOrder ItemLabel ItemOrder
    sports Sports gear Gamepad 0 Cricket kit 0
    sports Sports gear Gamepad 0 Badminton set 1
    music Music room Music 1 Jam room 0

    Valid CategoryIcon values: Gamepad, Music, Cpu.

    Note: the "Tech equipment" category has been removed from the site. A row with CategorySlug set to tech will be filtered out even if it's present in the sheet — don't re-add it here.

  3. Share the Sheet: click Share → change to "Anyone with the link" → Viewer. Then add the council members who should be able to edit it as Editor, individually, by email. Viewer access is what lets the live site read it; Editor access is what you're using instead of a login system.

  4. Copy the Sheet's ID out of its URL: https://docs.google.com/spreadsheets/d/THIS_PART_IS_THE_ID/edit


2. Set up the two Google Forms

Create two separate Google Forms — one for complaints, one for bookings — with whatever fields make sense (room number, description, etc.).

For the complaints form's category field, use these four options to match what's shown on the site: LAN / Internet, Electrical, Plumbing, Others. (Carpentry has been folded into "Others".)

To get the embed URL:

  1. Open the form → Send → the <> (embed) tab → copy the src="..." URL from the <iframe> code it gives you.
  2. Optional but recommended: Responses tab → the green Sheets icon → "Create spreadsheet" — this gives the council a live list of every complaint/booking to triage by hand (e.g. add a "Status" column themselves).

3. Uploading photos via Google Drive

Used for both the Gallery tab and council members' Photo column.

  1. Create a Drive folder (one for gallery photos, one for council headshots works well), share it the same way as the Sheet (Viewer for "anyone with the link", Editor for whoever should be able to add photos).
  2. Upload a photo → right-click → Share → Copy link.
  3. Paste that link into the MediaURL column of the Gallery tab and set MediaType to image, or the Photo column of the Council tab. The site automatically converts Drive image links into displayable images — no manual URL editing needed.
  4. If a Photo/ImageURL cell is left blank, or the link is broken/unreachable, the site automatically falls back to the default look (initials avatar for council members, the plain colour card for gallery/homepage moments) — you don't need to do anything special to trigger that, it just happens.

4. Configure and run the site

cd frontend
npm install
cp .env.local.example .env.local

Edit .env.local:

NEXT_PUBLIC_SHEET_ID=paste_the_sheet_id_from_step_1.4
NEXT_PUBLIC_COMPLAINTS_FORM_URL=paste_the_complaints_form_embed_src
NEXT_PUBLIC_BOOKING_FORM_URL=paste_the_booking_form_embed_src
npm run dev

Visit http://localhost:3000 — it should now show whatever is in your Sheet.


5. Build & deploy (static export)

npm run build

This produces a plain static site in frontend/out/ — every page is a real .html file. Upload the contents of out/ to the target web server.

  • If deploying to a subpath (e.g. gymkhana.iitb.ac.in/~hostel4/), set NEXT_PUBLIC_BASE_PATH=/~hostel4 in .env.local before running npm run build.
  • The NEXT_PUBLIC_* values get baked into the JS bundle at build time — if you change the Sheet ID or Form URLs, rebuild and re-upload. (The content inside the Sheet updates live without a rebuild — only the Sheet/Form identifiers themselves need a rebuild.)

6. Why there's no admin page

Everything editable lives in a Google Sheet/Drive folder that only invited council members have Editor access to. Building a custom login and admin UI on top of that would just be re-implementing access control Google already provides — and it would need some backend to check credentials against, which is exactly what this setup avoids. The tradeoff: editing happens in Sheets' own interface (which the council already knows how to use) instead of custom buttons in the site.

One real limitation: complaints and bookings are one-way. A student's submission lands in the Form's response Sheet, and the council can mark it resolved/rejected by hand-editing a cell there — there's no "mark as done" button on the live site itself, because building one would need a backend to receive that click.


7. A note on the TypeScript baseUrl warning

If you've seen this on other Next.js projects:

Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0.

it's fixed here by removing "baseUrl": "." from tsconfig.json while keeping "paths": { "@/*": ["./src/*"] }. Under "moduleResolution": "bundler" (which Next.js already uses), paths alone resolves correctly — confirmed with a clean npx tsc --noEmit and a full npm run build, no warnings, no ignoreDeprecations flag needed.


8. Project structure

frontend/
  public/images/
    hostel-exterior.jpg, building-tree-sky.jpg, sunlit-hallway.jpg,
    window-reflection.jpg    real Hostel IV photography, used as subtle
                              backgrounds behind each inner page's hero
                              section (see .page-hero-* rules in globals.css)
  src/lib/
    config.ts       Sheet ID + Form URLs from env vars
    sheets.ts         fetches + parses one Sheet tab as CSV (papaparse)
    content.ts         typed getters per tab (getSettings, getNotices, getCouncil, ...)
    drive.ts            converts a Drive share link into a displayable image URL
    types.ts             shared TS types
  src/components/
    GoogleFormEmbed.tsx  iframe wrapper used on the complaints & booking pages
    PersonAvatar.tsx      council photo with graceful fallback to initials avatar
    MomentCard.tsx         homepage gallery-preview card with graceful photo fallback
  src/app/
    {page,about,council,guides,booking,complaints}.tsx
                          all client components, fetch Sheet data in the browser
  .env.local.example

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages