Snap-Shop is a comprehensive e-commerce web application built with Next.js, designed to allow users to browse products, manage a cart, register, log in, authenticate, and utilize a dashboard for order and account management. It leverages modern web technologies and frameworks to provide a robust and user-friendly shopping experience.
Project Demo : e-commerce web Vd Demo
- User Authentication: Secure login, registration, and password reset functionalities.
- Product Browsing: Display and browse products with detailed information.
- Shopping Cart: Add items to cart, view cart contents, and proceed to checkout.
- Payment Processing: Integration with Stripe for secure payment processing.
- User Account Management: Profile management, settings adjustments, and two-factor authentication.
- Dashboard: Order management and analytics dashboard for administrators.
- Product Management: Product creation and management capabilities within the dashboard.
- Image Uploading: Utilizes Uploadthing for image uploads.
- Responsive Design: Implemented with Tailwind CSS for a consistent user experience across devices.
- Database Interaction: Uses Drizzle ORM for efficient database interactions.
- Email Functionality: Integration with Resend for email confirmations and password resets.
To get started with Snap-Shop, follow these installation steps:
-
Clone the Repository:
git clone <repository_url> cd snap-shop
-
Install Dependencies:
npm install
-
Set up Environment Variables:
Create a
.env.localfile in the root directory and configure the required environment variables. Key variables include:DATABASE_URL: Connection string for your PostgreSQL database (e.g., from Neon).NEXTAUTH_SECRET: A secret for NextAuth.NEXTAUTH_URL: The base URL of your application.STRIPE_SECRET_KEY: Your Stripe secret key.STRIPE_WEBHOOK_SECRET: Your Stripe webhook secret.UPLOADTHING_SECRET: Secret for UploadthingUPLOADTHING_APP_ID: App ID for UploadthingRESEND_API_KEY: Your Resend API key.
-
Database Setup:
- Run database migrations using Drizzle Kit:
npm run db:push # Or npm run db:generate if you need to generate migrations -
Run the Application:
npm run dev
This will start the development server. You can then access the application in your web browser, typically at
http://localhost:3000.
- Accessing the Homepage: Navigate to the root URL (e.g.,
http://localhost:3000) to view the homepage (app/page.tsx). - User Authentication:
- Register a new user through the registration page (
app/auth/register/page.tsx). - Log in with your credentials via the login page (
app/auth/login/page.tsx).
- Register a new user through the registration page (
- Product Detail Page: View product details by navigating to
/products/[id](e.g.,/products/123). - Dashboard Access: Log in and access the dashboard by navigating to
/dashboard. - Server Actions Example: The application likely uses server actions in
server/actions/*to handle form submissions, such as login (server/actions/login-action.ts), registration (server/actions/register-action.ts), and password resets (server/actions/reset-password.ts).
- Languages: TypeScript, JavaScript, Postgresql
- Frameworks: Next.js, React
- Styling: Tailwind CSS
- Database: Drizzle ORM, PostgreSQL (via Neon or similar)
- Authentication: NextAuth
- State Management: Zustand
- Form Handling: React Hook Form
- Payment Processing: Stripe
- File Uploads: Uploadthing
- UI Components: Radix UI, Recharts, Vaul, Sonner, Shadcn
- Other Dependencies: Zod (validation), bcrypt, date-fns, Resend, various UI component libraries.
snap-shop/
βββ app/ # Next.js application routes and components
β βββ auth/ # Authentication routes (login, register, reset password)
β βββ dashboard/ # Dashboard routes and components
β βββ products/ # Product related routes
β βββ api/ # API routes (NextAuth, Uploadthing)
β βββ layout.tsx # Main application layout
β βββ page.tsx # Homepage
βββ components/ # Reusable React components
β βββ cart/ # Cart related components
β βββ auth/ # Authentication components
β βββ navigation/ # Navigation components
β βββ setting/ # User setting components
β βββ products/ # Product display and management components
β βββ ui/ # UI components (button, input, etc.)
β βββ analytics/ # Analytics components
β βββ ...
βββ lib/ # Utility functions and helpers
βββ store/ # Zustand store for state management (e.g., cart)
βββ server/ # Server-side logic
β βββ actions/ # Server actions
β βββ migrations/ # Database migrations
β βββ schema.ts # Database schema
β βββ index.ts # Server entry point
βββ types/ # TypeScript type definitions
βββ public/ # Static assets (images, etc.)
βββ drizzle.config.ts # Drizzle configuration
βββ next.config.ts # Next.js configuration
βββ package.json # Project dependencies and scripts
βββ tsconfig.json # TypeScript configuration
βββ README.md # This README file
Contributions are welcome! Please follow these guidelines:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them with clear, concise messages.
- Test your changes thoroughly.
- Submit a pull request.
This project is licensed under the MIT License.
