Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

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

Repository files navigation

LUNE β€” Premium Full-Stack E-Commerce Website

LUNE is a modern, minimalist full-stack fashion and lifestyle e-commerce application built with Django, SQLite, HTML5, CSS3, and vanilla JavaScript.

The project was developed as Task 1 of the CodeAlpha Full Stack Development Internship, with a focus on building a complete e-commerce workflow from product discovery to cart management, authentication, checkout, order processing, and wishlist functionality.


✨ Project Highlights

LUNE provides a complete shopping experience with:

  • πŸ›οΈ Dynamic product catalog
  • πŸ”Ž Product search
  • πŸ—‚οΈ Category-based browsing
  • ↕️ Product sorting and filtering
  • ❀️ Wishlist functionality
  • πŸ›’ Session-based shopping cart
  • πŸ‘€ User registration and authentication
  • πŸ“¦ Checkout and order processing
  • πŸ“‹ Order history and order details
  • πŸ“Š Stock management
  • πŸ” Django security features
  • ⚑ AJAX-powered cart interactions
  • πŸ§ͺ Automated Django tests

πŸ› οΈ Tech Stack

Frontend

  • HTML5
  • CSS3(Vanilla)
  • JavaScript (ES6+)
  • AJAX / Fetch API

Backend

  • Python
  • Django

Database

  • SQLite for development
  • PostgreSQL-ready architecture

Development Tools

  • Visual Studio Code
  • Git
  • GitHub
  • Python Virtual Environment

πŸ›’ Core Features

1. Product Management

The product system provides:

  • Dynamic product catalog
  • Product detail pages
  • Product categories
  • Product search
  • Product sorting
  • Price filtering
  • Stock availability filtering
  • Trending product support
  • Product activation status
  • Dynamic product information

2. User Authentication

LUNE includes a complete user authentication system:

  • User registration
  • Secure login
  • Logout
  • User profiles
  • Password hashing through Django's authentication system
  • Protected user-specific pages

Django's @login_required decorator is used to restrict private functionality such as checkout, orders, and account-related pages.


3. Shopping Cart

The shopping cart supports:

  • Add products to cart
  • Update product quantities
  • Remove products
  • Session-based cart storage
  • Dynamic cart quantity updates
  • Cart drawer
  • Real-time cart total updates
  • AJAX interactions
  • Stock-aware cart operations

The frontend communicates with Django through asynchronous requests, allowing cart updates without unnecessary page reloads.


4. Wishlist

Users can create a personalized wishlist.

Features include:

  • Add products to wishlist
  • Remove products from wishlist
  • User-linked wishlist
  • Wishlist persistence through the database
  • Wishlist toggle functionality

5. Checkout & Orders

The checkout system provides a complete order workflow:

  • Delivery information
  • Order summary
  • Shipping calculation
  • Server-side total calculation
  • Order creation
  • Order item records
  • Stock deduction
  • Order confirmation
  • Order details
  • Order history

The project uses a sandbox-style Cash on Delivery / Demo payment option for testing the checkout workflow.

No real payment gateway or real-world delivery system is connected to this project.


πŸ” Security

Security was considered throughout the application using Django's built-in mechanisms.

Password Security

Django's authentication framework securely hashes user passwords using its password-hashing system.

CSRF Protection

Django's CSRF middleware protects POST requests against Cross-Site Request Forgery attacks.

AJAX cart requests also include the required CSRF token.

Authentication Protection

Private views use Django's authentication controls to ensure that users must be logged in before accessing protected functionality.

Server-Side Order Calculation

Order totals are calculated from database records on the server rather than trusting values sent by the browser.

Form Validation

Django forms are used to validate user-submitted information such as registration and checkout details.


πŸ—„οΈ Database Design

LUNE uses a relational database structure managed through Django's ORM.

Main Models

User

Django's built-in authentication user model stores:

  • Username
  • Email
  • Password
  • First name
  • Last name

Category

Stores product categories.

Main fields:

  • name
  • slug
  • description
  • image

Product

Stores product information.

Main fields:

  • name
  • slug
  • description
  • price
  • stock
  • is_active
  • is_trending
  • created_at
  • updated_at

ProductImage

Stores product images associated with products.

Order

Stores customer order and delivery information.

Includes:

  • Customer information
  • Shipping information
  • Order timestamp
  • Total amount
  • Order status

OrderItem

Stores individual products belonging to an order.

Includes:

  • Product
  • Quantity
  • Purchase-time price

The purchase-time price is stored so that an order retains the price at which the product was purchased.

Wishlist

Connects users with their selected products using a user-linked wishlist and many-to-many product relationship.


πŸ”„ Full-Stack Data Flow

A typical cart interaction follows this flow:

User clicks "Add to Cart"
        ↓
JavaScript event listener
        ↓
AJAX / Fetch POST request
        ↓
CSRF token validation
        ↓
Django URL dispatcher
        ↓
Cart view
        ↓
Product retrieved from database
        ↓
Cart updated in session
        ↓
JSON response returned
        ↓
JavaScript updates cart UI
        ↓
Toast notification displayed

This demonstrates the interaction between the frontend, backend, database, and session-based cart system.


πŸ“ Project Structure

CodeAlpha_LUNE_Ecommerce/
β”‚
β”œβ”€β”€ accounts/
β”‚   β”œβ”€β”€ forms.py
β”‚   β”œβ”€β”€ urls.py
β”‚   └── views.py
β”‚
β”œβ”€β”€ cart/
β”‚   β”œβ”€β”€ cart.py
β”‚   β”œβ”€β”€ context_processors.py
β”‚   β”œβ”€β”€ urls.py
β”‚   └── views.py
β”‚
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ settings.py
β”‚   β”œβ”€β”€ urls.py
β”‚   β”œβ”€β”€ asgi.py
β”‚   └── wsgi.py
β”‚
β”œβ”€β”€ orders/
β”‚   β”œβ”€β”€ forms.py
β”‚   β”œβ”€β”€ models.py
β”‚   β”œβ”€β”€ urls.py
β”‚   └── views.py
β”‚
β”œβ”€β”€ products/
β”‚   β”œβ”€β”€ management/
β”‚   β”‚   └── commands/
β”‚   β”‚       └── seed_db.py
β”‚   β”œβ”€β”€ models.py
β”‚   β”œβ”€β”€ urls.py
β”‚   β”œβ”€β”€ views.py
β”‚   └── tests.py
β”‚
β”œβ”€β”€ wishlist/
β”‚   β”œβ”€β”€ models.py
β”‚   β”œβ”€β”€ urls.py
β”‚   └── views.py
β”‚
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”œβ”€β”€ main.css
β”‚   β”‚   └── components.css
β”‚   β”‚
β”‚   └── js/
β”‚       β”œβ”€β”€ main.js
β”‚       └── cart.js
β”‚
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ base.html
β”‚   β”œβ”€β”€ home.html
β”‚   β”œβ”€β”€ products.html
β”‚   β”œβ”€β”€ product_detail.html
β”‚   β”œβ”€β”€ cart.html
β”‚   β”œβ”€β”€ checkout.html
β”‚   β”œβ”€β”€ confirmation.html
β”‚   β”œβ”€β”€ login.html
β”‚   β”œβ”€β”€ register.html
β”‚   β”œβ”€β”€ profile.html
β”‚   β”œβ”€β”€ wishlist.html
β”‚   └── order_detail.html
β”‚
β”œβ”€β”€ manage.py
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ .gitignore
└── README.md

πŸš€ Getting Started

Prerequisites

Make sure the following are installed:

  • Python 3.10 or higher
  • Git
  • Visual Studio Code

Installation

Clone the repository:

git clone https://github.com/layeebaharam14/CodeAlpha_LUNE_ECommerce.git
cd CodeAlpha_LUNE_ECommerce

Create a virtual environment:

python -m venv .venv

Activate the virtual environment on Windows:

.venv\Scripts\activate

Install the required dependencies:

pip install -r requirements.txt

Run database migrations:

python manage.py migrate

Populate the database with sample products:

python manage.py seed_db

Start the development server:

python manage.py runserver

Open the application in your browser:

http://127.0.0.1:8000/

πŸ§ͺ Testing

The project includes Django test files for the application modules.

Run the tests using:

python manage.py test

πŸ“Œ Internship Task

This project was developed as Task 1 β€” Simple E-Commerce Store for the CodeAlpha Full Stack Development Internship.

The project demonstrates a complete e-commerce workflow including:

  • Product catalog
  • User authentication
  • Shopping cart
  • Wishlist
  • Checkout
  • Order processing
  • Database integration
  • Responsive frontend
  • Django backend functionality

πŸ“ˆ Project Status

Status: Completed

LUNE is a functional educational e-commerce application developed for internship and portfolio purposes.


πŸ‘©β€πŸ’» Author

Layeeba Haram

Computer Science Engineering Student

GitHub: https://github.com/layeebaharam14


πŸ“„ License

This project was created for educational and internship purposes.

About

Premium full-stack e-commerce application built with Django, Python, SQLite, HTML, CSS and JavaScript as part of my CodeAlpha Full Stack Development Internship.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages