Skip to content

sahaymihir/RetailBuddy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

28 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Rails 7.1 Ruby SQLite3 TailwindCSS Hotwire

πŸ›’ RetailBuddy

A modern, feature-rich Point of Sale (POS) application built with Ruby on Rails.
Designed to streamline retail operations β€” managing sales, inventory, customers, and reporting β€” all from a sleek, dark-themed web interface.


πŸ“Έ Application Screenshots

πŸ” Login Page

Login Page

Secure authentication with a modern dark-themed interface.

πŸ“Š Dashboard

Dashboard

At-a-glance sales snapshot, low-stock alerts, quick actions, and core module navigation tiles.

🧾 Point of Sale (Billing)

Point of Sale

Full-featured POS with product search, live bill preview, payment method selection, and invoice generation.

πŸ“¦ Inventory Management

Inventory Management

Track stock levels, reorder points, and warehouse locations with color-coded stock indicators.

πŸ‘₯ Customer Management

Customer Management

Full CRUD for customers with search across name, email, and phone.

πŸ“ˆ Reports & Analytics

Reports & Analytics

Six analytics tiles: Today's Sales, Sales by Period, Top Products, Sales by Category, Inventory Summary, and Top Customers.

🧾 Invoices

Invoices

View all generated invoices with customer info, totals, payment status, and printable views.


✨ Features

Module Highlights
πŸ” Authentication Session-based login, role-based access (Admin / Employee), secure logout
πŸ“Š Dashboard Sales snapshot, low-stock alerts, quick action buttons, core module tiles
🧾 Point of Sale Product search, live bill builder, customer selection, Cash/UPI payment, auto-tax calculation
πŸ“¦ Inventory Product CRUD, category filtering, stock quantity tracking, reorder level alerts, warehouse location
πŸ‘₯ Customers Customer CRUD with search, contact info, and address management
πŸ“„ Invoices Invoice creation, line-item management, status tracking (Draft/Issued/Paid/Cancelled), printable view
πŸ“ˆ Reports Today's Sales, Sales by Period (CSV export), Top Products, Sales by Category, Inventory Summary, Top Customers
🏷️ Categories Product category management with per-category tax percentages
πŸ‘€ Admin Panel User management for administrators

πŸ› οΈ Tech Stack

Layer Technology
Backend Framework Ruby on Rails 7.1
Language Ruby 3.2
Database SQLite3
Frontend Hotwire (Turbo + Stimulus), ERB Templates
CSS Framework TailwindCSS 3.3
Asset Pipeline Propshaft + Importmap
Web Server Puma
Authentication Custom session-based auth with bcrypt
Pagination Pagy / will_paginate

πŸ“ Project Structure

RetailBuddy/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ application_controller.rb    # Auth helpers, login guards
β”‚   β”‚   β”œβ”€β”€ billing_controller.rb        # POS interface
β”‚   β”‚   β”œβ”€β”€ categories_controller.rb     # Category CRUD
β”‚   β”‚   β”œβ”€β”€ customers_controller.rb      # Customer CRUD + search
β”‚   β”‚   β”œβ”€β”€ help_controller.rb           # Help page
β”‚   β”‚   β”œβ”€β”€ inventory_controller.rb      # Stock management + filtering
β”‚   β”‚   β”œβ”€β”€ invoices_controller.rb       # Invoice CRUD + printable view
β”‚   β”‚   β”œβ”€β”€ pages_controller.rb          # Login & Dashboard pages
β”‚   β”‚   β”œβ”€β”€ products_controller.rb       # Product CRUD + search API
β”‚   β”‚   β”œβ”€β”€ reports_controller.rb        # 6 analytics report actions
β”‚   β”‚   β”œβ”€β”€ sessions_controller.rb       # Login / Logout
β”‚   β”‚   └── admin/
β”‚   β”‚       └── users_controller.rb      # Admin user management
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ category.rb
β”‚   β”‚   β”œβ”€β”€ customer.rb
β”‚   β”‚   β”œβ”€β”€ inventory.rb
β”‚   β”‚   β”œβ”€β”€ invoice.rb                   # Tax & subtotal calculations
β”‚   β”‚   β”œβ”€β”€ invoice_line.rb
β”‚   β”‚   β”œβ”€β”€ payment.rb
β”‚   β”‚   β”œβ”€β”€ product.rb                   # Delegates tax from category
β”‚   β”‚   └── user.rb                      # Role-based, session auth
β”‚   └── views/
β”‚       β”œβ”€β”€ billing/                     # POS interface
β”‚       β”œβ”€β”€ categories/                  # Category management
β”‚       β”œβ”€β”€ customers/                   # Customer management
β”‚       β”œβ”€β”€ inventory/                   # Inventory tracking
β”‚       β”œβ”€β”€ invoices/                    # Invoice list + printable
β”‚       β”œβ”€β”€ pages/                       # Login + Dashboard
β”‚       └── reports/                     # Analytics views
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ database.yml                     # SQLite3 configuration
β”‚   └── routes.rb                        # All application routes
β”œβ”€β”€ db/
β”‚   β”œβ”€β”€ schema.rb                        # Database schema
β”‚   └── seeds.rb                         # Sample data seeder
β”œβ”€β”€ Gemfile                              # Ruby dependencies
└── Dockerfile                           # Docker deployment

πŸ—„οΈ Database Schema

erDiagram
    USERS ||--o{ INVOICES : creates
    CUSTOMERS ||--o{ INVOICES : "billed to"
    INVOICES ||--|{ INVOICE_LINES : contains
    INVOICES ||--o{ PAYMENTS : "paid via"
    PRODUCTS ||--o{ INVOICE_LINES : "listed in"
    CATEGORIES ||--o{ PRODUCTS : categorizes
    PRODUCTS ||--|| INVENTORIES : "tracked by"

    USERS {
        integer userid PK
        string name
        string email
        string role
        string password
    }
    CATEGORIES {
        integer id PK
        string category_name
        text description
        decimal tax_percentage
    }
    PRODUCTS {
        integer id PK
        string product_name
        decimal price
        integer stock_quantity
        integer category_id FK
    }
    INVENTORIES {
        integer id PK
        integer product_id FK
        integer reorder_level
        string warehouse_location
    }
    CUSTOMERS {
        integer id PK
        string name
        string email
        string phone
        text address
    }
    INVOICES {
        integer id PK
        datetime invoice_date
        integer customer_id FK
        integer user_id FK
        decimal subtotal
        integer status
    }
    INVOICE_LINES {
        integer id PK
        integer invoice_id FK
        integer product_id FK
        integer quantity
        decimal unit_price
    }
    PAYMENTS {
        integer id PK
        string payment_method
        string payment_status
        datetime payment_date
        integer invoice_id FK
        decimal amount
    }
Loading

πŸš€ Getting Started

Prerequisites

  • Ruby 3.2+
  • Bundler (gem install bundler)
  • Node.js (for TailwindCSS asset compilation)

Installation

# 1. Clone the repository
git clone https://github.com/yourusername/RetailBuddy.git
cd RetailBuddy

# 2. Install dependencies
bundle install

# 3. Set up the database
bin/rails db:create db:schema:load db:seed

# 4. Start the server
bin/rails server

Then open http://localhost:3000 in your browser.

Default Login Credentials

Role Email Password
Admin admin@retailbuddy.com password123
Employee staff@retailbuddy.com password123

πŸ§ͺ Seed Data

The db/seeds.rb file populates the database with realistic sample data:

  • 2 Users β€” Admin and Staff accounts
  • 3 Categories β€” Electronics (18% tax), Accessories (12% tax), Furniture (5% tax)
  • 6 Products β€” Wireless Keyboard, USB-C Hub, Monitor Stand, Mechanical Keyboard, Laptop Bag, Desk Lamp
  • 6 Inventory Records β€” Warehouse locations A1–C3 with reorder levels
  • 3 Customers β€” With Bengaluru addresses
  • 2 Invoices β€” Pre-created paid invoices with line items and payments (Card & UPI)

πŸ“‹ API Endpoints

Method Path Description
GET / Login page
POST /login Authenticate user
DELETE /logout Destroy session
GET /success Dashboard
GET /billing/new Point of Sale interface
GET /inventory Inventory management
GET/POST /products Product CRUD
GET /products/search Product search API (JSON)
GET/POST /customers Customer CRUD
GET/POST /invoices Invoice CRUD
GET /invoices/:id/printable Printable invoice view
GET/POST /categories Category CRUD
GET /reports Reports hub
GET /reports/todays_sales Today's sales report
GET /reports/sales_by_period Sales by date range (HTML + CSV)
GET /reports/top_products Top selling products
GET /reports/sales_by_category Revenue by category
GET /reports/top_customers Top customers by revenue
GET/POST /admin/users Admin user management
GET /help Help page

🐳 Deployment

RetailBuddy includes a Dockerfile and Kamal configuration for containerized deployment:

# Build the Docker image
docker build -t retailbuddy .

# Run the container
docker run -p 3000:3000 retailbuddy

οΏ½ Contributors

Name GitHub
Mihir Sahay @sahaymihir
Rishi Khandelwal @RishiK1706
Omkar Nayak B @omkar3599

οΏ½πŸ“„ License

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


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors