Skip to content

osamaelsaeed/Ecommerce-App

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Site

Overview

This project is an e-commerce site that includes authentication and various features such as categories, products, cart management, orders, and payments. It provides a robust API for interacting with these functionalities, with JWT-based authentication and role-based access control.

Features

  • Authentication: Secure login and registration with JWT and OAuth (Google, GitHub)
  • Categories: Manage product categories
  • Products: CRUD operations for products
  • Cart: Add, remove, and view items in the cart
  • Cart Items: Manage items within the cart
  • Order: Place and manage orders
  • Order Items: Manage items within orders
  • Payment: Process payments

Getting Started

Prerequisites

  • Java 17 or higher
  • Maven
  • Docker (optional, for running services in containers)

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/ecommerce-site.git
    cd ecommerce-site

Install dependencies:

bash Copy code mvn install Set up environment variables in .env or application.properties as required by your application.

Start the application:

bash Copy code mvn spring-boot:run (Optional) If using Docker, build and run the containers:

bash Copy code docker-compose up --build API Documentation The API is documented using Swagger. You can access the Swagger UI at: Swagger API Documentation

Project Structure

src/main/java/com/example/ecommerce/:

controllers: REST controllers for handling HTTP requests services: Business logic and service layer dtos: Data Transfer Objects for API requests and responses repos: Repository interfaces for data access authUtils: Utility classes for authentication and authorization

Usage

Authentication

To authenticate, use the /auth/login endpoint to receive a JWT token. Include this token in the Authorization header of your requests as Bearer {token}.

Swagger Documentation

For complete API documentation, including detailed descriptions of all endpoints, parameters, and responses, please refer to the Swagger UI:

Swagger UI:

After running the app go to http://localhost:8080/swagger-ui/index.html

Categories

some of apis in the app

GET /categories - List all categories with pagination Query Parameters: page, size, sort POST /categories - Create a new category PUT /categories/{id} - Update a category DELETE /categories/{id} - Delete a category

Products

GET /products - List all products with pagination Query Parameters: page, size, sort POST /products - Create a new product PUT /products/{id} - Update a product DELETE /products/{id} - Delete a product

Cart

GET /cart - View the cart POST /cart/items - Add an item to the cart DELETE /cart/items/{id} - Remove an item from the cart

Orders

GET /orders - List all orders with pagination Query Parameters: page, size, sort POST /orders - Create a new order GET /orders/{id} - View a specific order

Payment

POST /payment - Process a payment

Contributing

Feel free to contribute by opening issues, submitting pull requests, or suggesting features.

Fork the repository

Create a new branch (git checkout -b feature-branch) Make your changes Commit your changes (git commit -am 'Add new feature') Push to the branch (git push origin feature-branch) Create a new Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any inquiries, please contact om35453@gmail.com.

You can adjust the parameters and endpoints as needed.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages