"Sir Kothay?" β a real-time availability broadcasting platform for universities. Faculty members share their live status via a unique URL and QR code. Students track their favourite faculty, chat directly, and get notified when a professor becomes available. Visitors can scan a QR code to instantly see where someone is and send anonymous messages.
Built with Django REST Framework (backend API) and a static HTML + Tailwind CSS client. Deployable to PythonAnywhere or any WSGI host.
- Live Broadcast Status β set a message visible to anyone who scans your QR code or visits your page
- Timed Statuses β schedule a status to go live later, or auto-expire after a set duration
- Fallback Status β default message and default availability automatically restored when a timed status expires
- Availability Toggle β mark yourself Available/Unavailable; subscribers and students get notified on change
- Set Availability on Broadcast β each status, template, schedule, or calendar event can toggle availability automatically
- Recurring Schedules β auto-broadcast on a weekly schedule (e.g. "Office Hours Mon 2β4 PM")
- Calendar Events β one-off or recurring events with broadcast integration (auto-set status during event)
- Supports
daily,weekly,monthlyrecurrence and all-day events
- Supports
- Quick Status Templates β one-tap presets for common statuses ("In a Meeting", "Lab 401") with custom sort order
- Automated Scheduler β
python manage.py process_schedulesprocesses all triggers (cron/task)
- Faculty Dashboard β full broadcast management, QR codes, analytics, scheduling, unified chat inbox
- Student Dashboard β faculty interest tracking, threaded chat, granular notification preferences
- Mandatory Student ID β students are prompted to enter their ID on first login (blocking modal)
- Admin Dashboard β granular user management panel:
- Ban / Unban β block login (distinct from deactivation)
- Deactivate / Activate β toggle account active state
- Toggle Admin β grant/revoke
is_staffprivilege (last-admin protected) - Toggle Verification β manually verify or unverify a user's email
- Reset Password β generate a random password or set a custom one and email it to the user
- Change Role β switch between Faculty, Student, or None (admin-only) with modal UI
- User Detail Panel β slide-over panel with full user info and all actions
- Filters & Sorting β filter by role (Faculty/Student/None) and status (Active/Deactivated/Banned); sort by all columns
- Admin-only users β users with no role (
"") andis_staff=Trueare redirected directly to the admin panel
- Threaded Chat System β registered students and faculty can have multi-message, persistent conversations
- Thread Lifecycle β Awaiting β Open β Closed status flow
- Chat Actions β accept, reply, close, delete (per-user soft-delete)
- Close & Delete All β bulk action to clean up all threads
- Students can follow up in pending threads before faculty accepts
- Auto-Close Stale Chats β
close_stale_chatscommand auto-closes inactive threads based on facultyauto_close_hourssetting
- Chat Notification Preferences β per-faculty settings:
notify_new_chatsβ email on new chat threadnotify_chat_repliesβ email on each replynotify_chat_closedβ email when a thread is closed
- Visitor Direct Messages β anonymous visitors can send messages from the broadcast page (no login required)
- Sender Verification β inbox cross-references visitor emails with registered users (shows student ID, role)
- Multi-Reply Threading β faculty can reply multiple times (append-only conversation)
- Faculty Inbox β unified split-panel view for both student chats and visitor DMs
- Email Notifications β all chat lifecycle events (new thread, acceptance, reply, close) trigger async email notifications
- Email Verification β secure OTP (10-minute expiry) and link-based email verification gate required for dashboard access
- Password Reset β end-to-end forgot password flow via secure email tokens
- Profile Editor β update display name, email, designation, organization, bio, phone number, and profile image
- Public URL Slugs β auto-generated URL-safe slugs for broadcast pages (auto-syncs when username changes)
- Profile Image Upload β upload and manage profile photos
- Anonymous Subscribers β visitors subscribe via email; notified when broadcaster becomes available
- Student Notification Preferences β 3-tier YouTube-style bell dropdown per faculty:
- π All β notified on every status/availability update
- π When Available β notified only when faculty becomes available
- π Off β no notifications
- Async Email Delivery β all emails sent via background threads (non-blocking, no Celery required)
- Page View Tracking β daily page views and QR scan counts
- Subscriber Management β view and manage email subscribers
- Self-Visit Filtering β broadcaster's own visits are not counted
- About Page β dynamic contributor list fetched live from the GitHub API
- Django Admin Panel β built-in Django admin at
/admin/for direct database management
- Auto-generated QR Codes β encodes the public broadcast page URL
- LAN-aware β auto-detects your PC's LAN IP for mobile testing on the same Wi-Fi
- Branded Center Logo β optional logo overlay in the QR code center
- Download Options β download QR only, or QR with user info card
Sir-Kothay/
βββ client/ # Static frontend (HTML + Tailwind CSS + JS)
β βββ index.html # Landing page
β βββ about.html # About page with contributors
β βββ base.html # Shared layout template
β βββ auth/
β β βββ login.html # Login (email or student ID)
β β βββ register.html # Register (Faculty / Student)
β βββ broadcast/
β β βββ message.html # Public broadcast viewer (QR landing)
β βββ dashboard/
β β βββ home.html # Faculty dashboard (tabs: status, QR, schedule, chat, analytics)
β β βββ student.html # Student dashboard (faculty tracking, chat)
β β βββ admin.html # Admin dashboard (user management)
β β βββ profile.html # Profile editor (shared)
β βββ static/
β βββ css/
β βββ images/
β βββ js/
β βββ api-config.js # API base URL + endpoint constants
β βββ dashboard-core.js # Faculty: auth, profile, QR, broadcast, DM inbox
β βββ dashboard-chat.js # Faculty: split-panel unified chat UI
β βββ dashboard-templates.js # Faculty: quick status templates
β βββ dashboard-schedules.js # Faculty: recurring schedules
β βββ dashboard-calendar.js # Faculty: calendar events
β βββ dashboard-inbox.js # Faculty: legacy visitor DM inbox
β βββ dashboard-analytics.js # Faculty: analytics charts
β βββ student-dashboard.js # Student: faculty cards, interest management
β βββ student-chat.js # Student: split-panel chat with faculty
β βββ admin-dashboard.js # Admin: user management
β βββ notify-modal.js # Notification/confirm modals (skNotify, skConfirm)
β βββ sk-modal.js # Reusable modal component
βββ server/ # Django backend
β βββ core/ # Django project settings & URLs
β βββ authApp/ # Custom user model (Faculty/Student), JWT auth, is_staff admin
β βββ dashboard/ # User profile, student interests, admin management
β βββ broadcast/ # Broadcast messages (CRUD + public endpoint + scheduling)
β βββ qrcodeApp/ # QR code generation & serving
β βββ messaging/ # Visitor DMs + threaded chat system
β βββ notifications/ # Email subscriber system + student notification service
β βββ scheduler/ # Recurring schedules, calendar events, templates, analytics
β βββ manage.py
β βββ requirements.txt
β βββ .env.example # Environment variable template
β βββ db.sqlite3 # (gitignored) local dev database
βββ scripts/
β βββ deploy_pythonanywhere.sh # Master setup & auto-deploy script for PythonAnywhere
β βββ pre-commit # Git hook: encrypts new env vars for safe deployment
β βββ run-local.ps1 # Windows quick-start script
β βββ run-local.sh # Linux/macOS quick-start script
βββ API_DOCUMENTATION.md
βββ README.md
Quick start (Windows):
.\scripts\run-local.ps1Manual setup:
cd server
python -m venv .venv
# Windows: .\.venv\Scripts\Activate.ps1
# Linux/macOS: source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # Edit values as needed (see below)
python manage.py migrate
python manage.py runserver 0.0.0.0:8000Serve the client/ directory over HTTP. Options:
- VS Code Live Server β open
client/folder, right-clickindex.htmlβ "Open with Live Server" - Python β
python -m http.server 5500 --bind 0.0.0.0from theclient/folder
The client auto-detects the API URL from the hostname it's served on (api-config.js). If served from 192.168.x.x:5500, API calls go to 192.168.x.x:8000.
Both servers must bind to 0.0.0.0 and Windows Firewall must allow ports 5500 and 8000:
# One-time firewall setup (run as admin):
netsh advfirewall firewall add rule name="Sir Kothay Django (8000)" dir=in action=allow protocol=TCP localport=8000
netsh advfirewall firewall add rule name="Sir Kothay Client (5500)" dir=in action=allow protocol=TCP localport=5500QR codes auto-detect the LAN IP so scans from mobile devices work automatically.
Process recurring schedules, calendar events, and expiring messages:
python manage.py process_schedulesAuto-close inactive chat threads:
python manage.py close_stale_chatsSet these up as cron jobs (Linux) or PythonAnywhere scheduled tasks for production.
Set window.SIR_KOTHAY_API_BASE = 'https://your-api.example.com' in an inline script before api-config.js.
This project uses a split-stack architecture for production: the static frontend is hosted on Firebase Hosting, and the Django backend API is hosted on PythonAnywhere.
- Install the Firebase CLI:
npm install -g firebase-tools - Login and initialize:
firebase login firebase init hosting
- Set the public directory to
client - Configure as a single-page app: No
- Set up automatic builds and deploys with GitHub: Yes (This creates a GitHub Action to auto-deploy the frontend on push).
- Set the public directory to
- Update
client/static/js/api-config.jsor use an inline script to pointAPI_BASE_URLto your live PythonAnywhere URL. - Deploy manually (if needed):
firebase deploy --only hosting
We have provided an automated script to set up a brand new PythonAnywhere server from scratch, or update an existing one.
-
Open a Bash Console on PythonAnywhere.
-
Run the master deployment script:
git clone https://github.com/TahsinFaiyaz30/Sir-Kothay.git bash Sir-Kothay/scripts/deploy_pythonanywhere.sh
-
Interactive Nano Editor β The script will copy the
.env.examplefile and open thenanoeditor. Fill in all the placeholder values (CHANGE_ME, etc.) with your real production secrets. Save and exit (Ctrl+X β Y β Enter). -
Create a Web App on the PythonAnywhere Web tab:
- Choose Manual configuration β Python 3.10.
- Set Virtualenv path to:
/home/YOURUSERNAME/.virtualenvs/venv
-
Edit the WSGI file (click the link on the Web tab). Replace the entire contents with:
import sys import os from dotenv import load_dotenv path = '/home/YOURUSERNAME/Sir-Kothay/server' if path not in sys.path: sys.path.insert(0, path) load_dotenv(os.path.join(path, '.env')) from core.wsgi import application # noqa
-
Add Static Files mappings on the Web tab:
URL Directory /static//home/YOURUSERNAME/Sir-Kothay/server/staticfiles/media//home/YOURUSERNAME/Sir-Kothay/server/media -
Click the green Reload button at the top of the Web tab.
The backend is configured to automatically pull new code, install dependencies, migrate the database, and restart itself whenever you push to GitHub.
- Ensure
GITHUB_WEBHOOK_SECRET=your-passwordis set in your PythonAnywhereserver/.envfile. - Go to your GitHub Repository Settings -> Webhooks -> Add webhook.
- Configure the webhook:
- Payload URL:
https://your-username.pythonanywhere.com/api/github-webhook/ - Content type:
application/json - Secret: The exact same password from your
.envfile.
- Payload URL:
- Done! Every
git pushwill now automatically deploy the backend via the Webhook!
We use a Git pre-commit hook to safely deploy new or deleted environment variables from your local machine to the live server without needing to SSH.
-
Install the hook locally:
cp scripts/pre-commit .git/hooks/pre-commit
(Windows users: Ensure the file uses
LFline endings, notCRLF) -
Add
GITHUB_WEBHOOK_SECRET=your-password(matching the server) to your localserver/.envfile. -
Add or Delete variables in
server/.env.exampleas needed. -
Commit via the terminal (e.g.
git commit -m "Updated env vars"). The hook will detect changes and prompt you:- For New Variables: It will prompt you to type the secret production value.
- For Deleted Variables: It will ask you to confirm if it should also be deleted from the production server.
-
It will encrypt your inputs/instructions using AES-256 and attach a
.env.deploy.encfile to your commit. -
The PythonAnywhere webhook will detect it, decrypt it, modify the live server
.envexactly as instructed, and automatically delete the encrypted payload!(Note for GitHub Desktop users: GUI apps cannot show interactive terminal prompts. If you try to commit a
.env.examplechange via GitHub Desktop, it will safely block it and show an error. To resolve this, just open your terminal and run:git commit -am "Update env vars" && git push)
All server configuration is in server/.env. Copy .env.example to .env and edit:
| Variable | Default | Description |
|---|---|---|
SECRET_KEY |
dev fallback | Django secret key. Must change for production. |
DEBUG |
True |
Set to False in production. |
ALLOWED_HOSTS |
127.0.0.1,localhost |
Comma-separated allowed hosts. |
CORS_ALLOWED_ORIGINS |
localhost variants | Comma-separated CORS origins (only used when DEBUG=False). |
CSRF_TRUSTED_ORIGINS |
localhost variants | Comma-separated CSRF trusted origins. |
DB_ENGINE |
SQLite | Set to django.db.backends.postgresql for Postgres. |
DB_NAME, DB_USER, DB_PASSWORD, DB_HOST, DB_PORT |
β | PostgreSQL credentials (only when DB_ENGINE is set). |
CLIENT_PUBLIC_BASE_URL |
empty | Full URL to the client root (e.g. http://127.0.0.1:5500). Used for QR codes and email links. |
GITHUB_CONTRIBUTORS_REPO |
UIU-Developers-Hub/Sir-Kothay |
GitHub repo for the About page contributor list. |
GITHUB_WEBHOOK_SECRET |
β | Shared secret for GitHub Webhook auto-deploy. Must match the secret in your GitHub Webhook settings. |
EMAIL_HOST_USER |
empty | Gmail address. When set, enables real SMTP delivery. When empty, emails print to console. |
EMAIL_HOST_PASSWORD |
empty | Gmail App Password (16 chars). See setup instructions. |
DEFAULT_FROM_EMAIL |
empty | The "From" name and email address (e.g. "Sir Kothay <you@gmail.com>"). |
The platform uses Gmail SMTP for free email delivery (500 emails/day):
- Enable 2-Step Verification on your Google account: https://myaccount.google.com/security
- Generate an App Password: https://myaccount.google.com/apppasswords
- Add to
.env:EMAIL_HOST_USER=yourgmail@gmail.com EMAIL_HOST_PASSWORD=abcdefghijklmnop
When EMAIL_HOST_USER is empty, Django uses the console backend (emails print to terminal β useful for development).
| Layer | Technology |
|---|---|
| Backend | Django 5.1, Django REST Framework, SimpleJWT |
| Frontend | HTML5, Tailwind CSS (CDN), Vanilla JS |
| Database | SQLite (dev) / PostgreSQL (prod) |
| Auth | JWT (Bearer tokens), privilege-based admin (is_staff) |
| QR Codes | qrcode + Pillow (Python) |
Gmail SMTP via threading.Thread (async, non-blocking) |
|
| Static Files | WhiteNoise |
| Hosting | PythonAnywhere (or any WSGI host) |
See API_DOCUMENTATION.md for full endpoint reference.
| Group | Prefix | Auth |
|---|---|---|
| Authentication | /api/auth/users/ |
Public (register/login) |
| User Details | /api/dashboard/user-details/ |
JWT |
| Student Interests | /api/dashboard/student-interests/ |
JWT |
| Admin Users | /api/dashboard/admin-users/ |
JWT (staff) |
| Broadcast Messages | /api/broadcast/messages/ |
JWT |
| Public Broadcast | /api/broadcast/<slug>/ |
Public |
| QR Codes | /api/qrcode/qrcodes/ |
JWT |
| Direct Messaging | /api/messaging/ |
Mixed |
| Threaded Chat | /api/messaging/chat/ |
JWT |
| Notifications | /api/notifications/ |
Mixed |
| Scheduler | /api/scheduler/ |
JWT |
| Analytics | /api/scheduler/analytics/ |
Mixed |
Contributions & feedback are welcome! Please open an issue or submit a pull request.
Β© 2026 Sir Kothay. Made with β€οΈ by UIU Developers Hub