Skip to content

Repository files navigation

Order Processing System

A simplified online bookstore system built using .NET 10 (C#) for the backend and Next.js for the frontend. This system supports Administrators and Customers, managing books, publishers, stock levels, orders, sales, and shopping carts.

The project uses raw SQL (no ORM), Docker & Docker Compose, unit testing, and CI/CD pipelines.


Features

Admin Features

  • Add, modify, and delete books

  • Manage book stock levels

  • Place and confirm orders with publishers

  • Generate reports:

    • Total sales (daily/monthly)
    • Top 5 customers
    • Top 10 selling books
    • Number of times a book has been ordered

Customer Features

  • Register, login, and manage account
  • Search books by title, ISBN, author, category, or publisher
  • Manage shopping cart (add, remove, view)
  • Checkout with saved credit cards
  • Manage credit cards with AES-256 encryption
  • View past orders

System Features

  • Raw SQL queries with integrity constraints
  • Triggers for automatic stock management
  • JWT-based authentication with role-based authorization
  • AES-256-CBC encryption for sensitive data (credit cards)
  • Comprehensive admin reporting system
  • Dockerized backend, frontend, and database
  • CI/CD pipelines for automated build and deployment

Tech Stack

  • Backend: .NET 10, ASP.NET Core Web API, C#
  • Frontend: Next.js, React, TailwindCSS
  • Database: PostgreSQL (raw SQL)
  • Containerization: Docker & Docker Compose
  • Testing: xUnit (backend), Jest & React Testing Library (frontend)
  • CI/CD: GitHub Actions
  • Authentication: JWT

File Structure

Order_Processing_System/
├── backend/
│ ├── Controllers/
│ │ ├── AuthController.cs
│ │ ├── AuthorsController.cs
│ │ ├── BooksController.cs
│ │ ├── CartController.cs
│ │ ├── CreditCardsController.cs
│ │ ├── PublishersController.cs
│ │ ├── ReplenishmentOrdersController.cs
│ │ ├── ReportsController.cs
│ │ └── UsersController.cs
│ ├── Services/
│ │ ├── Author/
│ │ ├── Book/
│ │ ├── Cart/
│ │ ├── CreditCard/
│ │ │ ├── ICreditCardService.cs
│ │ │ └── CreditCardService.cs
│ │ ├── CustomerOrder/
│ │ ├── Publisher/
│ │ ├── Report/
│ │ │ ├── IReportService.cs
│ │ │ └── ReportService.cs
│ │ ├── ReplenishmentOrder/
│ │ ├── Seeders/
│ │ └── User/
│ ├── Repositories/
│ │ ├── Author/
│ │ ├── Book/
│ │ ├── Cart/
│ │ ├── CreditCard/
│ │ │ ├── ICreditCardRepository.cs
│ │ │ └── CreditCardRepository.cs
│ │ ├── CustomerOrder/
│ │ ├── Publisher/
│ │ ├── Report/
│ │ │ ├── IReportRepository.cs
│ │ │ └── ReportRepository.cs
│ │ ├── ReplenishmentOrder/
│ │ └── User/
│ ├── Migrations/
│ │ ├── 001_InitialSchema.sql
│ │ ├── 002_Triggers.sql
│ │ └── MigrationRunner.cs
│ ├── Models/
│ │ ├── Authors.cs
│ │ ├── Book.cs
│ │ ├── Carts.cs
│ │ ├── CreditCard.cs
│ │ ├── CustomerOrders.cs
│ │ ├── Publisher.cs
│ │ ├── ReplenishmentOrder.cs
│ │ └── User.cs
│ ├── DTOs/
│ │ ├── Author/
│ │ ├── Book/
│ │ ├── Cart/
│ │ ├── CreditCard/
│ │ │ └── CreditCardDTO.cs
│ │ ├── CustomerOrders/
│ │ ├── Publisher/
│ │ ├── Report/
│ │ │ └── ReportDTO.cs
│ │ ├── ReplenishmentOrder/
│ │ └── User/
│ ├── Middleware/
│ │ └── GlobalLogger.cs
│ ├── openapi/
│ │ └── openapi.json
│ ├── Properties/
│ │ └── launchSettings.json
│ ├── appsettings.json
│ ├── appsettings.Development.json
│ ├── backend.csproj
│ ├── backend.http
│ └── Program.cs
├── frontend/
│ ├── app/
│ │ ├── signup/
│ │ ├── globals.css
│ │ ├── layout.tsx
│ │ └── page.tsx
│ ├── public/
│ ├── eslint.config.mjs
│ ├── next.config.ts
│ ├── package.json
│ ├── postcss.config.mjs
│ ├── tsconfig.json
│ └── README.md
├── database/
│ └── schema.sql
├── docs/
│ ├── Contribution Guidelines & Conventions.md
│ └── ERDdiagram.dot
├── tests/
│ └── backend/
│ ├── Controllers/
│ ├── Services/
│ ├── backend.Tests.csproj
│ └── UnitTest1.cs
├── compose.yaml
├── docker-compose.override.yml
├── Dockerfile.backend
├── Dockerfile.backend.dev
├── Dockerfile.frontend
├── Order_Processing_System.sln
├── package.json
└── README.md

Database

The system includes the following main tables:

  • Books
  • Authors
  • BookAuthors
  • Publishers
  • PublisherPhones
  • ReplenishmentOrder
  • Users
  • Cart
  • CartItems
  • CustomerOrder
  • CustomerOrderItems
  • CreditCard

Triggers & Constraints:

  • Prevent negative stock updates
  • Automatic order creation when stock < threshold
  • Update stock upon order confirmation

Sample ERD and relational schema are provided in /database/schema.sql.


API Endpoints

Examples:

Auth

MethodEndpointDescription
POST/api/auth/loginCustomer/Admin login
POST/api/auth/registerCustomer registration

Books

MethodEndpointDescription
GET/api/booksList all books
GET/api/books/{isbn}Get book details
GET/api/books/searchSearch books by title/author/category
POST/api/booksAdd new book (Admin only)
PUT/api/books/{isbn}Update book (Admin only)
DELETE/api/books/{isbn}Delete book (Admin only)

Orders

MethodEndpointDescription
POST/api/ordersPlace order (Admin only)
PUT/api/orders/{id}/confirmConfirm order (Admin only)
GET/api/ordersList all orders

Shopping Cart

MethodEndpointDescription
GET/api/cartGet customer cart
POST/api/cart/itemsAdd item to cart
DELETE/api/cart/items/{id}Remove item from cart
POST/api/cart/checkoutComplete purchase

Credit Cards

MethodEndpointDescription
GET/api/credit-cardsGet saved credit cards
POST/api/credit-cardsAdd new credit card (encrypted)
DELETE/api/credit-cards/{id}Delete credit card

Reports (Admin Only)

MethodEndpointDescription
GET/api/reports/sales/previous-monthPrevious month total sales
GET/api/reports/sales/by-date?date={yyyy-MM-dd}Sales for specific date
GET/api/reports/customers/top-5Top 5 customers (last 3 months)
GET/api/reports/books/top-10Top 10 selling books (last 3 months)
GET/api/reports/books/{isbn}/replenishment-ordersReplenishment orders for book

For full OpenAPI documentation, see (OpenAPI YAML)


Setup & Deployment (Docker Compose)

1. Clone Repository

git clone https://github.com/AhmWael/Order_Processing_System.git
cd Order_Processing_System

2. Build and Run

docker-compose up --build

This will start:

  • Backend: http://localhost:5000
  • Frontend: http://localhost:3000
  • Database: SQL Server/PostgreSQL container

3. Apply Database Schema

docker exec -i <db-container> psql -U <user> -d <dbname>< database/schema.sql
docker exec -i <db-container> psql -U <user> -d <dbname>< database/seed.sql
docker exec -i <db-container> psql -U <user> -d <dbname>< database/triggers.sql

4. Access Application

  • Frontend: http://localhost:3000
  • API Swagger Docs: http://localhost:5000/swagger

Testing

Backend Unit Tests

cd backend
dotnet test

Frontend Tests

cd frontend
npm install
npm run test

License

This project is licensed under the MIT License. See LICENSE for details.

About

Full-stack online bookstore system built with .NET 10 and Next.js, featuring raw SQL, JWT auth, Dockerized services, CI/CD pipelines, and advanced admin reporting.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages