An online Ecommerce Platform
- Introduction
- Technology Stack
- Project Structure
- Features
- Installation
- Usage
- API Documentation
- Routes and Controllers Overview
- Contributing
- Authors
- License
Voltstore is an e-commerce website designed to provide consumers with a reliable online shopping environment with a wide range of products at low prices.
- User-Friendly Interface: Intuitive navigation and a clean layout to enhance the shopping experience.
- Product Catalog: Detailed product pages with high-quality images, descriptions, and specifications.
- Search Functionality: Advanced search options with filters for categories, prices, sizes, and more.
- Shopping Cart: Easy-to-use cart that allows users to add, edit, or remove items before checkout.
- Secure Checkout Process: Streamlined, secure checkout with multiple payment options (credit/debit cards, PayPal, etc.).
- User Accounts: Option for customers to create accounts to save their information, track orders, and manage preferences.
- Mobile Responsiveness: Optimized for mobile devices to ensure a smooth experience on smartphones and tablets.
- Order Tracking: Customers can track their orders through the website.
- Analytics and Reporting: Tools to analyze user behavior, sales performance, and inventory status.
- SEO Optimization: Built-in tools to improve search engine visibility and attract organic traffic.
- Advanced Filter Options: Unique filtering options for enhancing the shopping experience by helping customers find exactly what they want.
- Next.js (TypeScript) - Server-rendered React framework for building optimized, scalable web applications.
- React.js (JavaScript) - Used for component-based UI development.
- shadcn - Utility-first component library for custom styling and components.
- Material UI - UI library providing pre-styled components to ensure a modern, responsive design.
- Node.js - JavaScript runtime used for building fast and scalable server applications.
- Express.js - Web framework for Node.js to create RESTful APIs and manage server-side logic.
- MongoDB - NoSQL database for efficient, flexible data storage and retrieval.
- JWT (JSON Web Token) - Secure, stateless authentication method for handling user sessions.
.
├── README.md
├── admin
│ ├── package-lock.json
│ ├── package.json
│ ├── public
│ │ ├── _redirects
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo.png
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ └── src
│ ├── App.css
│ ├── App.js
│ ├── App.test.js
│ ├── assets
│ │ └── images
│ │ └── doc.png
│ ├── components
│ │ ├── UnavalableDates
│ │ │ └── UnavalableDates.js
│ │ ├── appointments
│ │ │ ├── AppointmentDetail.js
│ │ │ ├── Appointments.js
│ │ │ ├── Dialog.js
│ │ │ └── TableData.js
│ │ ├── category
│ │ │ ├── AddCategory.js
│ │ │ ├── Category.js
│ │ │ └── CategoryData.js
│ │ ├── customers
│ │ │ ├── CustomerData.js
│ │ │ └── Customers.js
│ │ ├── dashboard
│ │ │ ├── Chart.js
│ │ │ ├── Dashboard.js
│ │ │ ├── Deposits.js
│ │ │ ├── Orders.js
│ │ │ ├── Title.js
│ │ │ └── listItems.js
│ │ ├── departments
│ │ │ └── Departments.js
│ │ ├── doctors
│ │ │ ├── AddDoctor.js
│ │ │ ├── DoctorDetails.js
│ │ │ ├── Doctors.js
│ │ │ ├── DoctorsData.js
│ │ │ └── DoctorsDialog.js
│ │ ├── login
│ │ │ ├── Login.js
│ │ │ └── login.css
│ │ ├── management
│ │ │ ├── AddAdmin.js
│ │ │ ├── Admins.js
│ │ │ ├── EditableDate.js
│ │ │ └── UnAvailableDates.js
│ │ ├── orders
│ │ │ ├── Orders.js
│ │ │ └── OrdersData.js
│ │ ├── pageNotFound
│ │ │ └── PageNotFound.js
│ │ ├── products
│ │ │ ├── AddProduct.js
│ │ │ ├── Products.js
│ │ │ └── ProductsData.js
│ │ └── transactions
│ │ ├── TransactionTable.js
│ │ └── Transactions.js
│ ├── global.css
│ ├── index.css
│ ├── index.js
│ ├── logo.svg
│ ├── reportWebVitals.js
│ ├── setupTests.js
│ ├── state
│ │ ├── adminSlice.js
│ │ ├── appointmentSlice.js
│ │ ├── categorySlice.js
│ │ ├── departmentSlice.js
│ │ ├── dialogSlice.js
│ │ ├── doctorSlice.js
│ │ ├── orderSlice.js
│ │ ├── productSlice.js
│ │ ├── store.js
│ │ ├── transactionSlice.js
│ │ ├── unAvailableDatesSlice.js
│ │ └── userSlice.js
│ ├── styles
│ │ └── navbar.css
│ └── utils
│ ├── ProtectedRoute.js
│ └── PublicRoute.js
├── backend
│ ├── README.md
│ ├── app.ts
│ ├── config
│ │ └── db.ts
│ ├── controllers
│ │ ├── adminController.ts
│ │ ├── cartController.ts
│ │ ├── categoryController.ts
│ │ ├── orderController.ts
│ │ ├── productController.ts
│ │ ├── transactionController.ts
│ │ └── userController.ts
│ ├── dist
│ │ ├── app.js
│ │ ├── config
│ │ │ └── db.js
│ │ ├── controllers
│ │ │ ├── adminController.js
│ │ │ ├── cartController.js
│ │ │ ├── categoryController.js
│ │ │ ├── orderController.js
│ │ │ ├── productController.js
│ │ │ └── userController.js
│ │ ├── middlewares
│ │ │ ├── authMiddleware.js
│ │ │ ├── authorize.js
│ │ │ ├── errorMiddleware.js
│ │ │ ├── file.js
│ │ │ ├── logger.js
│ │ │ └── validation.js
│ │ ├── models
│ │ │ ├── Product.js
│ │ │ ├── cart.js
│ │ │ ├── category.js
│ │ │ ├── order.js
│ │ │ ├── payment.js
│ │ │ ├── review.js
│ │ │ ├── types.js
│ │ │ └── user.js
│ │ ├── routes
│ │ │ ├── adminRoutes.js
│ │ │ ├── cartRoutes.js
│ │ │ ├── categoryRoutes.js
│ │ │ ├── orderRoutes.js
│ │ │ ├── productRoutes.js
│ │ │ └── userRoutes.js
│ │ └── services
│ │ └── upload.js
│ ├── express.d.ts
│ ├── middlewares
│ │ ├── authMiddleware.ts
│ │ ├── authorize.ts
│ │ ├── errorMiddleware.ts
│ │ ├── file.ts
│ │ ├── logger.ts
│ │ └── validation.ts
│ ├── models
│ │ ├── Product.ts
│ │ ├── cart.ts
│ │ ├── category.ts
│ │ ├── order.ts
│ │ ├── payment.ts
│ │ ├── review.ts
│ │ ├── types.ts
│ │ └── user.ts
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ │ ├── adminRoutes.ts
│ │ ├── cartRoutes.ts
│ │ ├── categoryRoutes.ts
│ │ ├── orderRoutes.ts
│ │ ├── productRoutes.ts
│ │ ├── transactionRoute.ts
│ │ └── userRoutes.ts
│ ├── services
│ │ └── upload.ts
│ ├── tsconfig.json
│ ├── types
│ └── uploads
│ ├── categories
│ └── products
└── frontend
├── README.md
├── app
│ ├── (auth)
│ │ ├── login
│ │ │ └── page.tsx
│ │ └── register
│ │ └── page.tsx
│ ├── about
│ │ └── page.tsx
│ ├── cart
│ │ └── page.tsx
│ ├── checkout
│ │ └── page.tsx
│ ├── clientProvider.tsx
│ ├── collection
│ │ ├── [id]
│ │ │ └── page.tsx
│ │ └── page.tsx
│ ├── contact
│ │ └── page.tsx
│ ├── favicon.ico
│ ├── fonts
│ │ ├── GeistMonoVF.woff
│ │ └── GeistVF.woff
│ ├── globals.css
│ ├── layout.tsx
│ ├── orders
│ │ └── page.tsx
│ └── page.tsx
├── components
│ ├── Cart.tsx
│ ├── CartContext.tsx
│ ├── Footer.tsx
│ ├── Header.tsx
│ └── ui
│ ├── avatar.tsx
│ ├── button.tsx
│ ├── card.tsx
│ ├── dropdown-menu.tsx
│ ├── input.tsx
│ └── sheet.tsx
├── components.json
├── context
│ └── AuthContext.tsx
├── lib
│ ├── functions.ts
│ ├── types.ts
│ └── utils.ts
├── middleware.ts
├── next-env.d.ts
├── next.config.ts
├── package-lock.json
├── package.json
├── postcss.config.mjs
├── public
│ └── logo.png
├── redux
│ ├── slices
│ │ ├── authSlice.ts
│ │ ├── ordersApiSlice.ts
│ │ ├── productsApiSlice.ts
│ │ └── userApiSlice.ts
│ └── store.ts
├── tailwind.config.ts
├── tsconfig.json
└── types
├── orders.ts
├── products.ts
└── user.ts
61 directories, 186 files
- Clone the repository:
git clone https://github.com/IbnuJabir/Voltstore.git
- Navigate to the client directory:
cd frontend
- Install dependencies:
npm install
- Start the client application:
npm run dev
- Clone the repository:
git clone https://github.com/IbnuJabir/Voltstore.git
- Navigate to the admin directory:
cd admin
- Install dependencies:
npm install
- Start the admin application:
npm start
- Navigate to the backend directory:
cd backend
- Install dependencies:
npm install
- Create a .env file with the necessary environment variables.
- Start the server:
npm run dev
-
Browsing Products
- Explore the available products by browsing through categories or viewing all items.
- Each product includes details such as images, descriptions, price, and available stock.
-
Product Categories
- Filter products by categories to find specific types of items, making browsing easier and more personalized.
-
Shopping Cart
- Add items to the cart with a single click and adjust quantities as needed.
- View cart summary to see the total price and make final adjustments before checkout.
-
Checkout Process
- Proceed to checkout after finalizing the cart.
- Enter shipping information, select a payment method, and review the order before confirming.
-
User Registration and Login
- Create an account to save order history, track orders, and simplify future purchases.
- Registered users can log in to access saved addresses, payment options, and track ongoing orders.
-
Order Placement and Tracking
- Place orders after checkout and receive a confirmation email with order details.
- Track the status of placed orders through the "My Orders" section, showing updates from processing to delivery.
-
Contact and About Pages
- Visit the Contact page for customer support inquiries or feedback.
- Learn about the company and its values on the About page for a deeper connection with the brand.
- Accessing the Admin Panel
- Navigating the Dashboard
- Managing Products
- Handling Orders
- Customer Management
- Configuring Settings
- Analyzing Reports
- Regular Maintenance
-
Base URL
https://api-voltstore.up.railway.app/
-
Authentication To interact with the API, you need to authenticate your requests using an API key. Include your API key in the request headers:
Authorization: Bearer YOUR_API_KEY
-
Making Requests You can use various tools or programming libraries to send HTTP requests. Common methods include:
- cURL: Command-line tool for testing API calls.
- Postman: A popular GUI tool for API development.
- Programming Libraries: Such as
fetch
(JavaScript), `
requests(Python), or
http.client` (Java).
Using cURL:
curl -X GET "https://api-voltstore.up.railway.app/" -H "Authorization: Bearer YOUR_API_KEY"
-
HTTP Methods
- GET: Retrieve data.
- POST: Create new data.
- PUT: Update existing data.
- DELETE: Remove data.
-
Handling Responses
- Success Responses: Usually contain the requested data and a
200 OK
status code. - Error Responses: Provide error messages and relevant HTTP status codes (e.g.,
400 Bad Request
,404 Not Found
,500 Internal Server Error
).
- Success Responses: Usually contain the requested data and a
-
Error Handling
- 400 Bad Request: Check the request parameters.
- 401 Unauthorized: Verify your API key.
- 404 Not Found: The resource does not exist.
- 500 Internal Server Error: An issue occurred on the server side.
Base URL
https://api-voltstore.up.railway.app/
Authentication
- API Key: Required for all requests. Include in the header as:
Authorization: Bearer YOUR_API_KEY
For your e-commerce project, based on the models we defined (User, Product, Cart, Order), here’s a breakdown of the routes and controllers you’ll likely need.
The User model manages user accounts (e.g., customers and admins). You’ll need routes for authentication and user profile management.
Routes:
- POST
/api/users/register
– Register a new user - POST
/api/users/login
– Authenticate user - GET
/api/users/profile
– Get logged-in user profile - PUT
/api/users/profile
– Update user profile - DELETE
/api/users/:id
– Delete a user (admin only)
Controller Functions:
registerUser
loginUser
getUserProfile
updateUserProfile
deleteUser
The Product model will handle product data, like listings and categories.
Routes:
- GET
/api/products
– Get all products - GET
/api/products/:id
– Get a single product by ID - POST
/api/products
– Create a new product (admin only) - PUT
/api/products/:id
– Update a product (admin only) - DELETE
/api/products/:id
– Delete a product (admin only)
Controller Functions:
getAllProducts
getProductById
createProduct
updateProduct
deleteProduct
The Cart model manages the shopping cart, including adding/removing products and viewing the cart.
Routes:
- GET
/api/cart
– Get the user’s cart - POST
/api/cart
– Add an item to the cart - PUT
/api/cart
– Update item quantity in the cart - DELETE
/api/cart/:productId
– Remove an item from the cart - DELETE
/api/cart
– Clear the entire cart
Controller Functions:
getCart
addToCart
updateCartItem
removeFromCart
clearCart
The Order model tracks customer orders, including order status and history.
Routes:
- POST
/api/orders
– Place a new order - GET
/api/orders
– Get all orders (admin only) - GET
/api/orders/my
– Get orders for the logged-in user - GET
/api/orders/:id
– Get a specific order by ID - PUT
/api/orders/:id
– Update order status (admin only) - DELETE
/api/orders/:id
– Cancel an order
Controller Functions:
placeOrder
getAllOrders
getUserOrders
getOrderById
updateOrderStatus
cancelOrder
The Category model manages product categories.
Routes:
- GET
/api/category
– Get all categories - POST
/api/category
– Create a new category - GET
/api/category/:id
– Get a single category by ID - PUT
/api/category/:id
– Update a category by ID - DELETE
/api/category/:id
– Delete a category by ID - DELETE
/api/category
– Delete all categories
Controller Functions:
getAllCategories
createCategory
getCategoryById
updateCategory
deleteCategory
deleteAllCategory
The Transaction model tracks financial transactions.
Routes:
- POST
/api/transaction
– Create a new transaction (admin only) - GET
/api/transaction/total
– Get the total revenue (admin only) - GET
/api/transaction
– Get all transactions (admin only) - GET
/api/transaction/:id
– Get a single transaction by ID (admin only) - DELETE
/api/transaction/:id
– Delete a transaction (admin only)
Controller Functions:
createTransaction
getTotalRevenue
getTransactions
getTransactionById
deleteTransaction
Model | Routes | Controller Functions |
---|---|---|
User | 5 Routes | registerUser , loginUser , getUserProfile , updateUserProfile , deleteUser |
Product | 5 Routes | getAllProducts , getProductById , createProduct , updateProduct , deleteProduct |
Cart | 5 Routes | getCart , addToCart , updateCartItem , removeFromCart , clearCart |
Order | 6 Routes | placeOrder , getAllOrders , getUserOrders , getOrderById , updateOrderStatus , cancelOrder |
Category | 6 Routes | getAllCategories , createCategory , getCategoryById , updateCategory , deleteCategory , deleteAllCategory |
Transaction | 5 Routes | createTransaction , getTransactions , getTransactionById , updateTransactionStatus , deleteTransaction , getTotalRevenue |
- Authentication Middleware: You'll need middleware to protect routes (e.g., only logged-in users can access their cart, only admins can manage products).
- Validation Middleware: Use libraries like
Joi
orexpress-validator
to validate request data.
We welcome contributions to our project! Whether you’re fixing a bug, adding a feature, or improving documentation, your help is greatly appreciated. Please follow these guidelines to ensure a smooth contribution process.
-
Submitting Issues If you encounter a bug or have a feature request, please submit an issue. Here’s how:
- Check Existing Issues: Before creating a new issue, check if it has already been reported.
- Provide Detailed Information: When submitting an issue, include:
- A clear title and description.
- Steps to reproduce the bug (if applicable).
- Any error messages or logs.
- Information about your environment (e.g., OS, version).
-
Making Pull Requests To submit your contributions via a pull request (PR), follow these steps:
- Fork the Repository: Click the "Fork" button at the top right of the repository page to create your own copy.
- Clone Your Fork: Clone your forked repository to your local machine:
git clone https://github.com/IbnuJabir/Voltstore.git cd Voltstore
- Create a New Branch: Create a new branch for your feature or fix:
git checkout -b Voltstore
- Make Your Changes: Implement your changes in your local branch.
- Commit Your Changes: Commit your changes with a clear message:
git commit -m "Brief description of your changes"
- Push Your Changes: Push your changes to your fork:
git push origin Voltstore
- Submit a Pull Request: Go to the original repository and click on "Pull Requests." Click "New Pull Request" and follow the prompts to submit your PR. Include:
- A description of what you’ve done.
- Any relevant issue numbers (e.g., "Fixes #123").
-
Coding Standards To maintain code quality, please adhere to the following coding standards:
- Style Guide: Follow the project's style guide (e.g., PEP 8 for Python, Airbnb for JavaScript).
- Naming Conventions: Use descriptive names for variables, functions, and classes.
- Commenting: Write clear comments to explain complex logic or decisions.
- Testing: Include tests for new features or bug fixes. Ensure all existing tests pass.
-
Communication Feel free to reach out through issues or discussions for any questions or clarifications. We appreciate constructive feedback and ideas!
- Ibnu Jabir Kedir: GitHub / X / LinkedIn
- David Agbaniyaka: GitHub / LinkedIn
- Orion Dooms: GitHub / X / LinkedIn
- Ujiro Eruteya: GitHub / X / LinkedIn
Copyright (C) 2024 Voltstore Licensed under the GPLv3 License