Skip to content

princechavez/vue-pizza

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

My Pizza App πŸ•

A full-stack pizza shop web application built with ASP.NET Core 9 and Vue.js 3. This project serves as an interview tool for developers to demonstrate their skills in identifying and fixing code issues.

🎯 Project Overview

This application allows users to browse pizzas, view details, and authenticate. The initial implementation focuses on core functionality with clean architecture principles.

Note for Interview Candidates: Future PRs will include cart and order functionality with intentional code issues for you to identify and fix as part of the interview process.

πŸ› οΈ Technology Stack

Backend

  • Framework: ASP.NET Core 9 (MVC API)
  • Database: SQLite with Entity Framework Core (Code-First)
  • Authentication: JWT Bearer Tokens
  • Architecture: Clean Code / Layered Architecture
    • PizzaApp.DTO - Data Transfer Objects
    • PizzaApp.Data - Entity Framework Context, Entities, Migrations
    • PizzaApp.Service - Business Logic Layer
    • PizzaApp.API - Web API Controllers

Frontend

  • Framework: Vue.js 3 with Composition API
  • Build Tool: Vite
  • State Management: TanStack Query (Vue Query)
  • UI Framework: Vuetify (Material Design)
  • Styling: Tailwind CSS
  • Routing: Vue Router

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • .NET 9 SDK
  • Node.js (v18 or higher)
  • npm or yarn
  • A code editor (VS Code recommended)
  • SQLite (usually comes pre-installed on macOS/Linux)

Verify Installation

# Check .NET version
dotnet --version

# Check Node.js version
node --version

# Check npm version
npm --version

πŸš€ Getting Started

Backend Setup

  1. Navigate to the backend directory

    cd backend
  2. Restore NuGet packages

    dotnet restore
  3. Apply database migrations

    cd PizzaApp.API
    dotnet ef database update

    This will create the SQLite database and seed it with sample data.

  4. Run the API

    dotnet run

    The API will start on http://localhost:5000 (or https://localhost:5001 for HTTPS).

    Swagger documentation will be available at http://localhost:5000/swagger

Frontend Setup

  1. Navigate to the frontend directory (from project root)

    cd frontend
  2. Install dependencies

    npm install
  3. Start the development server

    npm run dev

    The application will start on http://localhost:5173

  4. Open your browser

    Navigate to http://localhost:5173 to view the application.

πŸ“ Project Structure

sample-vue-repo/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ PizzaApp.sln                    # Solution file
β”‚   β”œβ”€β”€ PizzaApp.DTO/                   # Data Transfer Objects
β”‚   β”‚   β”œβ”€β”€ Requests/                   # API request models
β”‚   β”‚   β”œβ”€β”€ Responses/                  # API response models
β”‚   β”‚   └── Models/                     # Shared DTOs
β”‚   β”œβ”€β”€ PizzaApp.Data/                  # Data Access Layer
β”‚   β”‚   β”œβ”€β”€ Context/                    # DbContext
β”‚   β”‚   β”œβ”€β”€ Entities/                   # Entity models
β”‚   β”‚   β”œβ”€β”€ Configurations/             # EF configurations
β”‚   β”‚   └── Migrations/                 # EF migrations
β”‚   β”œβ”€β”€ PizzaApp.Service/               # Business Logic Layer
β”‚   β”‚   β”œβ”€β”€ Interfaces/                 # Service interfaces
β”‚   β”‚   β”œβ”€β”€ Services/                   # Service implementations
β”‚   β”‚   └── Repositories/               # Repository pattern
β”‚   └── PizzaApp.API/                   # Web API
β”‚       β”œβ”€β”€ Controllers/                # API controllers
β”‚       β”œβ”€β”€ Middleware/                 # Custom middleware
β”‚       β”œβ”€β”€ Extensions/                 # Extension methods
β”‚       β”œβ”€β”€ appsettings.json           # Configuration
β”‚       └── Program.cs                  # Application entry point
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/                 # Reusable components
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/                # Layout components
β”‚   β”‚   β”‚   β”œβ”€β”€ auth/                  # Auth components
β”‚   β”‚   β”‚   └── pizza/                 # Pizza components
β”‚   β”‚   β”œβ”€β”€ views/                      # Page components
β”‚   β”‚   β”œβ”€β”€ services/                   # API services
β”‚   β”‚   β”œβ”€β”€ composables/                # Vue composables
β”‚   β”‚   β”œβ”€β”€ router/                     # Vue Router config
β”‚   β”‚   β”œβ”€β”€ App.vue                     # Root component
β”‚   β”‚   └── main.js                     # Application entry
β”‚   β”œβ”€β”€ package.json                    # Dependencies
β”‚   β”œβ”€β”€ vite.config.js                  # Vite configuration
β”‚   └── tailwind.config.js              # Tailwind configuration
β”œβ”€β”€ plans/                              # Architecture documentation
└── README.md                           # This file

πŸ”‘ Features

Current Features (Phase 1)

  • βœ… User Authentication

    • Register new account
    • Login with JWT tokens
    • Secure password hashing
  • βœ… Pizza Browsing

    • View all available pizzas
    • See pizza details with toppings
    • Computed pricing (base price + toppings)
  • βœ… Responsive UI

    • Material Design components
    • Tailwind CSS styling
    • Mobile-friendly layout

Upcoming Features (Phase 2 - Interview Task)

  • πŸ”„ Shopping cart functionality
  • πŸ”„ Order placement and history
  • πŸ”„ Admin panel for pizza management
  • πŸ”„ Pizza customization (add/remove toppings)
  • πŸ”„ User profile management

πŸ• Sample Data

The application comes pre-seeded with 5 classic pizzas:

  1. Margherita - $8.99

    • Mozzarella, Tomato Sauce, Basil
  2. Pepperoni - $10.99

    • Mozzarella, Tomato Sauce, Pepperoni
  3. Hawaiian - $11.99

    • Mozzarella, Tomato Sauce, Ham, Pineapple
  4. Meat Lovers - $13.99

    • Mozzarella, Tomato Sauce, Pepperoni, Sausage, Bacon, Ham
  5. Veggie Supreme - $12.99

    • Mozzarella, Tomato Sauce, Bell Peppers, Onions, Mushrooms, Olives

πŸ”Œ API Endpoints

Authentication

  • POST /api/auth/register - Register a new user
  • POST /api/auth/login - Login and receive JWT token

Pizzas

  • GET /api/pizzas - Get all pizzas with computed prices
  • GET /api/pizzas/{id} - Get pizza details with toppings

Toppings

  • GET /api/toppings - Get all available toppings

πŸ§ͺ Testing the Application

Manual Testing Steps

  1. Start both backend and frontend servers

  2. Test Authentication

    • Navigate to /register
    • Create a new account
    • Login with your credentials
    • Verify JWT token is stored in localStorage
  3. Test Pizza Listing

    • Navigate to home page (/)
    • Verify all 5 pizzas are displayed
    • Check that computed prices are shown correctly
  4. Test Pizza Details

    • Click on any pizza card
    • Verify navigation to detail page
    • Check that all toppings are listed
    • Verify computed price matches (base + sum of toppings)

Using Swagger

  1. Navigate to http://localhost:5000/swagger
  2. Test API endpoints directly
  3. Use "Authorize" button to add JWT token for protected endpoints

πŸ› Troubleshooting

Backend Issues

Database not created

cd backend/PizzaApp.API
dotnet ef database update

Port already in use

  • Edit backend/PizzaApp.API/Properties/launchSettings.json
  • Change the port numbers

Migration errors

# Remove existing migrations
dotnet ef migrations remove

# Create new migration
dotnet ef migrations add InitialCreate

# Apply migration
dotnet ef database update

Frontend Issues

Dependencies not installing

# Clear npm cache
npm cache clean --force

# Delete node_modules and reinstall
rm -rf node_modules package-lock.json
npm install

CORS errors

  • Verify backend CORS configuration in Program.cs
  • Check that frontend URL matches allowed origins
  • Ensure backend is running before making requests

Vite port conflict

  • Edit frontend/vite.config.js
  • Change the port in server configuration

πŸ“š Additional Resources

Documentation

Architecture

🀝 For Interview Candidates

What to Expect

This codebase represents a working pizza shop application. In the interview process, you will:

  1. Review the current implementation
    • Understand the architecture
    • Explore the codebase
    • Run the application locally

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors