# Automated installation (RECOMMENDED)
install.bat
# Manual installation
cd backend
npm install
cd ..\frontend
npm install# Automated startup (RECOMMENDED)
start-dayflow.bat
# Manual startup - Backend
cd backend
npm run dev
# Manual startup - Frontend (in separate terminal)
cd frontend
npm start# Automated installation (RECOMMENDED)
chmod +x install.sh
./install.sh
# Manual installation
cd backend
npm install
cd ../frontend
npm install# Automated startup (RECOMMENDED)
chmod +x start-dayflow.sh
./start-dayflow.sh
# Manual startup - Backend
cd backend
npm run dev
# Manual startup - Frontend (in separate terminal)
cd frontend
npm start# Start development server with auto-reload
npm run dev
# Start production server
npm start
# Install a new package
npm install <package-name>
# Update all packages
npm update# Start development server
npm start
# Create production build
npm run build
# Run tests
npm test
# Install a new package
npm install <package-name># Start MongoDB
net start MongoDB
# Stop MongoDB
net stop MongoDB
# Check status - Go to Services (Win+R, type services.msc)# Start MongoDB
sudo systemctl start mongod
# Stop MongoDB
sudo systemctl stop mongod
# Check status
sudo systemctl status mongod
# Restart MongoDB
sudo systemctl restart mongod# Connect to MongoDB
mongosh
# Show databases
show dbs
# Use DayFlow database
use dayflow
# Show collections
show collections
# View all employees
db.employees.find()
# Count documents
db.employees.countDocuments()
# Exit MongoDB shell
exitBackend:
cd backend
rm -rf node_modules package-lock.json # Mac/Linux
# OR
rmdir /s node_modules && del package-lock.json # Windows
npm installFrontend:
cd frontend
rm -rf node_modules package-lock.json # Mac/Linux
# OR
rmdir /s node_modules && del package-lock.json # Windows
npm installmongosh
use dayflow
db.dropDatabase()
exit# Edit backend/.env file
notepad backend\.env # Windows
nano backend/.env # Mac/LinuxRequired Variables:
PORT=5000
MONGODB_URI=mongodb://localhost:27017/dayflow
JWT_SECRET=your_secret_key_change_this
JWT_EXPIRE=7d
NODE_ENV=development| Service | URL | Description |
|---|---|---|
| Frontend | http://localhost:3000 | React app |
| Backend API | http://localhost:5000 | Express server |
| API Health | http://localhost:5000/api/health | Health check |
| MongoDB | mongodb://localhost:27017 | Database |
Check server health:
curl http://localhost:5000/api/healthSign up:
curl -X POST http://localhost:5000/api/auth/signup \
-H "Content-Type: application/json" \
-d '{
"employeeId": "EMP001",
"email": "test@test.com",
"password": "test123",
"firstName": "Test",
"lastName": "User",
"role": "Employee"
}'Sign in:
curl -X POST http://localhost:5000/api/auth/signin \
-H "Content-Type: application/json" \
-d '{
"email": "test@test.com",
"password": "test123"
}'Import the following base URL: http://localhost:5000/api
Headers for authenticated requests:
Authorization: Bearer <your-jwt-token>
Content-Type: application/json
Windows:
netstat -ano | findstr :5000
netstat -ano | findstr :3000Mac/Linux:
lsof -i :5000
lsof -i :3000Windows:
# Find PID from netstat command, then:
taskkill /PID <PID> /FMac/Linux:
# Kill process on port 5000
kill -9 $(lsof -ti:5000)
# Kill process on port 3000
kill -9 $(lsof -ti:3000)Backend logs:
cd backend
# Logs appear in the terminal running npm run devFrontend logs:
- Open browser console (F12)
- Or check terminal running npm start
cd frontend
npm run build
# Files will be in frontend/build/cd backend
NODE_ENV=production npm startBackend:
cd backend
npm outdatedFrontend:
cd frontend
npm outdated# Update all packages
npm update
# Update specific package
npm update <package-name>
# Install latest version
npm install <package-name>@latest# View installed packages
npm list --depth=0
# Check npm version
npm --version
# Clear npm cache
npm cache clean --force
# Audit for vulnerabilities
npm audit
# Fix vulnerabilities
npm audit fix# Initialize git repository
git init
# Add all files
git add .
# Commit changes
git commit -m "Initial commit"
# Create .gitignore (already provided)
# It excludes node_modules, .env, etc.
# Push to GitHub
git remote add origin <your-repo-url>
git push -u origin mainmongodump --db dayflow --out ./backup
# Restore from backup
mongorestore --db dayflow ./backup/dayflow# Generate random string
node -e "console.log(require('crypto').randomBytes(64).toString('hex'))"
# Copy output and paste into backend/.env as JWT_SECRET- Find your computer's IP address:
Windows:
ipconfig
# Look for IPv4 AddressMac/Linux:
ifconfig
# Look for inet address- On mobile browser, open:
http://<your-ip>:3000
Example: http://192.168.1.100:3000
# Stop all servers (Ctrl+C in terminals)
# Delete all node_modules
cd backend
rm -rf node_modules package-lock.json
cd ../frontend
rm -rf node_modules package-lock.json
# Reinstall everything
cd ..
# Windows: install.bat
# Mac/Linux: ./install.sh
# Clear MongoDB database
mongosh
use dayflow
db.dropDatabase()
exit
# Restart everything
# Windows: start-dayflow.bat
# Mac/Linux: ./start-dayflow.sh- Always start MongoDB first before starting the backend
- Use separate terminals for backend and frontend
- Check logs if something doesn't work
- Clear browser cache if UI doesn't update
- Restart servers after changing .env files
Need more help? Check:
- START_HERE.md - Getting started guide
- README.md - Full documentation
- QUICKSTART.md - Quick setup