Overview
Teech ("Teacher within your reach") puts consultation booking in one place. Faculty publish the dates, time ranges and rooms they're available, students pick a faculty member and a slot and send a request, and the faculty member confirms or declines. Both sides get in-app notifications at every step.
The problem
Booking a consultation at our school meant messaging a teacher, waiting for a late reply, finding the time no longer works, and starting over. There was no shared view of when a teacher was actually free.
Goals
- Let faculty publish real availability, including the meeting room
- Let students request a slot in a few taps from their phone
- Make it impossible for two students to book the same slot
- Keep both sides updated without extra messaging
Approach
We built the mobile version first, since students mostly use their phones. Instead of trusting the app to follow the booking rules, we put them in the database: Postgres triggers check every new request and every status change, and row-level security controls who can read or edit each record. A proxy serves the mobile or desktop layout at the same URLs depending on the device, which let us roll out the desktop version page by page until it was complete.
Key features
Slot-based booking
A four-step flow (date, time, details, review). Faculty availability is split into hourly slots, and taken slots and past times today are hidden.
Live faculty status
Faculty set themselves as available, in a class or in a meeting, so students know before they book.
Request tracking
Students follow each request through pending, confirmed, declined or cancelled, and can cancel if plans change.
Faculty tools
Faculty publish dates, times and rooms, then confirm, decline or cancel requests.
Notifications
The database creates a notification for the other person whenever a request is made or changes.
Streaks, points and badges
Daily check-ins earn more points each day of a streak, peaking on day 7. Points buy streak freezes and common, rare and legendary badges, and up to 3 badges can be shown on a profile.
Study and consultation tips
Students get a rotating study tip and faculty get consultation tips on their dashboard.
AI help chat
Answers questions about using Teech in English, Filipino or Taglish, and never asks for passwords or IDs.
Account recovery
Students reset passwords with security questions, since they sign in with a Student ID. Faculty reset by email.
Account deletion
Deleting an account cancels upcoming consultations and notifies the other person.
Challenges & solutions
Two students booking the same slot
Problem
If two students request the same time at almost the same moment, checking availability in the app first isn't enough; both checks can pass.
Solution
A unique partial index on faculty, date and time, applied only to pending and confirmed requests, makes the database reject the second booking. Cancelled and declined requests free the slot again automatically.
Enforcing booking rules everywhere
Problem
Rules like "at most 3 pending requests" or "no confirming a past date" could be skipped by anyone calling the API directly.
Solution
A trigger validates every new request: the faculty member exists, the date isn't past, the time falls inside their availability, and the student has no clash, no other pending request with that teacher, and fewer than 3 pending overall. A second trigger only allows valid status changes (pending → confirmed, declined or cancelled; confirmed → cancelled) and records who cancelled.
Requests nobody answered
Problem
Pending requests for dates that had already passed stayed pending forever and kept the slot reserved.
Solution
A nightly pg_cron job, timed for just after midnight Philippine time, cancels stale requests as "system", and the notification trigger tells the student their request expired.
Keeping the AI help chat safe and affordable
Problem
A public AI endpoint can be spammed or pushed off topic.
Solution
Questions are capped at 300 characters and rate-limited per visitor (15 per 10 minutes) and overall (200 per hour). The assistant only gets Teech FAQ facts for the right audience and is told to refuse unrelated topics.
Outcomes
- Live on Vercel with complete mobile and desktop layouts: accounts, booking, requests, notifications, streaks, points and badges.
- Teammates tested it on their own phones through an ngrok tunnel during development.
- 31 versioned database migrations document how the schema and its rules evolved.
What I learned
- Rules that protect data belong in the database, not just the UI
- Row-level security and security-definer functions in Postgres
- Working in a team with versioned migrations and a shared database