Skip to content

HenriqueTecas/smart-reader

Repository files navigation

Split Keyboard Shop - Full-Stack E-Commerce Platform

License: MIT

A modern, full-stack e-commerce platform for selling premium ergonomic split keyboards. Built with React, Express.js, MongoDB, and Stripe integration.

Split Keyboard Shop

🎯 Project Overview

This is a production-ready e-commerce platform designed specifically for selling ergonomic split keyboards. The platform emphasizes user experience, modern design, and comprehensive functionality for both customers and administrators.

Key Features

  • πŸ›οΈ Full E-Commerce Functionality: Browse products, add to cart, and complete purchases
  • πŸ” User Authentication: Secure JWT-based authentication with bcrypt password hashing
  • πŸ’³ Payment Integration: Ready for Stripe payment processing
  • πŸ“¦ Order Management: Complete order tracking from placement to delivery
  • ⭐ Product Reviews: Customer review system with verified purchases
  • πŸ‘€ User Profiles: Manage personal information and view order history
  • 🎨 Modern UI: Beautiful, responsive design with Tailwind CSS and Framer Motion
  • πŸ“± Mobile-First: Fully responsive across all devices
  • πŸ”§ Admin Dashboard: Comprehensive tools for managing products and orders

πŸ› οΈ Tech Stack

Frontend

  • React 18 - UI library
  • Vite - Build tool and dev server
  • React Router v6 - Client-side routing
  • Tailwind CSS - Utility-first CSS framework
  • Zustand - Lightweight state management
  • React Hook Form - Form validation
  • Zod - Schema validation
  • Framer Motion - Animations
  • Axios - HTTP client
  • React Hot Toast - Notifications
  • React Icons - Icon library

Backend

  • Node.js - Runtime environment
  • Express.js - Web framework
  • MongoDB - NoSQL database
  • Mongoose - ODM for MongoDB
  • JWT - Authentication
  • bcryptjs - Password hashing
  • Stripe - Payment processing
  • Helmet - Security middleware
  • Express Rate Limit - API rate limiting
  • Morgan - HTTP request logger
  • Cors - Cross-origin resource sharing

πŸ“ Project Structure

smart-reader/
β”œβ”€β”€ client/                     # Frontend React application
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ layout/        # Header, Footer
β”‚   β”‚   β”‚   β”œβ”€β”€ product/       # ProductCard
β”‚   β”‚   β”‚   β”œβ”€β”€ cart/          # Cart components
β”‚   β”‚   β”‚   └── common/        # Reusable components
β”‚   β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Products.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ProductDetail.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Cart.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Checkout.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Register.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Profile.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ OrderHistory.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ OrderDetail.jsx
β”‚   β”‚   β”‚   └── admin/         # Admin pages
β”‚   β”‚   β”œβ”€β”€ store/             # Zustand state management
β”‚   β”‚   β”œβ”€β”€ services/          # API service layer
β”‚   β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”‚   └── App.jsx
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vite.config.js
β”‚   └── tailwind.config.js
β”‚
β”œβ”€β”€ server/                     # Backend Express application
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/       # Route controllers
β”‚   β”‚   β”œβ”€β”€ models/            # Mongoose models
β”‚   β”‚   β”œβ”€β”€ routes/            # API routes
β”‚   β”‚   β”œβ”€β”€ middleware/        # Custom middleware
β”‚   β”‚   β”œβ”€β”€ config/            # Configuration files
β”‚   β”‚   β”œβ”€β”€ utils/             # Utility functions
β”‚   β”‚   └── server.js          # Server entry point
β”‚   └── package.json
β”‚
└── README.md

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (local or MongoDB Atlas)
  • npm or yarn

Installation

  1. Clone the repository

    git clone <repository-url>
    cd smart-reader
  2. Install server dependencies

    cd server
    npm install
  3. Install client dependencies

    cd ../client
    npm install
  4. Set up environment variables

    Create a .env file in the server directory:

    PORT=5000
    NODE_ENV=development
    MONGODB_URI=mongodb://localhost:27017/split-keyboard-shop
    JWT_SECRET=your_jwt_secret_key_change_this_in_production
    JWT_EXPIRE=30d
    STRIPE_SECRET_KEY=sk_test_your_stripe_secret_key
    CLIENT_URL=http://localhost:5173

    Create a .env file in the client directory:

    VITE_API_URL=http://localhost:5000/api
    VITE_STRIPE_PUBLIC_KEY=pk_test_your_stripe_public_key
  5. Seed the database (optional)

    cd server
    npm run seed
  6. Start the development servers

    Terminal 1 (Backend):

    cd server
    npm run dev

    Terminal 2 (Frontend):

    cd client
    npm run dev
  7. Access the application

πŸ‘₯ Demo Accounts

After seeding the database, you can use these demo accounts:

Customer Account:

Admin Account:

πŸ“‹ Features Breakdown

Customer Features

  • βœ… Browse products with filtering and sorting
  • βœ… View detailed product information with images and specifications
  • βœ… Add products to cart with quantity selection
  • βœ… Complete checkout with shipping information
  • βœ… User registration and authentication
  • βœ… Profile management
  • βœ… Order history and tracking
  • βœ… Product reviews and ratings

Admin Features

  • βœ… Admin dashboard with statistics
  • βœ… Product management (CRUD operations)
  • βœ… Order management and status updates
  • βœ… View customer information
  • βœ… Sales analytics (basic)

Technical Features

  • βœ… JWT-based authentication
  • βœ… Protected routes (client and server)
  • βœ… Password hashing with bcrypt
  • βœ… Input validation (client and server)
  • βœ… Error handling and user feedback
  • βœ… Responsive design for all screen sizes
  • βœ… Loading states and spinners
  • βœ… Toast notifications
  • βœ… Cart persistence in local storage
  • βœ… Rate limiting on API endpoints
  • βœ… Security headers with Helmet
  • βœ… CORS configuration

πŸ”’ Security Features

  • JWT token authentication
  • Password hashing with bcrypt (10 rounds)
  • Protected API routes
  • Input validation on both client and server
  • Rate limiting to prevent abuse
  • Security headers with Helmet
  • CORS configuration
  • Environment variable protection

πŸ“Š Database Schema

User

  • firstName, lastName, email, password (hashed)
  • role (customer/admin)
  • addresses array
  • timestamps

Product

  • name, slug, description, price, compareAtPrice
  • images array
  • category, stock, variants
  • specifications (object)
  • features array
  • rating (average, count)
  • timestamps

Order

  • orderNumber (auto-generated)
  • user reference
  • items array with product details
  • shippingAddress (object)
  • paymentMethod, paymentResult
  • subtotal, shippingCost, tax, total
  • status (pending, processing, shipped, delivered, cancelled)
  • timestamps

Cart

  • user reference (optional)
  • sessionId (for guest users)
  • items array
  • timestamps

Review

  • product and user references
  • rating (1-5), title, comment
  • verified (boolean)
  • timestamps

🎨 Design Philosophy

  1. Clean & Modern: Minimalist design with clear visual hierarchy
  2. Product-First: Large, high-quality images and detailed information
  3. Trust Signals: Reviews, ratings, and security badges
  4. Mobile-First: Responsive design optimized for all devices
  5. Performance: Optimized images, code splitting, and fast loading

🚒 Deployment

Backend Deployment (Railway/Render)

  1. Create a new project on Railway or Render
  2. Connect your GitHub repository
  3. Set environment variables
  4. Deploy

Frontend Deployment (Vercel)

  1. Install Vercel CLI: npm i -g vercel
  2. Navigate to client directory: cd client
  3. Run: vercel
  4. Follow the prompts

Database (MongoDB Atlas)

  1. Create a free cluster on MongoDB Atlas
  2. Update MONGODB_URI in your environment variables
  3. Whitelist your deployment IP addresses

πŸ§ͺ Testing

# Run tests (when implemented)
npm test

# Run linting
npm run lint

πŸ“ˆ Future Enhancements

  • Stripe payment integration (currently demo mode)
  • Email notifications for orders
  • Advanced search with filters
  • Wishlist functionality
  • Product comparison tool
  • Blog/Resources section
  • Newsletter subscription
  • Inventory management improvements
  • Advanced analytics dashboard
  • Multi-language support
  • Product recommendations
  • Social media integration

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  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

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

πŸ‘¨β€πŸ’» Developer

Built with ❀️ for ergonomic typing enthusiasts

πŸ™ Acknowledgments

  • Product images from Unsplash
  • Icons from React Icons
  • UI inspiration from Lofree and NuPhy
  • Community feedback and support

πŸ“ž Support

For support, email support@splitkeyboard.com or open an issue in the GitHub repository.


Happy Coding! πŸš€βŒ¨οΈ

Transform the typing experience, one split keyboard at a time.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors