Skip to content

About

Кампус Поща: a fast web mail client for TU Sofia, with phone notifications, labels and safe sending.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Кампус Поща — пощата на ТУ – София, подредена и бърза

Version 1.0.0 Next.js 16 Node 22+ 24 tests passing Made for TU Sofia

A fast, focused mail client for TU Sofia mailboxes, with a Bulgarian interface, dark mode by default,
a phone-first layout and new-mail notifications on your phone.

Open Кампус Поща →

Кампус Поща on desktop: folders, inbox with labels, and the reading pane

Every screenshot and animation in this README uses fictional mail. No real mailbox was shown.


✨ What it does

📬 Reading that respects TU

Folders show TU's real unread counts. Opening a message marks it read in TUSmail, or not, if you turn that off. Search covers sender and subject in the current folder. The list refreshes on entry, on focus and about every minute.

🗂️ Organising in one tap

Stars, read/unread, move, archive and trash, one message at a time or in bulk. Every move has an 8-second undo. Permanent delete only from Кошче, after a confirmation.

🏷️ Labels

Учебни, Администрация, Събития, Лични, plus your own. Labels are keyed by Message-ID, so they follow a message you move within the app.

✉️ Sending you can trust

Reply, reply all, forward, CC/BCC, attachments and autosaved drafts. Every send has a stable attempt ID: an uncertain SMTP result is never resent automatically, and Запази копие retries only the Sent copy.

🔔 Notifications on your phone

New mail in Входящи arrives as a notification with the sender and subject, even when the app is closed. Battery use is close to zero: the phone keeps no mail connection of its own.

🎧 Small touches

Optional sounds for new mail and for sending (made with ElevenLabs), dark/light/system themes, comfortable or compact density, and ? for every keyboard shortcut.

📱 Made for the phone

Three phone screens: a new-mail notification over the inbox, a message, and a reply

Animated: inbox, a notification arrives, open the message, reply
  • The list and the message switch smoothly, and Back returns to exactly where you were.
  • Add to Home Screen installs it like an app, with the Кампус Поща icon.
  • Turn on Известия за нова поща in Settings, separately on each device.
  • On iPhone, notifications work once the app is added to the Home Screen (iOS 16.4+).
  • Tapping a notification opens that exact message.

🌗 Your way

Light theme with a message open Settings: theme, density, mark-as-read, sounds and notifications
Light theme Settings: theme, density, reading, sounds, notifications

🧭 How it works

flowchart LR
  subgraph Phone["📱 Phone / 💻 Browser"]
    UI["Кампус Поща<br/>(Next.js app)"]
    SW["Service worker<br/>(notifications)"]
  end
  subgraph Vercel["▲ Vercel · fra1"]
    API["/api/mail/*<br/>sessions, labels, drafts, sends"]
    DB[("Neon Postgres<br/>+ private Blob")]
  end
  subgraph VM["☁️ Oracle VM"]
    Relay["kampus-relay<br/>CONNECT tunnel"]
    Push["kampus-push<br/>IMAP IDLE worker"]
  end
  TU[("TU Sofia<br/>IMAPS 993 · SMTP 27")]
  FCM["FCM / Apple Push"]

  UI <--> API
  API <--> DB
  API -- "IMAP/SMTP over TLS" --> Relay --> TU
  API -. "signed sync" .-> Relay -.-> Push
  Push -- "IDLE on INBOX" --> TU
  Push -- "sender + subject" --> FCM --> SW
Loading
  • TU drops all traffic from AWS, which is where Vercel runs. Mail sockets therefore pass through a small, dependency-free CONNECT relay on an Oracle VM. The relay only allows TU's two mail endpoints, and TLS runs end to end, so it never sees mail or passwords.
  • Notifications:
    • The push worker keeps one IMAP IDLE connection per subscribed account, on INBOX only.
    • It fetches headers only, so nothing gets marked read.
    • It sends the sender and subject through Web Push.
    • A burst of more than three messages is collapsed into one summary notification.

🔐 Security

What How
Sessions Opaque HttpOnly; SameSite=Strict; Secure cookie, record encrypted with AES-256-GCM. 24 h idle, 7 days max, deleted on Изход.
Your mail Never copied. Each message is read from TU when you open it. HTML is sanitised, remote content is blocked, and HTML renders in a sandboxed iframe.
Notification login Sealed to the push worker's X25519 key (HKDF-SHA256 + AES-256-GCM, bound to your account). Vercel stores it but cannot open it. It is deleted when you turn notifications off, sign out on that device, or after 90 days without a sign-in.
Relay Requires a secret, only allows TU's mail endpoints plus the worker's localhost port, is rate-limited, and is capped by systemd. Passes TLS through untouched.
Worker DynamicUser, ProtectSystem=strict, 192 MB / 20% CPU limits. Listens only on 127.0.0.1 and is reached through the relay, so no new port is open. Sync messages are HMAC-signed and expire after 60 s.
Limits Up to 25 notification accounts, 5 devices each. Pushes go only to known push services (FCM, Mozilla, Apple, WNS).

🚀 Run it locally

Requires Node.js 22 or newer.

npm ci
npm run dev

Open tusmail.localhost:3000. To use port 3001 instead, run $env:PORT = '3001' first.

  • The server listens on loopback only.
  • Sessions are stored encrypted in the ignored .mail-data directory, together with its local key. Keep that directory private.
npm test        # 24 tests: IMAP/SMTP fixtures, API, relay, push crypto + worker
npm run build

The tests run against loopback IMAP/SMTP fixtures, the API handler, a real relay, and a fake IMAP client for the push worker. They use synthetic data only.

☁️ Hosting

Configuration lives in .env.example.

Piece Where Needs
App + API Vercel (fra1) MAIL_MODE=hosted, TU_HOSTED_APPROVED=yes, MAIL_ORIGIN, TU_ALLOWED_USERS, DATABASE_URL, APP_KEY, BLOB_READ_WRITE_TOKEN, MAIL_PROXY
Relay relay/ on a VM TU accepts RELAY_SECRET, RELAY_TARGETS (TU's two endpoints plus 127.0.0.1:8994)
Push worker push/ as systemd kampus-push /etc/kampus-push.env. Keys are generated on the VM; only public values and shared secrets go to Vercel (PUSH_*, NEXT_PUBLIC_VAPID_KEY).

Without the full hosted configuration, every mail route stays off. POST /api/mail/reachability checks, without any credentials, that the deployment can reach both TU ports.



Кампус Поща is not an official TU Sofia service. The official webmail is tusmail.tu-sofia.bg.

About

Кампус Поща: a fast web mail client for TU Sofia, with phone notifications, labels and safe sending.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages