A full-stack application for tracking food delivery revenue with Vue.js frontend and Go backend.
- Prerequisites
- Project Structure
- Installation & Setup
- Running the Application
- Development
- API Endpoints
- Database Schema
- Environment Configuration
Before running this project locally, ensure you have the following installed:
- Node.js: Version ^20.19.0 or >=22.12.0
- pnpm: Package manager for frontend dependencies
- Go: Version 1.21.0 or higher
- MySQL: Version 5.7 or higher
# Install Node.js (visit https://nodejs.org)
# Install pnpm
npm install -g pnpm
# Install Go (visit https://golang.org/dl)
# Install MySQL (visit https://dev.mysql.com/downloads/mysql)food-delivery-revenue-tracking/
βββ src/ # Frontend (Vue.js)
β βββ main.js # Application entry point
β βββ App.vue # Root component
β βββ router/ # Vue Router configuration
β βββ __tests__/ # Unit tests
βββ backend/ # Backend (Go)
β βββ cmd/server/ # Application entry point
β βββ internal/ # Internal packages
β β βββ database/ # Database connection
β β βββ models/ # Data models
β βββ pkg/config/ # Configuration management
β βββ database/ # SQL schema and migrations
β βββ .env.example # Environment variables template
β βββ go.mod # Go dependencies
βββ package.json # Frontend dependencies
βββ vite.config.js # Vite configuration
βββ README.md # This file
git clone <repository-url>
cd food-delivery-revenue-tracking# Install frontend dependencies
pnpm install# Navigate to backend directory
cd backend
# Install Go dependencies
go mod tidy
# Return to root directory
cd ..# On Windows (if using MySQL service)
net start mysql
# On macOS (if using Homebrew)
brew services start mysql
# On Linux (Ubuntu/Debian)
sudo systemctl start mysql# Connect to MySQL
mysql -u root -p
# Create database and tables using the schema file
source backend/database/schema.sql
# Exit MySQL
exit# Copy environment template
cp backend/.env.example backend/.env
# Edit the .env file with your database credentials
# Default values should work if you're using standard MySQL setupcd backend
go run cmd/server/main.goThe backend server will start on http://localhost:8080
# From root directory
pnpm devThe frontend will start on http://localhost:5173 with hot reload
pnpm buildcd backend
go build -o bin/server cmd/server/main.go
./bin/server# Development server with hot reload
pnpm dev
# Build for production
pnpm build
# Preview production build
pnpm preview
# Run unit tests
pnpm test:unit
# Lint code (with auto-fix)
pnpm lint
# Format code with Prettier
pnpm formatcd backend
# Run development server
go run cmd/server/main.go
# Build binary
go build -o bin/server cmd/server/main.go
# Run tests (if available)
go test ./...
# Update dependencies
go mod tidy# Connect to MySQL
mysql -u root -p
# Use the database
use food_delivery_revenue_database;
# Show tables
show tables;
# Reset database (reload schema)
source backend/database/schema.sqlThe backend server provides the following REST API endpoints:
| Method | Endpoint | Description |
|---|---|---|
| GET | /health |
Health check endpoint |
| GET | /api/v1/restaurants |
Get all restaurants |
| GET | /api/v1/orders |
Get all orders |
| GET | /api/v1/revenue |
Get revenue reports |
# Health check
curl http://localhost:8080/health
# Get restaurants
curl http://localhost:8080/api/v1/restaurants
# Get orders
curl http://localhost:8080/api/v1/orders
# Get revenue reports
curl http://localhost:8080/api/v1/revenueThe application uses the following main tables:
- restaurants: Store restaurant information
- orders: Store order details and revenue data
- revenue_reports: Store aggregated revenue reports
See backend/database/schema.sql for complete schema definition and sample data.
# Database Configuration
DB_HOST=localhost
DB_PORT=3306
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=food_delivery_revenue_database
# Server Configuration
SERVER_PORT=8080# Run unit tests
pnpm test:unit
# Run tests in watch mode
pnpm test:unit --watchcd backend
go test ./...# Check what's using port 8080
netstat -ano | findstr :8080 # Windows
lsof -i :8080 # macOS/Linux
# Kill the process if needed- Ensure MySQL is running
- Check database credentials in
.envfile - Verify database exists:
show databases; - Check if tables exist:
use food_delivery_revenue_database; show tables;
# Clear node_modules and reinstall
rm -rf node_modules pnpm-lock.yaml
pnpm install# Clean Go module cache
go clean -modcache
go mod tidy- Fork the repository
- Create a feature branch
- Make your changes
- Run tests and linting
- Submit a pull request
This project is private and proprietary.