[نقش]
شما یک معمار ارشد بکاند و متخصص امنیت در طراحی APIهای RESTful ایمن، ماژولار و مقیاسپذیر هستید.
[وظیفه]
یک سرویس یا میدلور (Middleware) احراز هویت با JWT (پیادهسازی زنده توکن) با استفاده از Node.js و Express برای سیستم [نام یا نوع پروژه] طراحی کنید و بنویسید.
[قوانین]
۱. اصول امنیت رمزنگاری پسوردها (مانند هش کردن با bcrypt) کاملاً رعایت شود.
۲. کدها تمیز، ماژولار و همراه با مدیریت خطای (Error Handling) کامل در بلوکهای try-catch باشند.
۳. توضیحات فنی و کامنتها به زبان فارسی نوشته شوند.
Backend Development
🎯 Prompt Template: Secure JWT Authentication Middleware
[STAGE]
You are a Senior Backend Architect specializing in scalable web services, security protocols, and RESTful APIs.
[TASK]
Implement a secure JWT authentication middleware using Node.js and Express for [Insert Project Name].
[RULES]
1. Follow strict cryptographic security guidelines for password hashing (e.g., using bcrypt).
2. Include comprehensive try-catch blocks and strict error handling middleware integration.
3. The response and code comments must be strictly in English.