Skip to content

Latest commit

Β 

History

22 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Food Delivery Revenue Tracking

A full-stack application for tracking food delivery revenue with Vue.js frontend and Go backend.

πŸ“‹ Table of Contents

πŸ›  Prerequisites

Before running this project locally, ensure you have the following installed:

Required Software

  • 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

Installation Commands

# 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)

πŸ“ Project Structure

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

βš™οΈ Installation & Setup

1. Clone the Repository

git clone <repository-url>
cd food-delivery-revenue-tracking

2. Frontend Setup

# Install frontend dependencies
pnpm install

3. Backend Setup

# Navigate to backend directory
cd backend

# Install Go dependencies
go mod tidy

# Return to root directory
cd ..

4. Database Setup

Start MySQL Service

# 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

Create Database and Tables

# Connect to MySQL
mysql -u root -p

# Create database and tables using the schema file
source backend/database/schema.sql

# Exit MySQL
exit

5. Environment Configuration

# 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 setup

πŸš€ Running the Application

Development Mode (Recommended)

Terminal 1 - Start Backend Server

cd backend
go run cmd/server/main.go

The backend server will start on http://localhost:8080

Terminal 2 - Start Frontend Development Server

# From root directory
pnpm dev

The frontend will start on http://localhost:5173 with hot reload

Production Mode

Build Frontend

pnpm build

Build Backend Binary

cd backend
go build -o bin/server cmd/server/main.go
./bin/server

πŸ”§ Development

Frontend Commands

# 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 format

Backend Commands

cd 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

Database Commands

# 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.sql

🌐 API Endpoints

The 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

Example API Calls

# 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/revenue

πŸ—„οΈ Database Schema

The 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.

πŸ” Environment Configuration

Backend Environment Variables (.env)

# 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

πŸ§ͺ Testing

Frontend Tests

# Run unit tests
pnpm test:unit

# Run tests in watch mode
pnpm test:unit --watch

Backend Tests

cd backend
go test ./...

πŸ› Troubleshooting

Common Issues

Port Already in Use

# Check what's using port 8080
netstat -ano | findstr :8080  # Windows
lsof -i :8080                 # macOS/Linux

# Kill the process if needed

Database Connection Issues

  1. Ensure MySQL is running
  2. Check database credentials in .env file
  3. Verify database exists: show databases;
  4. Check if tables exist: use food_delivery_revenue_database; show tables;

Frontend Build Issues

# Clear node_modules and reinstall
rm -rf node_modules pnpm-lock.yaml
pnpm install

Backend Build Issues

# Clean Go module cache
go clean -modcache
go mod tidy

πŸ“š Additional Resources

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

πŸ“ License

This project is private and proprietary.

About

Challange your self with full-stack developer that end-to-end

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages