Skip to content

Foodya POS is a powerful restaurant operations system featuring menu management, orders, table handling, employee payroll, financial tracking, and detailed analytics. Developed with Next.js 15, TypeScript, and MySQL, it provides fast performance, clean UI, and secure RBAC-based access for all user roles

Notifications You must be signed in to change notification settings

Shahzaib-Awann/Foodya-Restaurant

Repository files navigation


Foodya POS


React Next.js TypeScript Tailwind CSS npm ShadCN UI SWR MySQL Drizzle ORM Auth.js Chart.js GSAP License

Foodya is a full-featured Restaurant POS (Point of Sale) system coupled with a simple website. It is designed to help restaurants manage their day-to-day operations efficiently, including orders, tables, menu items, bookings, employees, transactions, and reports. The system includes Role-Based Access Control (RBAC) per page to manage permissions for different users.

Documentation Β· Request Feature Β· Connect on Linkedin


πŸš€ Features

User & Access Management

  • Manage users: add, update, deactivate/activate.
  • Manage roles: create multiple roles with specific permissions.
  • Manage modules/pages: control access to each page in the app.
  • Assign permissions: customize access per role for different pages.

Menu & Orders

  • Menu Categories: create, update, delete multiple categories.
  • Menu Items: manage items with variants and sizes.
  • Orders: handle Dine-in, Take-away, and Drive-thru orders.
    • Dine-in orders: select tables, place/reselect orders, fetch existing orders.
  • Bookings: manage table bookings with optional advance payment.
  • Invoices: view, print, and track past invoices and order details.

Employee & Salary Management

  • Employee management: add employees, manage designations and promotions.
  • Salary management:
    • Update salaries, track changes over time.
    • Generate monthly salaries with one click.
    • Track payment status: Pending, Paid.
    • Include bonus, penalties, and custom reasons.
    • Print salary statements and history.

Transactions & Finances

  • Manage transaction categories (salaries, invoices, others).
  • Add manual income and expenses.
  • Reports:
    • Summary cards: monthly income, expense, active employees, total employees.
    • Charts: visualize monthly/yearly profit and expense trends.
    • Hover cards: view transaction details on hover.

Analytics & Visualizations

  • Charts for financial analysis using Chart.js and Recharts.
  • Animated website elements with GSAP for smooth user experience.

πŸ›  Tech Stack

🎨 Frontend

  • Next.js 15 (App Router) – React framework for server-side rendering and routing.
  • React Hook Form – Efficient form handling.
  • ShadCN UI & Cult UI – Prebuilt, customizable UI components.
  • Tailwind CSS – Utility-first styling.
  • GSAP – Animations for website interactions.
  • useSWR – Data fetching with caching and revalidation.

πŸ—„οΈ Backend & Database

  • TypeScript – Strongly typed codebase.
  • Drizzle ORM – Type-safe ORM for MySQL.
  • MySQL – Relational database for structured data.
  • Auth.js (Credentials-based) – Secure authentication.
  • Zod – Input validation and schema enforcement.

🧰 Utilities & Libraries

  • Chart.js & Recharts – Data visualization.
  • React Hot Toast – Notifications.
  • ExcelJS & jsPDF – Export data to Excel or PDF.
  • SWR – Data fetching and caching.
  • Radix UI Components – Accessible UI elements.
  • clsx & tailwind-merge – Dynamic class management.

πŸ“ Folder Structure (Highlights)

foodya/
β”œβ”€β”€ app/                                # Next.js App Router
β”‚   β”œβ”€β”€ globals.css                     # Global styles
β”‚   β”œβ”€β”€ layout.tsx                      # Root layout
β”‚   β”œβ”€β”€ not-found.tsx                   # 404 page
β”‚   β”‚
β”‚   β”œβ”€β”€ (website)/                      # Public website routes
β”‚   β”‚   β”œβ”€β”€ page.tsx                    # Homepage
β”‚   β”‚   β”œβ”€β”€ about/                      # About page
β”‚   β”‚   └── menu/                       # Public menu display
β”‚   β”‚
β”‚   β”œβ”€β”€ login/                          # Authentication
β”‚   β”‚   └── page.tsx                    # Login page
β”‚   β”‚
β”‚   β”œβ”€β”€ errors/                         # Error pages
β”‚   β”‚   β”œβ”€β”€ 403/                        # Forbidden access
β”‚   β”‚   └── database/                   # Database error page
β”‚   β”‚
β”‚   β”œβ”€β”€ restaurant/                     # Protected POS routes
β”‚   β”‚   β”œβ”€β”€ layout.tsx                  # Dashboard layout with sidebar
β”‚   β”‚   β”œβ”€β”€ page.tsx                    # Dashboard redirect
β”‚   β”‚   β”‚
β”‚   β”‚   β”œβ”€β”€ (admin-panel)/              # RBAC Management
β”‚   β”‚   β”‚   β”œβ”€β”€ modules/                # App modules/pages management
β”‚   β”‚   β”‚   β”œβ”€β”€ permissions/            # Permission assignments
β”‚   β”‚   β”‚   β”œβ”€β”€ roles/                  # Role management
β”‚   β”‚   β”‚   └── users/                  # User management
β”‚   β”‚   β”‚
β”‚   β”‚   └── (restaurant)/               # Restaurant Operations
β”‚   β”‚       β”œβ”€β”€ dashboard/              # Main dashboard with quick actions
β”‚   β”‚       β”œβ”€β”€ menu-categories/        # Menu category management
β”‚   β”‚       β”œβ”€β”€ menu-items/             # Menu items with variants
β”‚   β”‚       β”œβ”€β”€ tables/                 # Table management
β”‚   β”‚       β”œβ”€β”€ bookings/               # Reservation system
β”‚   β”‚       β”œβ”€β”€ orders/                 # Order processing (dine-in, takeaway, drive-thru)
β”‚   β”‚       β”œβ”€β”€ invoices/               # Invoice generation and management
β”‚   β”‚       β”œβ”€β”€ employees/              # Employee records with designations
β”‚   β”‚       β”œβ”€β”€ salaries/               # Payroll management
β”‚   β”‚       β”œβ”€β”€ transaction-categories/ # Financial categories
β”‚   β”‚       β”œβ”€β”€ incomes/                # Income tracking
β”‚   β”‚       β”œβ”€β”€ expenses/               # Expense management
β”‚   β”‚       └── reports/                # Financial reports and analytics
β”‚   β”‚
β”‚   └── api/                            # API Routes
β”‚       β”œβ”€β”€ auth/[...nextauth]/         # Auth.js API handler
β”‚       β”œβ”€β”€ (restaurant)/               # Restaurant API endpoints
β”‚       β”‚   β”œβ”€β”€ menu-categories/        # Menu category CRUD
β”‚       β”‚   β”œβ”€β”€ menu-items/             # Menu items CRUD
β”‚       β”‚   β”œβ”€β”€ restaurant-tables/      # Tables CRUD
β”‚       β”‚   β”œβ”€β”€ bookings-tables/        # Bookings CRUD
β”‚       β”‚   β”œβ”€β”€ orders/                 # Order processing
β”‚       β”‚   β”œβ”€β”€ invoices/               # Invoice operations
β”‚       β”‚   β”œβ”€β”€ employees/              # Employee management
β”‚       β”‚   β”œβ”€β”€ payrolls/               # Salary generation and tracking
β”‚       β”‚   β”œβ”€β”€ transaction-categories/ # Category management
β”‚       β”‚   β”œβ”€β”€ incomes/                # Income CRUD
β”‚       β”‚   β”œβ”€β”€ expenses/               # Expense CRUD
β”‚       β”‚   └── reports/                # Financial reporting data
β”‚       β”œβ”€β”€ (website)/                  # Public API endpoints
β”‚       β”‚   β”œβ”€β”€ categories/             # Public menu categories
β”‚       β”‚   └── menu/                   # Public menu items
β”‚       β”œβ”€β”€ module/                     # Module management API
β”‚       β”œβ”€β”€ permission/                 # Permission management API
β”‚       β”œβ”€β”€ role/                       # Role management API
β”‚       β”œβ”€β”€ user/                       # User management API
β”‚       └── db-health/                  # Database health check
β”‚
β”œβ”€β”€ components/                         # React Components
β”‚   β”œβ”€β”€ ui/                             # ShadCN UI Components
β”‚   β”œβ”€β”€ DataTable/                      # Reusable data table components
β”‚   β”œβ”€β”€ custom/                         # Custom components
β”‚   └── fallbacks/                      # Loading and skeleton components
β”‚
β”œβ”€β”€ lib/                                # Utility Libraries
β”‚   β”œβ”€β”€ utils.ts                        # Helper functions
β”‚   β”œβ”€β”€ date-fns.ts                     # Date utilities
β”‚   β”œβ”€β”€ definations.ts                  # Type definitions
β”‚   β”‚
β”‚   β”œβ”€β”€ db/                             # Database
β”‚   β”‚   └── index.ts                    # Database connection
β”‚   β”‚
β”‚   β”œβ”€β”€ drizzle-schema/                 # Database schemas
β”‚   β”‚   β”œβ”€β”€ admin-panel.schema.ts       # RBAC tables
β”‚   β”‚   β”œβ”€β”€ restaurant.schema.ts        # Restaurant operations tables
β”‚   β”‚   └── index.ts                    # Schema exports
β”‚   β”‚
β”‚   β”œβ”€β”€ zod-schema/                     # Validation schemas
β”‚   β”‚   β”œβ”€β”€ index.ts                    # Common schemas
β”‚   β”‚   └── restaurant.zod.ts           # Restaurant-specific schemas
β”‚   β”‚
β”‚   β”œβ”€β”€ crud-actions/                   # Server actions
β”‚   β”‚   β”œβ”€β”€ users.ts                    # User operations
β”‚   β”‚   β”œβ”€β”€ permission.ts               # Permission operations
β”‚   β”‚   β”œβ”€β”€ employees.ts                # Employee operations
β”‚   β”‚   └── ...                         # Other CRUD operations
β”‚   β”‚
β”‚   β”œβ”€β”€ seeds/                          # Database seeders
β”‚   β”‚   └── seed.ts                     # Initial data seeding
β”‚   β”‚
β”‚   β”œβ”€β”€ swr/                            # SWR configuration
β”‚   β”‚   └── index.ts                    # SWR hooks and config
β”‚   β”‚
β”‚   └── server/helpers/                 # Server utilities
β”‚       └── imageUpload.ts              # Image upload handler
β”‚
β”œβ”€β”€ hooks/                              # Custom React Hooks
β”‚   β”œβ”€β”€ use-mobile.ts                   # Mobile detection
β”‚   β”œβ”€β”€ use-order-cart.ts               # Order cart management
β”‚   β”œβ”€β”€ useDbStatus.ts                  # Database health monitoring
β”‚   β”œβ”€β”€ useModulePermission.ts          # Permission checking
β”‚   β”œβ”€β”€ usePermissionNavigation.tsx     # Permission-based navigation
β”‚   β”œβ”€β”€ useShortcuts.ts                 # Keyboard shortcuts
β”‚   └── context/                        # React Context providers
β”‚       β”œβ”€β”€ OrderCartContext.tsx        # Order cart state
β”‚       └── useUserContext.tsx          # User session state
β”‚
β”œβ”€β”€ types/                              # TypeScript Definitions
β”‚   β”œβ”€β”€ columns.data-table.ts           # Table column types
β”‚   β”œβ”€β”€ next-auth.d.ts                  # Auth.js type extensions
β”‚   └── file-saver.d.ts                 # File saver types
β”‚
β”œβ”€β”€ constants/                          # Application Constants
β”‚   └── index.ts                        # Shared constants
β”‚
β”œβ”€β”€ public/                             # Static Assets
β”‚    β”œβ”€β”€ icons/                          # Icon files
β”‚    β”œβ”€β”€ images/                         # Image assets
β”‚    └── profile/                        # User profile images
β”‚
β”œβ”€β”€ README.md
β”œβ”€β”€ auth.config.ts                      # Auth.js configuration
β”œβ”€β”€ auth.ts                             # Authentication setup
β”œβ”€β”€ middleware.ts                       # Next.js middleware for route protection
β”œβ”€β”€ drizzle.config.ts                   # Drizzle ORM configuration
β”œβ”€β”€ next.config.ts                      # Next.js configuration
β”œβ”€β”€ package.json                        # Dependencies and scripts

πŸ“¦ Installation

# 1. Clone the repo
git clone https://github.com/CodifyCanvas/foodya.git
cd foodya

# 2. Install dependencies
npm install

# 3. Set up .env file
cp .env
# Fill in your DATABASE_URL, AUTH_SECRET, etc.

# 4. Run Drizzle migrations
npx drizzle-kit push

# 5. Run dev server
npm run dev

# 6. Build for Production
npm run build

# 7. Start Server
npm start

🌐 Environment Variables (.env)

# Database Connection Parameters
DATABASE_NAME=
DATABASE_USER=
DATABASE_HOST=
DATABASE_PORT=
DATABASE_PASSWORD=
DATABASE_MAX_CONNECTION=

# Auth.js
AUTH_SECRET=

✨ Keyboard Shortcuts

Shortcut Action Path
Alt + D Go to Dashboard /restaurant/dashboard
Alt + U Go to Users Page /restaurant/users
Alt + R Go to Roles Page /restaurant/roles
Alt + P Go to Permissions Page /restaurant/permissions
Alt + M Go to Modules Page /restaurant/modules
Alt + C Go to Menu Categories Page /restaurant/menu-categories
Alt + I Go to Menu Items Page /restaurant/menu-items
Alt + T Go to Tables Page /restaurant/tables
Alt + B Go to Bookings Page /restaurant/bookings
Alt + O Go to Orders Page /restaurant/orders
Alt + N Go to Invoices Page /restaurant/invoices
Alt + E Go to Employees Page /restaurant/employees
Alt + S Go to Salaries Page /restaurant/salaries
Alt + X Go to Transaction Categories Page /restaurant/transaction-categories
Alt + Q Go to Expenses Page /restaurant/expenses
Alt + Z Go to Incomes Page /restaurant/incomes
Alt + L Go to Reports Page /restaurant/reports

πŸ” Authentication

Credentials-based login
Secure sessions using Auth.js
Middleware protected routes
RBAC Per Page


🀝 Contributing

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


πŸ“„ License & Usage

This project is 100% free for personal or educational use.
MIT-style open freedom β€” no restrictions.


πŸ’¬ Credits

Built with ❀️ using Next.js 15 by Shahzaib Awan

About

Foodya POS is a powerful restaurant operations system featuring menu management, orders, table handling, employee payroll, financial tracking, and detailed analytics. Developed with Next.js 15, TypeScript, and MySQL, it provides fast performance, clean UI, and secure RBAC-based access for all user roles

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published