iBUHub/TJUEcard
About
自动查询天津大学宿舍电费余额,低于设定值时邮件提醒。
Productivity & AutomationMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README_EN.md
Original[!WARNING] The v1 version of centralized query has been launched. If you need the v0 version for local deployment, please refer to the v0-final branch.
TJU Electricity Automated Query Tool
Let our system automatically query your dormitory's electricity balance and send an email notification when it falls below a set threshold.
Aims to solve the pain point of sudden power outages due to untimely top-ups.
简体中文 | English
⭐ Key Features
🔍 Automated electricity balance queries.
📩 Email notifications sent when the balance drops below your specified limit.
⏰ Scheduled tasks automatically check the balance once a day.
🔑 No student ID or password required, ensuring security and privacy.
🚀 Getting Started
Registration & Login Visit our Home Page and click "Register" to create a new account. Note: Only Tianjin University email addresses (@tju.edu.cn) are supported for registration. After registration, log in with your credentials.

Add a Room Enter the dashboard and click "Add Room". Provide room details (Campus, Building, Room Number) for binding.

Set Thresholds In the room list, set an "Electricity Alarm Threshold". Our Agent will periodically check the balance. If it falls below this value, an email notification will be sent.

Enable DingTalk Notifications (Optional) TJUEcard supports DingTalk group robot notifications. You can paste the robot Webhook URL in "Notification Settings" and enable DingTalk notifications. Tutorial: https://github.com/iBUHub/TJUEcard/issues/12
Enable WeChat Notifications (Optional) You can auto-forward emails from your
@tju.edu.cnmailbox to a QQ mailbox, then enable "QQ Mail Alerts" in WeChat to receive notifications. Tutorial: https://github.com/iBUHub/TJUEcard/issues/13Enable WeChat Test-Account Notifications (Optional) You can also configure and enable notifications in "Notification Settings" → "WeChat Test Account Notifications". Tutorial: https://github.com/iBUHub/TJUEcard/issues/16
💻 Local Development
If you want to run or contribute to the project locally, please follow these steps:
1. Configure Environment Variables
A .env.example file is provided in the root directory. Copy it and rename it to .env, then fill in the configuration according to your situation:
cp .env.example .env
Configuration key notes:
- Secret Generation:
JWT_SECRETandAGENT_SECRETcan be randomly generated long strings (e.g.,openssl rand -hex 32). - Agent Config: Fill in
TJU_USERNAMEandTJU_PASSWORDso that the Agent can simulate login for queries. - Local Debugging: Setting
SKIP_EMAIL_VERIFICATION=trueallows you to skip real email verification code validation during registration. - Email Provider: SendCloud remains the default. Set
EMAIL_PROVIDER=resendand configureRESEND_API_KEYto use Resend. UseRESEND_FROM_EMAILandRESEND_TEST_EMAILfor the Resend sender and test recipient.
2. One-click Start (Recommended)
After configuring .env, you can run the following commands in the project root directory to start the backend, frontend, and Agent simultaneously:
npm install
npm run dev
[!TIP] This command uses
concurrentlyto run processes in parallel:
- Backend:
npm run dev:server(Port 3000)- Frontend:
npm run dev:web(Port 5173)- Agent:
python start_agent_manual.py
3. Step-by-step Manual Start
If you need to debug specific components separately, you can run them in the root directory:
- Backend:
npm run dev:server - Frontend:
npm run dev:web - Agent:
python start_agent_manual.py
🗄️ Database Description (Local)
No additional database software is required for local development:
- The backend will automatically create
tjuecard.db(SQLite) in theserver/directory upon startup. - The system will automatically read
schema.sqland initialize the table structure. - Data Reset: If you wish to clear data for development purposes, simply delete
server/tjuecard.dband restart the backend service.
🛠️ System Architecture
The v1 version of centralized query adopts a three-tier architecture design:
📱 Web Frontend: Built with Vue 3, deployed on Cloudflare Pages, providing user registration, login, and room management interfaces.
☁ Server Backend: Utilizes Cloudflare Workers serverless functions for authentication, room management, task scheduling, and email notifications, with data stored in Cloudflare D1 SQL database.
🐋 Agent: A Python process running in Docker containers, deployed within the campus network, periodically polling the backend for pending query tasks, simulating login to TJU's energy management system to fetch electricity data, and reporting results back to the backend. Currently, multiple Agent instances are deployed to ensure high availability.
🤝 Contribution
We welcome any form of contribution! If you have ideas or requirements, participate via:
🔌 Submit a Pull Request: If you've fixed a bug or implemented a new feature, PRs are welcome.
🐞 Create an Issue: Discuss suggestions or report problems on the GitHub Issues page.
👨💻 Join Development: If interested in project development, contact us at: [email protected].
⚖️ License
This project is owned by iBUHub and licensed under CC BY-SA 4.0. You are free to use, share, and adapt, provided attribution is given and terms are followed. Contact maintainers for any copyright concerns.
ℹ️ Disclaimer
This project is for personal study and communication purposes only. iBUHub is not responsible for any consequences resulting from attacks on websites or other data using the code from this project. iBUHub shall not be liable for any claims, damages, or other liability.
Explore related projects
Loading…