Skip to content

ahmedsamir45/Ecommerce-API

Repository files navigation

Here's a comprehensive README.md file for your Django REST Framework e-commerce project:

Ecommerce API - DRF Implementation

Django REST Framework Python

A complete e-commerce backend API built with Django REST Framework, featuring:

  • Product catalog management
  • Shopping cart functionality
  • Order processing
  • User profiles
  • Stripe payment integration

Features

Core Functionality

  • Product Management

    • CRUD operations for products
    • Multiple image uploads
    • Category organization
    • Product reviews
  • Shopping Cart

    • Add/remove items
    • Quantity adjustment
    • Cart total calculation
  • Order Processing

    • Checkout workflow
    • Order history
    • Admin order management
  • User System

    • Profile management
    • Order tracking
    • JWT authentication
  • Payment Integration

    • Stripe checkout
    • Payment success/failure handling

API Documentation

Interactive API documentation available at:

  • Swagger UI: /swagger/
  • ReDoc: /redoc/

Installation

Prerequisites

  • Python 3.8+
  • PostgreSQL (recommended) or SQLite
  • Stripe account for payments

Setup

  1. Clone the repository:

    https://github.com/ahmedsamir45/Ecommerce-API.git
    cd Ecommerce-API
  2. Create and activate virtual environment:

    python -m venv venv
    source venv/bin/activate  # Linux/Mac
    venv\Scripts\activate     # Windows
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure environment variables:

    cp .env.example .env

    Edit .env with your settings

  5. Run migrations:

    python manage.py migrate
  6. Create superuser:

    python manage.py createsuperuser
  7. Run development server:

    python manage.py runserver

Project Structure

drf-ecommerce/
├── api/               # API endpoints
├── core/              # Custom user model
├── ecommerce/         # Project settings
├── storeapp/          # Main ecommerce app
│   ├── migrations/
│   ├── models/        # Database models
│   ├── serializers/   # DRF serializers
│   ├── views/         # API views
│   └── urls.py        # App URLs
├── UserProfile/       # User profiles
├── static/            # Static files
├── .env.example       # Environment template
├── manage.py          # Django CLI
└── requirements.txt   # Dependencies

API Endpoints

Endpoint Description Auth Required
GET /products/ List all products No
POST /products/ Create new product Admin
GET /products/{id}/ Get product details No
POST /carts/ Create new cart No
GET /carts/{id}/ Get cart details No
POST /orders/ Create order from cart Yes
GET /orders/{id}/pay/ Initiate Stripe payment Yes

Configuration

Edit these settings in .env:

DEBUG=True
SECRET_KEY=your-secret-key
DATABASE_URL=postgres://user:pass@localhost:5432/dbname
STRIPE_SECRET_KEY=your-stripe-key
STRIPE_PUBLIC_KEY=your-stripe-pub-key

Contributing

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

This README includes:

  1. Project Overview - Clear description of what the project does
  2. Key Features - Highlighted functionality
  3. Installation Guide - Step-by-step setup instructions
  4. API Documentation - How to access interactive docs
  5. Project Structure - Directory layout explanation
  6. Configuration - Environment variables
  7. Deployment Options - Heroku and Docker
  8. Contributing Guidelines - For open source collaboration
  9. License and Contact - Legal and support information

You can customize:

  • Contact information
  • Deployment options
  • Feature highlights
  • Badges at the top
  • License type

Would you like me to add any specific sections or modify any existing content?

About

ecommerce api using django and djoser and DRF strip

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published