Skip to content

cesarMalanco/Rythmo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎡 Rythmo

Node.js Express MySQL License

A modern online music store with inventory management, shopping cart and admin dashboard


🎯 About The Project

Rythmo is an e-commerce platform designed to sell musical instruments and accessories. Developed with Node.js on the backend and vanilla HTML/CSS/JavaScript on the frontend, it offers a smooth shopping experience with secure authentication, shopping cart, wishlist and payment processing.

Why Rythmo?

  • πŸ›’ Intuitive shopping cart with database persistence
  • ❀️ Wishlist to save favorite products
  • πŸ” Secure authentication with hashed passwords (bcrypt)
  • πŸ“§ Contact system with email sending
  • πŸ’³ Multiple payment methods (Card, OXXO, Transfer)
  • 🎫 PDF invoice generation
  • πŸ›‘οΈ CAPTCHA anti-bot on forms
  • πŸ“Š Complete admin panel
  • 🌍 Multi-currency support and multiple countries

✨ Features

πŸ‘₯ Customer Features

  • Browse product catalog
  • Authentication and registration system
  • Shopping cart with persistence
  • Personalized wishlist
  • Multiple payment options
  • Order history
  • Password recovery
  • PDF invoice generation
  • Contact and support system

πŸ”§ Admin Features

  • Inventory management
  • Add/Edit/Delete products
  • Discount coupon control
  • Subscription management
  • Dashboard with statistics
  • Order management
  • Admin password hashing
  • User management

πŸ“Έ Screenshots

Customer Experience

Home Catalog Product Details
Home Catalog Product

Shopping & Checkout

Shopping Cart Checkout Payment
Cart Checkout Payment

Authentication & Admin

Login Admin Dashboard
Auth Admin

πŸš€ Installation

Prerequisites

Make sure you have the following installed:

Requirement Version Download
Node.js 18+ Download
MySQL 8.0+ Download
Git Latest Download

πŸ’‘ Tip: You can use XAMPP or WAMP for MySQL.

Quick Installation

# Clone the repository
git clone https://github.com/cesarMalanco/Rythmo.git
cd rythmo

# Install backend dependencies
cd BACKEND
npm install

# Create .env file (see configuration section)
cp .env.example .env

# Return to root
cd ..

βš™οΈ Configuration

1. Environment Variables

Create a .env file in the BACKEND folder:

# Server
PORT=3000
NODE_ENV=development

# Database
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=
DB_NAME=rythmo

# JWT Authentication
JWT_SECRET=your_secret_key_here

# Email (Nodemailer)
EMAIL_SERVICE=gmail
EMAIL_USER=your-email@gmail.com
EMAIL_PASSWORD=your-app-password
EMAIL_FROM=noreply@rythmo.com

# General Configuration
APP_URL=http://localhost:3000
ADMIN_EMAIL=admin@rythmo.com

⚠️ Important: Change JWT_SECRET to a secure key. For Gmail, use app passwords.


πŸ—„οΈ Database

Recommended Setup

Your database needs the following tables:

Main tables:

  • users - User information
  • products - Product catalog
  • cart - Shopping cart items
  • orders - Completed orders
  • wishlist - Saved items
  • coupons - Discount codes
  • subscriptions - User subscriptions
  • countries - Shipping countries
  • captcha_sessions - CAPTCHA sessions

Import Database

Option 1: SQL Script (Recommended)

If you have a database.sql file:

# From command line
mysql -u root -p rythmo < database/database.sql

Option 2: phpMyAdmin

  1. Open phpMyAdmin (http://localhost/phpmyadmin)
  2. Create a new database called rythmo
  3. Select the database
  4. Go to "Import" and upload the SQL file

Option 3: MySQL Workbench

  1. Open MySQL Workbench
  2. Connect to your server
  3. File β†’ Open SQL Script
  4. Open the database file
  5. Execute the script

πŸ’» Running the Project

Backend

cd BACKEND

# Development (with nodemon)
npm run dev

# Production
npm start

The server will be available at http://localhost:3000

Frontend

# Open index.html in your browser or use a local server
# Option 1: Live Server (VS Code)
# Right-click index.html β†’ Open with Live Server

# Option 2: Python
python -m http.server 8000

# Option 3: Node.js
npx http-server FRONTEND

πŸ› οΈ Tech Stack

Technology Purpose Version
Node.js JavaScript Runtime 18+
Express Backend Framework 4.18+
MySQL Database 8.0+
JWT Authentication -
Bcrypt Secure Hashing 6.0+

Main Dependencies

{
  "bcrypt": "^6.0.0", // Secure password hashing
  "cors": "^2.8.5", // CORS middleware
  "dotenv": "^17.2.3", // Environment variables
  "express": "^5.2.1", // Web framework
  "jsonwebtoken": "^9.0.2", // JWT authentication
  "multer": "^2.0.2", // File uploads
  "mysql2": "^3.15.3", // MySQL driver
  "nodemailer": "^7.0.10", // Email sending
  "pdfkit": "^0.15.2", // PDF generation
  "svg-captcha": "^1.4.0", // Anti-bot CAPTCHA
  "validator": "^13.15.23" // Data validation
}

πŸ“ Project Structure

rythmo/
β”‚
β”œβ”€β”€ BACKEND/
β”‚   β”œβ”€β”€ server.js                    # Server entry point
β”‚   β”œβ”€β”€ hashAdmin.js                 # Password hashing utility
β”‚   β”œβ”€β”€ package.json                 # Dependencies
β”‚   β”‚
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”œβ”€β”€ database.js              # MySQL connection pool
β”‚   β”‚   └── email.js                 # Nodemailer configuration
β”‚   β”‚
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ User.js                  # User model
β”‚   β”‚   β”œβ”€β”€ Product.js               # Product model
β”‚   β”‚   β”œβ”€β”€ Order.js                 # Order model
β”‚   β”‚   β”œβ”€β”€ Cart.js                  # Cart model
β”‚   β”‚   β”œβ”€β”€ Wishlist.js              # Wishlist model
β”‚   β”‚   β”œβ”€β”€ Coupon.js                # Coupon model
β”‚   β”‚   β”œβ”€β”€ Country.js               # Country model
β”‚   β”‚   β”œβ”€β”€ Subscription.js          # Subscription model
β”‚   β”‚   β”œβ”€β”€ CaptchaSession.js        # CAPTCHA session model
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ authController.js        # Authentication logic
β”‚   β”‚   β”œβ”€β”€ productsController.js    # Product management
β”‚   β”‚   β”œβ”€β”€ cartController.js        # Cart management
β”‚   β”‚   β”œβ”€β”€ ordersController.js      # Order management
β”‚   β”‚   β”œβ”€β”€ checkoutController.js    # Payment processing
β”‚   β”‚   β”œβ”€β”€ wishlistController.js    # Wishlist management
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ authRoutes.js            # Authentication routes
β”‚   β”‚   β”œβ”€β”€ productRoutes.js         # Product routes
β”‚   β”‚   β”œβ”€β”€ cartRoutes.js            # Cart routes
β”‚   β”‚   β”œβ”€β”€ orderRoutes.js           # Order routes
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ middlewares/
β”‚   β”‚   β”œβ”€β”€ authMiddleware.js        # JWT verification
β”‚   β”‚   └── corsMiddleware.js        # CORS configuration
β”‚   β”‚
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   └── captchaService.js        # CAPTCHA service
β”‚   β”‚
β”‚   β”œβ”€β”€ uploads/
β”‚   β”‚   └── invoices/                # PDF invoices folder
β”‚   β”‚
β”‚   └── .env.example                 # Environment variables example
β”‚
β”œβ”€β”€ FRONTEND/
β”‚   β”œβ”€β”€ PAGES/
β”‚   β”‚   β”œβ”€β”€ index.html               # Home page
β”‚   β”‚   β”œβ”€β”€ catalogo.html            # Product catalog
β”‚   β”‚   β”œβ”€β”€ cart.html                # Shopping cart
β”‚   β”‚   β”œβ”€β”€ checkout.html            # Checkout page
β”‚   β”‚   β”œβ”€β”€ login.html               # Login page
β”‚   β”‚   β”œβ”€β”€ register.html            # Register page
β”‚   β”‚   β”œβ”€β”€ contact.html             # Contact form
β”‚   β”‚   β”œβ”€β”€ paymentCard.html         # Card payment
β”‚   β”‚   β”œβ”€β”€ paymentOXXO.html         # OXXO payment
β”‚   β”‚   β”œβ”€β”€ transfer.html            # Transfer payment
β”‚   β”‚   β”œβ”€β”€ adminDashboard.html      # Admin panel
β”‚   β”‚   β”œβ”€β”€ address.html             # Address management
β”‚   β”‚   β”œβ”€β”€ wishlist.html            # Wishlist
β”‚   β”‚   β”œβ”€β”€ faq.html                 # FAQ
β”‚   β”‚   β”œβ”€β”€ nosotros.html            # About us
β”‚   β”‚   β”œβ”€β”€ resetpassword.html       # Password recovery
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ CSS/
β”‚   β”‚   β”œβ”€β”€ indexStyles.css
β”‚   β”‚   β”œβ”€β”€ catalogoStyles.css
β”‚   β”‚   β”œβ”€β”€ cartStyles.css
β”‚   β”‚   β”œβ”€β”€ loginStyles.css
β”‚   β”‚   β”œβ”€β”€ adminStyles.css
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   β”œβ”€β”€ JS/
β”‚   β”‚   β”œβ”€β”€ acces_script.js          # General authentication
β”‚   β”‚   β”œβ”€β”€ login_script.js          # Login logic
β”‚   β”‚   β”œβ”€β”€ cart_script.js           # Cart management
β”‚   β”‚   β”œβ”€β”€ checkout_script.js       # Checkout logic
β”‚   β”‚   β”œβ”€β”€ admin_script.js          # Admin panel
β”‚   β”‚   β”œβ”€β”€ currencyUtils.js         # Currency utilities
β”‚   β”‚   └── ...
β”‚   β”‚
β”‚   └── IMAGES/
β”‚       └── (Product images)
β”‚
└── README.md

πŸ” Authentication

Register

POST /api/auth/register
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "MyPassword123",
  "name": "John Doe"
}

Login

POST /api/auth/login
Content-Type: application/json

{
  "email": "user@example.com",
  "password": "MyPassword123"
}

// Response
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "user": {
    "id": 1,
    "email": "user@example.com",
    "name": "John Doe"
  }
}

Using the Token

// Send in headers
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

πŸ“ž Contact & Support

The system includes a contact form that sends emails directly to your inbox. Make sure to configure the email variables correctly in .env.


πŸ› Troubleshooting

Problem: "Database connection error"

Solution:

  • Verify that MySQL is running
  • Check credentials in .env
  • Ensure the database rythmo exists

Problem: "CORS error"

Solution:

  • Verify that corsMiddleware.js is configured correctly
  • Ensure frontend and backend are on correct ports

Problem: "Invalid JWT"

Solution:

  • Clear browser localStorage
  • Try logging in again
  • Verify that JWT_SECRET is the same in backend

Problem: "Emails not sending"

Solution:

  • Verify Gmail credentials in .env
  • Use app passwords, not normal password
  • Enable less secure app access in Gmail

πŸ“ Available Scripts

# Backend
cd BACKEND

npm start          # Run in production
npm run dev        # Run with nodemon (development)

# Frontend
npm start          # If configured

πŸš€ Deployment

Heroku

# Install Heroku CLI
npm install -g heroku

# Login
heroku login

# Create app
heroku create your-app-rythmo

# Set environment variables
heroku config:set DB_HOST=your-host
heroku config:set DB_USER=your-user
# ... etc

# Deploy
git push heroku main

Railway, Vercel, or similar

Check the platform's documentation to deploy Node.js applications.


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘₯ Authors


πŸ™ Acknowledgments


Built with ❀️ using Node.js and JavaScript

About

A full-stack Node.js e-commerce platform for selling musical instruments and accessories.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors