A production-grade full-stack shop with:
infoshop/
├── server.js ← Express backend (API + static file server)
├── package.json ← Node.js dependencies
├── shop.db ← SQLite database (auto-created on first run)
└── public/ ← All frontend files
├── index.html
├── style.css
└── script.js
Download from https://nodejs.org → install the LTS version (v20 or higher).
After installing, close and reopen PowerShell/Terminal.
cd f:\infoshop
npm install
node server.js
You’ll see:
🚀 InfoShop server running at http://localhost:3000
🔑 Admin credentials: admin / P@v@n668652
📦 Database: shop.db
👉 http://localhost:3000
| Role | Username | Password |
|---|---|---|
| Admin | admin |
P@v@n668652 |
Login with admin / P@v@n668652 in the Login modal to access the Admin Panel.
| Feature | Basic Version | InfoShop |
|---|---|---|
| Password storage | ❌ Plain text | ✅ bcrypt hash |
| Authentication | ❌ None | ✅ JWT tokens |
| Input validation | ❌ None | ✅ Server-side |
| SQL injection | ❌ Vulnerable | ✅ Parameterized |
| Admin protection | ❌ None | ✅ Role-based |
| Session expiry | ❌ Never | ✅ 7-day JWT |
| Method | Route | Auth | Description |
|---|---|---|---|
| POST | /api/auth/register |
Public | Create account |
| POST | /api/auth/login |
Public | Login → get JWT |
| GET | /api/me |
User | Your profile |
| GET | /api/products |
Public | List all products |
| GET | /api/products/:id |
Public | Single product |
| POST | /api/products |
Admin | Add product |
| DELETE | /api/products/:id |
Admin | Delete product |
| POST | /api/orders |
User | Place order |
| GET | /api/orders |
User/Admin | List orders |
| GET | /api/admin/stats |
Admin | Dashboard stats |
# Register
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{"username":"test","email":"t@t.com","password":"test123"}'
# Login
curl -X POST http://localhost:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"test","password":"test123"}'
# Try admin route without token (should get 401)
curl http://localhost:3000/api/admin/stats
https module or put behind nginx/Caddynpm install express-rate-limitnpm install helmetnpm install express-validator.env file