Skip to content

pullstackdevv/simple-pos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β˜• Simple POS - Point of Sale System

A modern, professional Point of Sale (POS) system built with Astro, TypeScript, Tailwind CSS, and MySQL.

🌟 Features

βœ… Complete

  • 3-Column Professional Layout - Sidebar, Product Grid, Bill Details
  • Product Catalog - Browse and search products by category
  • Product Customization - Cup size, ice level, sugar level, toppings
  • Shopping Cart - Add/remove items, real-time calculations
  • Checkout System - Customer info, payment method selection
  • Database Integration - MySQL backend with CRUD operations
  • Transaction History - All orders saved to database
  • Responsive Design - Works on desktop and tablets

πŸš€ Technical

  • Astro Framework - Fast, modern web framework
  • TypeScript - Type-safe code
  • Tailwind CSS v4 - Beautiful, utility-first styling
  • MySQL Database - Reliable data persistence
  • REST API - Full CRUD endpoints
  • Auto Migrations - Database setup automation

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • MySQL running at host.docker.internal:3308
  • MySQL credentials: root / password

Setup (5 minutes)

# 1. Clone and navigate
cd simple-pos

# 2. Copy environment file
cp .env.example .env

# 3. Install dependencies
npm install

# 4. Run database migrations
npm run migrate

# 5. Start dev server
npm run dev

# 6. Open browser
http://localhost:4322

πŸ“‹ How to Use

Making an Order

  1. Click Product Card β†’ Customization modal opens
  2. Customize Options β†’ Select cup size, ice level, sugar level, topping
  3. Set Quantity β†’ Use +/- buttons
  4. Add to Cart β†’ Item appears in bill details
  5. Enter Customer Info β†’ Name and table number
  6. Select Payment β†’ Cash or Card
  7. Process Transaction β†’ Order saved to database

πŸ“ Project Structure

simple-pos/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Sidebar.astro          # Left navigation
β”‚   β”‚   β”œβ”€β”€ ProductCardNew.astro   # Product display
β”‚   β”‚   β”œβ”€β”€ ProductModal.astro     # Customization modal
β”‚   β”‚   └── BillDetails.astro      # Right panel with cart
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”œβ”€β”€ index.astro            # Main POS page
β”‚   β”‚   β”œβ”€β”€ setup.astro            # Database setup
β”‚   β”‚   └── api/
β”‚   β”‚       β”œβ”€β”€ products.ts        # Product CRUD
β”‚   β”‚       β”œβ”€β”€ products/[id].ts   # Product detail
β”‚   β”‚       β”œβ”€β”€ transactions.ts    # Transaction CRUD
β”‚   β”‚       └── migrate.ts         # Migration endpoint
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ db.ts                  # Database connection
β”‚   β”‚   └── migrations.ts          # Migration logic
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   └── products.ts            # Product data
β”‚   └── styles/
β”‚       └── globals.css            # Global styles
β”œβ”€β”€ scripts/
β”‚   └── migrate.js                 # CLI migration
β”œβ”€β”€ database/
β”‚   └── schema.sql                 # Database schema
└── package.json

πŸ› οΈ Available Commands

# Development
npm run dev              # Start dev server at http://localhost:4322

# Database
npm run migrate          # Run database migrations

# Production
npm run build            # Build for production
npm run preview          # Preview production build

πŸ“Š Database Schema

products

  • id, name, price, category
  • available, sold, customizable
  • image, created_at, updated_at

transactions

  • id, customer_name, subtotal, tax, total
  • payment_method, table_number, status
  • created_at, updated_at

transaction_items

  • id, transaction_id, product_id
  • quantity, price, customization (JSON)
  • created_at

πŸ”Œ API Endpoints

Products

GET    /api/products              # Get all products
POST   /api/products              # Create product
GET    /api/products/[id]         # Get product by ID
PUT    /api/products/[id]         # Update product
DELETE /api/products/[id]         # Delete product

Transactions

GET    /api/transactions          # Get all transactions
POST   /api/transactions          # Create transaction

Database

GET    /api/migrate               # Check migration status
POST   /api/migrate               # Run migrations

🎨 UI Components

Sidebar

  • Navigation menu with 6 items
  • Order count badge
  • Sign out button

Product Grid

  • Responsive grid layout
  • Product cards with:
    • Image/emoji
    • Name and price
    • Stock status
    • Add to cart button

Product Modal

  • Full customization interface
  • Real-time price calculation
  • Quantity controls
  • Add to cart functionality

Bill Details

  • Cart items display
  • Real-time calculations
  • Customer info input
  • Payment method selection
  • Checkout button

🎯 Sample Products

8 products pre-loaded:

  • Caramel Java Frappuccino (35,000 IDR)
  • Java Chip Frappuccino (35,000 IDR)
  • Coffee Jelly Frappuccino (25,250 IDR)
  • Mocha Jelly Frappuccino (25,500 IDR)
  • Green Tea Latte (28,000 IDR)
  • Orange Juice (22,000 IDR)
  • Rice Bowl (45,000 IDR)
  • Pasta Carbonara (55,000 IDR)

πŸ”§ Configuration

Environment Variables (.env)

DB_HOST=host.docker.internal
DB_PORT=3308
DB_DATABASE=simple_pos
DB_USERNAME=root
DB_PASSWORD=password

Astro Config

export default defineConfig({
  output: 'static',
  // API routes work in dev mode
  // For production, install adapter
});

πŸ“š Documentation


βœ… Status

  • βœ… UI fully functional
  • βœ… Database connected
  • βœ… CRUD operations working
  • βœ… Order creation working
  • βœ… Real-time calculations
  • βœ… Payment selection
  • βœ… Transaction saving
  • βœ… Sample data loaded

πŸš€ Ready to Use!

The application is fully functional and ready for:

  • βœ… Development and testing
  • βœ… Demo purposes
  • βœ… Production (with adapter)

Start with npm run dev and begin creating orders!


πŸ“ License

MIT - Feel free to use and modify


🀝 Support

For issues or questions, check the documentation files or review the code comments.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •