A React-based web application for managing restaurant operations, translated from a Java/JavaFX application.
project3_group9/
├── src/
│ ├── client/ # Frontend (React + Vite)
│ │ ├── components/ # Reusable UI components
│ │ ├── pages/ # Route-based page components
│ │ ├── utils/ # Client-side utilities (API, types)
│ │ ├── App.tsx # Main app component with routing
│ │ └── main.tsx # Entry point
│ │
│ └── server/ # Backend (Express + Node.js)
│ ├── routes/ # API route definitions
│ │ ├── employees.ts # Employee & login routes
│ │ ├── menu.ts # Menu routes
│ │ ├── inventory.ts # Inventory routes
│ │ ├── orders.ts # Order routes
│ │ ├── customers.ts # Customer routes
│ │ └── reports.ts # Report routes
│ ├── db.ts # Centralized Prisma Client
│ └── index.ts # Server entry point
│
├── prisma/ # Database (Prisma ORM)
│ └── schema.prisma # Database schema
│
├── .env # Environment variables
├── package.json # Dependencies and scripts
├── vite.config.ts # Vite configuration
└── test-db-connection.js # Database connection test script
npm installEdit .env file:
DATABASE_URL="postgresql://username:password@csce-315-db.engr.tamu.edu:5432/group_x_db?schema=public"
PORT=3001Optional API Configuration:
- Leave
VITE_API_URLempty to use Vite proxy (default) - Set
VITE_API_URL="http://localhost:3001/api"for custom API URL
Option A: Test and Create Employees (Recommended)
npm run test:dbThis will:
- Test database connection
- Check Employee table
- Create test employees if table is empty
- Display login credentials
Option B: Use Prisma DB Push
npx prisma db push --accept-data-lossOption C: Manual SQL (for adding image_url to menu table)
If you need to add the image_url column manually, run:
ALTER TABLE menu ADD COLUMN IF NOT EXISTS image_url VARCHAR;npm run prisma:generatenpm run serverThe server should start on http://localhost:3001. You should see:
✅ Database connected successfully
✅ Employee table accessible (X employees found)
Server is running on http://localhost:3001
In a new terminal:
npm run devThe app will open at http://localhost:3000
Note: All authentication is validated against the PostgreSQL database.
npm run dev- Start React development servernpm run server- Start backend servernpm run server:dev- Generate Prisma Client and start servernpm run test:db- Test database connection and create test employees (Deprecated)npm run test:login- Test login endpointnpm run prisma:generate- Generate Prisma Clientnpm run prisma:studio- Open Prisma Studio (database GUI)npm run build- Build for productionnpm run lint- Run ESLint
POST /api/employees/login- LoginGET /api/employees- Get all employeesGET /api/employees/:id- Get employee by IDPOST /api/employees- Create employeePUT /api/employees/:id- Update employeeDELETE /api/employees/:id- Delete employee
GET /api/menu- Get all menu itemsGET /api/menu/:id- Get menu item by IDPOST /api/menu- Create menu itemPUT /api/menu/:id- Update menu itemDELETE /api/menu/:id- Delete menu item
GET /api/inventory- Get all inventory itemsGET /api/inventory/:id- Get inventory item by IDPOST /api/inventory- Create inventory itemPUT /api/inventory/:id- Update inventory itemDELETE /api/inventory/:id- Delete inventory item
GET /api/orders- Get all ordersGET /api/orders/:id- Get order by IDPOST /api/orders- Create order
GET /api/customers- Get all customersGET /api/customers/:id- Get customer by IDPOST /api/customers- Create customerPUT /api/customers/:id- Update customerDELETE /api/customers/:id- Delete customer
GET /api/reports/sales- Sales reportGET /api/reports/x-report- X-ReportGET /api/reports/z-report- Z-ReportGET /api/reports/restock- Restock report
Error: "Database connection failed"
- Check
DATABASE_URLin.envfile - Verify database server is accessible
- Run
npm run test:dbto test connection
Error: "@prisma/client did not initialize yet"
- Run
npm run prisma:generate
Error: "Cannot connect to server"
- Ensure server is running:
npm run server - Check port 3001 is not in use
- Verify Prisma Client is generated
Error: "Employee not found" or "Invalid password"
- Verify credentials match database
- Check server logs for errors
- Frontend: React, TypeScript, Vite, React Router DOM
- Backend: Node.js, Express, TypeScript
- Database: PostgreSQL, Prisma ORM
- Development: ESLint, TypeScript
- Passwords are stored in plain text (in .env)
- No password hashing or encryption
- Accessibility Changes
- UI updates
- Resolving any unnoticed bugs
- Documentation
- Written Materials