پناه یک پیامرسان و شبکه اجتماعی فارسی، راستبهچپ و قابل نصب بهصورت PWA است. بکاند با Node.js و Express ساخته شده، رویدادهای بلادرنگ را Socket.IO مدیریت میکند و دادهها در Redis یا ذخیرهساز محلی JSON نگهداری میشوند.
- ثبتنام و ورود با شماره موبایل/نام کاربری و رمز عبور
- هش امن رمز عبور با
scryptو احراز هویت مبتنی بر JWT - زیرساخت ورود با رمز یکبارمصرف و وبهوک اختیاری
- ویرایش نام، بیوگرافی و تصویر پروفایل
- نمایش وضعیت آنلاین و آخرین بازدید
- گفتوگوی مستقیم بلادرنگ با Socket.IO
- وضعیت ارسال، تحویل و خواندهشدن پیام
- نمایش وضعیت «در حال تایپ»
- پاسخ به پیام، ویرایش، حذف و پاککردن تاریخچه گفتگو
- واکنش ایموجی و قالببندی متن بهصورت ضخیم، مورب، زیرخط و لینک
- پیام زمانبندیشده و پیام محوشونده با زمان انقضای انتخابی
- صفحهبندی تاریخچه پیامها و جلوگیری از ارسال تکراری
- ارسال همزمان چند پیوست، تا ۱۰ مورد برای هر پیام
- آپلود عکس، ویدئو، صوت و فایل عمومی با نمایش پیشرفت و امکان لغو
- ضبط و ارسال پیام صوتی در مرورگر
- پخشکننده اختصاصی صوت و ویدئو
- ساخت نسخه بهینه و تصویر بندانگشتی برای تصاویر
- اشتراکگذاری موقعیت مکانی و کارت تماس
- پشتیبانی از آپلود عادی و پروتکل آپلود ازسرگرفتنی TUS
- جستوجو و مدیریت مخاطبین
- ارسال، پذیرش و رد درخواست دوستی
- صندوق ورودی برای پیام افراد خارج از مخاطبین
- اعلانهای داخلی و فیلتر اعلانهای خواندهنشده
- ایجاد و نمایش پست و استوری در API و پروفایل
- رابط فارسی و واکنشگرا با چند پوسته رنگی
- نصب روی موبایل و دسکتاپ از طریق Web App Manifest
- کش منابع ثابت و اجرای پوسته برنامه در حالت آفلاین
- ذخیره محلی پیامها و صف ارسال آفلاین با IndexedDB
- همگامسازی خودکار پیامهای صفشده پس از بازگشت اتصال
- اعلان Push برای پیامها و درخواستهای دوستی
- Node.js، Express و Socket.IO
- Redis با جایگزین خودکار ذخیرهساز JSON محلی
- JWT و
crypto.scrypt - Service Worker، IndexedDB و Web Push
- Multer، TUS و Jimp برای آپلود و پردازش فایل
- HTML، CSS و JavaScript بدون فریمورک در سمت کاربر
- Git
- Node.js 18 یا جدیدتر و npm
- Redis فقط برای محیطهای چندکاربره یا استقرار واقعی پیشنهاد میشود؛ اجرای محلی بدون Redis نیز امکانپذیر است.
نسخه ابزارها را بررسی کنید:
git --version
node --version
npm --versiongit clone https://github.com/ZamaniDeveloper/paanaah.git
cd paanaahبرای نصب دقیق نسخههای ثبتشده در package-lock.json از دستور زیر استفاده کنید:
npm ciدر Windows PowerShell:
Copy-Item .env.example .envدر Linux یا macOS:
cp .env.example .envیک کلید تصادفی تولید کنید:
node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"خروجی دستور را در فایل .env مقابل JWT_SECRET= قرار دهید. مقدار PORT بهصورت پیشفرض 3000 است.
بدون REDIS_URL، برنامه بهطور خودکار دادهها را در data/local-store.json ذخیره میکند. برای استفاده از Redis، آدرس اتصال را تنظیم کنید؛ برای نمونه:
REDIS_URL=redis://127.0.0.1:6379فعالسازی اعلان Push اختیاری است. برای تولید کلیدهای VAPID اجرا کنید و مقادیر خروجی را در .env قرار دهید:
npx web-push generate-vapid-keysnpm startبعد از نمایش پیام اجرای سرور، آدرس زیر را در مرورگر باز کنید:
http://127.0.0.1:3000
برای توقف سرور در ترمینال Ctrl+C را فشار دهید.
git pull
npm ci
npm start| متغیر | کاربرد | الزامی |
|---|---|---|
PORT |
پورت HTTP؛ مقدار پیشفرض ۳۰۰۰ | خیر |
JWT_SECRET |
امضای توکنهای ورود | برای محیط واقعی بله |
REDIS_URL |
آدرس Redis؛ در نبود آن ذخیرهساز محلی فعال میشود | خیر |
VAPID_PUBLIC_KEY |
کلید عمومی اعلان Push | خیر |
VAPID_PRIVATE_KEY |
کلید خصوصی اعلان Push | خیر |
OTP_WEBHOOK_URL |
وبهوک ارسال رمز یکبارمصرف | خیر |
ADMIN_CODE |
کد ورود مدیریتی قدیمی | خیر |
CUSTOMER_CODE |
کد ورود کاربری قدیمی | خیر |
- فایل
.env، دادههای محلی و فایلهای آپلودشده عمداً از Git خارج شدهاند. - مقدار پیشفرض
JWT_SECRETفقط برای توسعه است؛ در محیط واقعی حتماً آن را تغییر دهید. - سرور فعلاً روی
127.0.0.1گوش میدهد. برای دسترسی عمومی، آن را پشت یک reverse proxy اجرا کنید یا آدرس bind را متناسب با محیط استقرار تغییر دهید. - پیش از استفاده واقعی، مبدأهای CORS، rate limiting، محدودیت نوع و حجم فایل و سیاست نگهداری داده را متناسب با محیط خود سختگیرانهتر کنید.
این پروژه با مجوز ISC منتشر شده است.
Paanaah is a Persian, right-to-left messaging and social networking application that can be installed as a Progressive Web App. Its backend is built with Node.js and Express, Socket.IO powers real-time events, and application data can be stored in Redis or the built-in local JSON store.
- Registration and sign-in with a mobile number/username and password
- Secure password hashing with
scryptand JWT-based authentication - One-time-password flow with an optional delivery webhook
- Editable name, biography, and profile picture
- Online presence and last-seen information
- Real-time direct conversations powered by Socket.IO
- Sent, delivered, and seen message states
- Live typing indicators
- Reply, edit, delete, and clear-conversation actions
- Emoji reactions and rich text with bold, italic, underline, and links
- Scheduled messages and disappearing messages with selectable expiration times
- Paginated message history and duplicate-send protection
- Multiple attachments per message, limited to 10 items
- Image, video, audio, and general file uploads with progress and cancellation
- In-browser voice-message recording
- Custom audio and video players
- Optimized images and thumbnail generation
- Location and contact-card sharing
- Standard multipart uploads and resumable TUS uploads
- Contact search and management
- Send, accept, and reject friend requests
- Inbox for messages from people outside the contact list
- In-app notifications with an unread filter
- Post and story creation and retrieval through the API and profile views
- Responsive Persian interface with multiple color themes
- Mobile and desktop installation through a Web App Manifest
- Static asset caching and an offline application shell
- IndexedDB message cache and offline outbox
- Automatic delivery of queued messages when connectivity returns
- Push notifications for messages and friend requests
- Node.js, Express, and Socket.IO
- Redis with an automatic local JSON-store fallback
- JWT and
crypto.scrypt - Service Worker, IndexedDB, and Web Push
- Multer, TUS, and Jimp for file upload and processing
- Framework-free HTML, CSS, and JavaScript on the client
- Git
- Node.js 18 or newer and npm
- Redis is recommended for multi-user or production deployments, but it is not required for local use.
Verify the installed tools:
git --version
node --version
npm --versiongit clone https://github.com/ZamaniDeveloper/paanaah.git
cd paanaahUse the lockfile to install the exact recorded dependency versions:
npm ciOn Windows PowerShell:
Copy-Item .env.example .envOn Linux or macOS:
cp .env.example .envGenerate a random secret:
node -e "console.log(require('crypto').randomBytes(48).toString('hex'))"Paste the output after JWT_SECRET= in .env. The default PORT is 3000.
When REDIS_URL is unset, the application automatically stores data in data/local-store.json. To use Redis, configure its connection URL, for example:
REDIS_URL=redis://127.0.0.1:6379Browser push notifications are optional. Generate a VAPID key pair and copy the resulting values to .env:
npx web-push generate-vapid-keysnpm startAfter the server reports that it is running, open the following address in a browser:
http://127.0.0.1:3000
Press Ctrl+C in the terminal to stop the server.
git pull
npm ci
npm start| Variable | Purpose | Required |
|---|---|---|
PORT |
HTTP port; defaults to 3000 | No |
JWT_SECRET |
Signs authentication tokens | Yes in production |
REDIS_URL |
Redis connection URL; enables Redis instead of local storage | No |
VAPID_PUBLIC_KEY |
Public Web Push key | No |
VAPID_PRIVATE_KEY |
Private Web Push key | No |
OTP_WEBHOOK_URL |
Webhook used to deliver one-time passwords | No |
ADMIN_CODE |
Legacy administrator sign-in code | No |
CUSTOMER_CODE |
Legacy customer sign-in code | No |
.env, local runtime data, and uploaded files are intentionally excluded from Git.- The default
JWT_SECRETis for development only; always replace it in production. - The server currently binds to
127.0.0.1. For public access, run it behind a reverse proxy or adjust the bind address for your deployment environment. - Before production use, tighten the CORS origins, add rate limiting, enforce file type and size rules, and define an appropriate data-retention policy.
Released under the ISC License.