Full-stack buy/sell application with JWT authentication, product management, and a balance-based purchase system.
live-coding-4/
├── backend/
│ ├── server.js <- Express + SQLite REST API
│ ├── package.json <- Backend dependencies and scripts
│ └── Dockerfile
└── frontend/
├── index.html <- Main UI (catalog, login, register, dashboard)
├── script.js <- Client-side logic and API calls
└── style.css <- Application styles
- Node.js 16 or higher
- npm (included with Node.js)
- VS Code + Live Server extension (recommended for frontend)
From the root of live-coding-4:
cd backend
npm i
node server.jsYou can also use:
npm startAPI available at: http://localhost:3000
In another terminal, from the root of live-coding-4:
cd frontendOptions to serve/open it:
- Recommended option (VS Code): right-click
index.html-> Open with Live Server - Alternative option with Python:
python -m http.server 8080Frontend available at: http://localhost:5500 (Live Server) or http://localhost:8080 (Python)
- User registration and login with JWT
- User profile with account balance
- Product publishing
- Edit and delete own products
- Public catalog of active products
- Cart and checkout flow
- Dashboard with purchase history and listed products
POST /api/auth/registroPOST /api/auth/login
GET /api/usuario/perfil(requires token)
GET /api/productosPOST /api/productos(requires token)PUT /api/productos/:id(requires token)DELETE /api/productos/:id(requires token)
POST /api/comprar/:id(requires token)GET /api/mis-compras(requires token)GET /api/mis-productos(requires token)
For protected routes, send this header:
Authorization: Bearer <token>- The SQLite database (
tienda.db) is created automatically when the backend starts. - The backend uses a default
JWT_SECRETfor development. In production, define a secure environment variable.