# Local Installation
This guide will help you set up CloudPOS on your local computer for development or testing.
# Step 1: Clone or Download the Project
If you have the project files, navigate to the project directory:
cd CloudPOS
# Step 2: Install Root Dependencies
Install the root package dependencies:
npm install
This installs dotenv which is used for environment variable management.
# Step 3: Create Environment File
Create a .env file in the project root:
# Windows
copy .env.example .env
# macOS/Linux
cp .env.example .env
Note: If .env.example doesn't exist, create .env manually (see Environment Configuration).
# Step 4: Configure Database
- Create MySQL Database
Open MySQL command line or MySQL Workbench:
CREATE DATABASE cloudpos CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
- Update
.envFile
Edit the .env file in the project root and set your database connection:
DATABASE_URL="mysql://root:@localhost:3306/cloudpos"
For Laragon (Windows):
DATABASE_URL="mysql://root:@localhost:3306/cloudpos"
For MySQL with password:
DATABASE_URL="mysql://root:yourpassword@localhost:3306/cloudpos"
For custom user:
DATABASE_URL="mysql://cloudpos:yourpassword@localhost:3306/cloudpos"
# Step 5: Setup Backend (Server)
- Navigate to server directory:
cd server
- Install dependencies:
npm install
- Generate Prisma Client:
npm run prisma:generate
This creates the database client based on the Prisma schema.
- Run database migrations:
npm run prisma:migrate
This creates all database tables. You may be prompted to name the migration - just press Enter to use the default.
- Seed the database (optional):
This creates sample data for testing:
npm run prisma:seed
Default test credentials:
- Email:
admin@acme.com - Password:
password123
- Create admin user (for SaaS admin panel):
npm run prisma:seed:cms
Or manually:
npx ts-node prisma/create-admin.ts
Default admin credentials:
- Email:
admin@cloudpos.com - Password:
admin123
⚠️ Important: Change these passwords after first login!
- Start the development server:
npm run start:dev
The API server will start at http://localhost:3000/api
Verify it's working:
- Open:
http://localhost:3000/api/health(if health endpoint exists) - You should see the server logs in the terminal
# Step 6: Setup Frontend (Client)
Open a new terminal window (keep the server running):
- Navigate to client directory:
cd client
- Install dependencies:
npm install
- Start the development server:
npm run dev
The frontend will start at http://localhost:5173
# Step 7: Verify Installation
# Check Backend API
Open your browser and visit:
http://localhost:3000/api
You should see a response (may be an error page, but the server is running).
# Check Frontend
Open your browser and visit:
http://localhost:5173
You should see the CloudPOS landing page or login page.
# Test Login
Login as Tenant User:
- Go to:
http://localhost:5173/login - Email:
admin@acme.com - Password:
password123
- Go to:
Login as Admin:
- Go to:
http://localhost:5173/admin/login - Email:
admin@cloudpos.com - Password:
admin123
- Go to:
# Step 8: Common Development Commands
# Backend (in server/ directory)
# Start development server (with hot reload)
npm run start:dev
# Build for production
npm run build
# Start production server
npm run start:prod
# Run database migrations
npm run prisma:migrate
# Generate Prisma Client (after schema changes)
npm run prisma:generate
# Open Prisma Studio (database GUI)
npm run prisma:studio
# Seed database
npm run prisma:seed
# Frontend (in client/ directory)
# Start development server
npm run dev
# Build for production
npm run build
# Preview production build
npm run preview
# Lint code
npm run lint
# Fix linting errors
npm run lint:fix
# Troubleshooting
# Database Connection Error
Error: Can't reach database server or Authentication failed
Solutions:
Check MySQL is running:
# Windows (Laragon) # Check Laragon dashboard - MySQL should be green # macOS brew services list # Linux sudo systemctl status mysqlVerify database exists:
SHOW DATABASES; -- Should see 'cloudpos' in the listCheck credentials in
.env:- Make sure
DATABASE_URLis correct - Test connection:
mysql -u root -p -h localhost
- Make sure
# Port Already in Use
Error: Port 3000 is already in use
Solution:
Find the process:
# Windows netstat -ano | findstr :3000 # macOS/Linux lsof -i :3000Kill the process or change port:
- Edit
.env:PORT=3001 - Update
CORS_ORIGINandFRONTEND_URLaccordingly
- Edit
# Prisma Migration Errors
Error: Migration failed or Table already exists
Solutions:
Reset database (⚠️ deletes all data):
cd server npx prisma migrate reset npm run prisma:generate npm run prisma:migrateOr push schema without migrations:
npm run prisma:db:push
# Frontend Can't Connect to API
Error: Network Error or CORS error
Solutions:
Check API server is running:
- Visit:
http://localhost:3000/api - Should see a response
- Visit:
Check CORS settings in
.env:CORS_ORIGIN=http://localhost:5173Restart both servers:
- Stop both servers (Ctrl+C)
- Start backend first, then frontend
# Next Steps
Now that you have CloudPOS running locally:
- ✅ Configure Environment Variables - See Environment Configuration
- ✅ Set up Admin Panel - See Admin Panel
- ✅ Configure Payment Gateway - See Payment Gateway (optional)
- ✅ Set up Email - See Email Notifications (optional)
Ready for production? See Production Installation