39249ab34fd2c29a7b56f4707aa844474df41710
Positeasy Clone - Canteen Automation Ecosystem
🔐 Security Overhaul (Branch: krishna)
This branch represents a major security milestone for the Canteen Automation system, transitioning from open/unprotected endpoints to a robust JWT-based Authentication architecture.
🔐 Critical: Security Configuration
To run this application securely, you MUST configure the following environment variables. Do NOT commit real secrets to the repository.
Required Environment Variables
| Variable | Description | Example/Hint |
|---|---|---|
JWT_SECRET |
Secret key for signing tokens | openssl rand -base64 32 |
DB_PASSWORD |
Database user password | Your PostgreSQL password |
MASTER_USER |
Initial admin email | admin@example.com |
MASTER_PASSWORD |
Initial admin password | SecurePassword123 |
How to set them:
- Local Development: Create a
.envfile (if using a loader) or set them in your IDE (IntelliJ/Eclipse) Run Configurations. - Production: Set them as System Environment Variables on your server or CI/CD platform (e.g., GitHub Secrets, Railway, Docker).
🏗️ Ecosystem Architecture
- Backend (Java/Spring Boot): Now fully protected by JWT guards. Includes
JwtAuthFilter,JwtUtil, and enhancedSecurityConfig. - Frontend (Counter/Admin): Migrated to use an authenticated API wrapper (
src/api.ts). - Ordering Site: Also migrated to the shared security pattern.
🚀 Major Changes in this Branch
Backend Security
- JWT Implementation: Added token generation, validation, and filtering.
- Role-Based Access: Restricted sensitive endpoints (Orders, Wallets, Coupons) to authenticated users.
- Rate Limiting: Implemented
LoginRateLimiterto prevent brute-force attacks. - CORS Configuration: Updated to allow secure communication with frontend origins.
Frontend Hardening
- API Wrapper: Centralized all data fetching through a secure wrapper that injects authentication headers automatically.
- Context Protection: Updated
AuthContextto persist tokens securely. - Screen Migration: Every major page (POS, Inventory, Reports) has been refactored to use the new secure communication pattern.
🛠️ Developer Setup
- Backend: Update
application.propertieswith yourjwt.secret. - Frontend: Ensure
.envpoints to the correct backend URL. - Migration: See
migrate_fetch.ps1in thefrontenddirectory for details on how the transition was automated.
Developed by the Canteen Automation Team.
Description
Languages
TypeScript
63.3%
Java
27.4%
CSS
8.4%
Python
0.6%
JavaScript
0.1%