- ✨ Introduction
- ⚙️ Tech Stack
- 🔋 Features
- 🤸 Quick Start
- 🔗 Assets
- 🚀 More
- Thank you so much for the tutorial https://github.com/JavaScript-Mastery-Pro
-
Better Auth is a framework-agnostic authentication and authorization library for TypeScript. It provides built-in support for email and password authentication, social sign-on (Google, GitHub, Apple, and more), and multi-factor authentication, simplifying user authentication and account management.
-
Devin AI is an autonomous AI software engineer by Cognition Labs that independently plans, writes, debugs, and deploys full applications from natural language prompts. It integrates with tools like Slack, Linear, and Jira to manage tasks and pull requests, and learns new technologies on the fly by reading documentation.
-
Drizzle ORM is a lightweight and performant TypeScript ORM designed with developer experience in mind. It provides a seamless interface between application code and database operations while maintaining high performance and reliability.
-
Neon is a fully managed, serverless PostgreSQL database platform. It offers features like instant provisioning, autoscaling, and database branching, enabling developers to build scalable applications without managing infrastructure.
-
Next.js is a powerful React framework for building full-stack web applications. It simplifies development with features like server-side rendering, static site generation, and API routes, enabling developers to focus on building products and shipping quickly.
-
TailwindCSS is a utility-first CSS framework that allows developers to build custom, responsive designs quickly without leaving their HTML. It provides pre-defined classes for layout, typography, colors, and more.
-
TypeScript is a superset of JavaScript that adds static typing, providing better tooling, code quality, and error detection for developers. It is ideal for building large-scale applications and enhances the development experience.
-
Zustand is a minimal, hook-based state management library for React. It lets you manage global state with zero boilerplate, no context providers, and excellent performance through selective state subscriptions.
👉 Landing Page: A fast, engaging homepage that introduces your brand and products with smooth animations and clear calls to action.
👉 Product Listing Page: Browse all products with filters, sorting, and real-time availability—powered by Devin AI-generated content for dynamic updates.
👉 Product Details Page: Detailed product info, images, and reviews with AI-enhanced descriptions to help customers make confident buying decisions.
👉 Auth Pages: Secure and seamless user signup, login, and password recovery using Better Auth, ensuring smooth access without backend hassles.
And many more, including code architecture and reusability.
Follow these steps to set up the project locally on your machine.
Prerequisites
Make sure you have the following installed on your machine:
Cloning the Repository
git clone https://github.com/JavaScript-Mastery-Pro/e-commerce.git
cd e-commerceInstallation
Install the project dependencies using npm:
npm installSet Up Environment Variables
Create a new file named .env in the root of your project and add the following content:
# Database
DATABASE_URL="your-postgresql://username:password@host:port/database"
# Better Auth
BETTER_AUTH_SECRET="your-secret-key-here"
BETTER_AUTH_URL="http://localhost:3000"
# GitHub OAuth (optional)
GITHUB_CLIENT_ID=""
GITHUB_CLIENT_SECRET=""
# Google OAuth (optional)
GOOGLE_CLIENT_ID=""
GOOGLE_CLIENT_SECRET=""Replace the placeholder values with your credentials. You can get these by signing up at: NeonDB, Better-Auth.
Running the Project
npm run devOpen http://localhost:3000 in your browser to view the project.
src/
├── app/
│ ├── api/auth/[...all]/route.ts # Better Auth API routes
│ └── page.tsx # Homepage
├── lib/
│ ├── auth/
│ │ └── index.ts # Better Auth configuration
│ └── db/
│ ├── index.ts # Database connection
│ └── schema.ts # Database schema
└── store/
├── auth.ts # Authentication state
└── cart.ts # Shopping cart state
The application includes the following tables:
- users: User accounts and profiles
- sessions: User sessions for Better Auth
- accounts: OAuth accounts and credentials
- verifications: Email verification tokens
- products: Product catalog
- orders: Customer orders
- order_items: Individual items in orders