Skip to content

Secur0-com/live-coding-4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Mercado - Professional Mini Marketplace

Full-stack buy/sell application with JWT authentication, product management, and a balance-based purchase system.


Project Structure

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

Local Setup and Run

Requirements

  • Node.js 16 or higher
  • npm (included with Node.js)
  • VS Code + Live Server extension (recommended for frontend)

1. Start the Backend

From the root of live-coding-4:

cd backend
npm i
node server.js

You can also use:

npm start

API available at: http://localhost:3000

2. Start the Frontend

In another terminal, from the root of live-coding-4:

cd frontend

Options to serve/open it:

  • Recommended option (VS Code): right-click index.html -> Open with Live Server
  • Alternative option with Python:
python -m http.server 8080

Frontend available at: http://localhost:5500 (Live Server) or http://localhost:8080 (Python)


Main Features

  • 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

Main Endpoints

Authentication

  • POST /api/auth/registro
  • POST /api/auth/login

User

  • GET /api/usuario/perfil (requires token)

Products

  • GET /api/productos
  • POST /api/productos (requires token)
  • PUT /api/productos/:id (requires token)
  • DELETE /api/productos/:id (requires token)

Purchases

  • 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>

Notes

  • The SQLite database (tienda.db) is created automatically when the backend starts.
  • The backend uses a default JWT_SECRET for development. In production, define a secure environment variable.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors