Skip to content

thuver104/senzuraPOS-DeskApp-Electronjs

Repository files navigation

Senzura POS System

Senzura POS is a simple Point of Sale (POS) system built with Electron, Node.js, and MySQL. It provides basic functionalities for managing products, customers, processing sales, and generating reports.

Features

  • User Authentication: Secure login and registration for users.
  • Product Management: Add, view, edit, and delete products with category support.
  • Customer Management: Add, view, edit, and delete customer records.
  • Point of Sale (POS): Intuitive interface for processing sales, adding products to cart, adjusting quantities, and calculating totals.
  • Order Processing: Process orders and save transaction details to the database.
  • PDF Receipt Generation: Automatically generate PDF receipts for completed orders.
  • Sales Reports: View key sales metrics, including total revenue, total orders, total products sold, and top-selling products (monthly sales and top 5 products).
  • Navigation: Easy navigation between different sections of the application.
  • Currency: All monetary values are displayed in Rs (Rupees).

Technologies Used

  • Electron: For building cross-platform desktop applications with web technologies.
  • Node.js: Backend runtime for handling database interactions and business logic.
  • MySQL: Relational database for storing application data (users, products, categories, customers, orders, order items).
  • HTML/CSS (Tailwind CSS): For the user interface and styling.
  • JavaScript: For frontend interactivity and backend logic.
  • Chart.js: For creating interactive sales charts in the reports section.
  • mysql2: MySQL client for Node.js.

Setup Instructions

Follow these steps to set up and run the Senzura POS system on your local machine.

1. Prerequisites

  • Node.js (LTS version recommended)
  • MySQL Server

2. Database Setup

  1. Create a MySQL Database: Open your MySQL client (e.g., MySQL Workbench, command line) and create a new database. The application expects a database named senzura_pos.

    CREATE DATABASE senzura_pos;
    USE senzura_pos;
  2. Create Tables: Execute the SQL queries from the database_schema.sql file (which should be in your project root) to create the necessary tables. This file contains schemas for users, categories, products, customers, orders, and order_items.

    -- Example content from database_schema.sql
    CREATE TABLE categories (
        id INT AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL UNIQUE
    );
    
    CREATE TABLE products (
        id INT AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        price DECIMAL(10, 2) NOT NULL,
        category_id INT,
        image_path VARCHAR(255),
        FOREIGN KEY (category_id) REFERENCES categories(id)
    );
    
    CREATE TABLE customers (
        id INT AUTO_INCREMENT PRIMARY KEY,
        name VARCHAR(255) NOT NULL,
        email VARCHAR(255) UNIQUE,
        phone VARCHAR(50)
    );
    
    CREATE TABLE orders (
        id INT AUTO_INCREMENT PRIMARY KEY,
        customer_id INT,
        total_amount DECIMAL(10, 2) NOT NULL,
        order_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
        FOREIGN KEY (customer_id) REFERENCES customers(id)
    );
    
    CREATE TABLE order_items (
        id INT AUTO_INCREMENT PRIMARY KEY,
        order_id INT,
        product_id INT,
        quantity INT NOT NULL,
        price_per_unit DECIMAL(10, 2) NOT NULL,
        FOREIGN KEY (order_id) REFERENCES orders(id),
        FOREIGN KEY (product_id) REFERENCES products(id)
    );
    
    CREATE TABLE users (
        id INT AUTO_INCREMENT PRIMARY KEY,
        username VARCHAR(255) NOT NULL UNIQUE,
        password VARCHAR(255) NOT NULL
    );
  3. Configure Database Connection: Ensure your main/db.js file has the correct database connection details (host, user, password, database name).

    // main/db.js
    const mysql = require("mysql2");
    
    const connection = mysql.createConnection({
      host: "localhost", // Your MySQL host
      user: "root",      // Your MySQL username
      password: "root",  // Your MySQL password
      database: "senzura_pos",
    });
    
    connection.connect((err) => {
      if (err) throw err;
      console.log("✅ Connected to MySQL");
    });
    
    module.exports = connection;

3. Application Setup

  1. Clone the repository:

    git clone <repository_url>
    cd Senzura/POS
  2. Install Dependencies:

    npm install

4. Running the Application

To start the Electron application, run:

npm start

Usage

  1. Login/Register: The application will start on the login page. You can register a new user or use existing credentials.
  2. Dashboard (POS): After logging in, you'll be directed to the POS dashboard. Here you can:
    • Search for products.
    • Filter products by category.
    • Add products to the cart.
    • Adjust product quantities in the cart.
    • Process payments (generates a PDF receipt on your desktop).
    • Cancel orders.
  3. Products Tab: Manage your product inventory.
  4. Customers Tab: Manage customer information.
  5. Reports Tab: View sales statistics and charts.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open-source and available under the MIT License.

About

Senzura POS is a simple Point of Sale (POS) system built with Electron, Node.js, and MySQL.

Topics

Resources

Stars

Watchers

Forks

Contributors