Skip to content

django + vue masterpiece by the greatest code magician of all time.

License

Notifications You must be signed in to change notification settings

MohibShaikh/amazon-lite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¦ Amazon Lite

A minimal full-stack application for managing products and orders using Django REST Framework and Vue 3 (Vite).

Backend Setup (Django)

1. Prerequisites

  • Python 3.10+
  • uv (Fast Python Package Manager)

2. Installation

# Clone the repo and enter backend directory
cd backend

# Install dependencies using uv
uv sync

3. Configuration (settings.py) Ensure corsheaders is configured to allow the Vue dev server:

INSTALLED_APPS = [..., "corsheaders", "rest_framework"]
MIDDLEWARE = ["corsheaders.middleware.CorsMiddleware", ...]
CORS_ALLOWED_ORIGINS = ["http://localhost:5173"]

4. Run Server

python manage.py migrate
python manage.py runserver

πŸ’» Frontend Setup (Vue 3 + TS)

1. Prerequisites

  • Node.js 18+
  • npm or pnpm

2. Installation

cd frontend
npm install

3. Environment Config Ensure src/services/api.ts points to your Django server:

  • Base URL: http://localhost:8000/api

4. Run Dev Server

npm run dev

πŸ›  Features Implemented

Backend (DRF)

  • Models: Custom User, Product, Order, and OrderItem (with Many-to-Many through table).
  • Serializers: Nested relationships and SerializerMethodField for calculated totals.
  • API Views: Function-based views (@api_view) for CRUD operations on Products and Orders.

Frontend (Vue 3)

  • Composition API: Uses <script setup lang="ts"> for modern reactivity.
  • Axios Service: Centralized API client with TypeScript interface support.
  • Type Safety: Strict type checking for API responses using import type.

πŸ“– API Endpoints

Method Endpoint Description
GET /api/products/ List all products
POST /api/products/ Create a new product
GET /api/orders/ List all orders with items and totals
DELETE /api/orders/<id>/ Delete an order

About

django + vue masterpiece by the greatest code magician of all time.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published