Snapify Tailwind Templates

Snapify

Snapify - Full Stack E-Commerce Website with Next.js , Tailwind, Firebase, Stripe, Resend & Algolia

Snapify - Full Stack E-Commerce Website

This is a Full Stack E-Commerce Website built with Next.js 15, Tailwind CSS, Firebase, Stripe, Rsend, and Algolia.

Demo Video

Click the image below to watch the demo video:

Watch the video

Features

  • User authentication with Firebase
  • Product browsing and searching with Algolia
  • Shopping cart functionality
  • Secure payment processing with Stripe
  • Admin panel for managing products, orders, and users

Technologies Used

  • Frontend: Next.js 15, Tailwind CSS
  • Backend: Firebase (Firestore, Authentication)
  • Payment: Stripe
  • Search: Algolia
  • Contact Us: Resend

Installation

  1. Clone the repository:

    git clone <repository-url>
    
  2. Navigate to the project directory:

    cd <project-directory>
    
  3. Install the dependencies:

    npm install
    
  4. Create a .env.local file in the root directory and add the following:

    NEXT_PUBLIC_FIREBASE_API_KEY=""
    NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=""
    NEXT_PUBLIC_FIREBASE_PROJECT_ID=""
    NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=""
    NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=""
    NEXT_PUBLIC_FIREBASE_APP_ID=""
    NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=""
    
    NEXT_PUBLIC_DOMAIN=""
    
    NEXT_PUBLIC_RESEND_API_KEY=""
    
    NEXT_PUBLIC_ALGOLIA_APP_ID=""
    NEXT_PUBLIC_ALGOLIA_APP_KEY=""
    
    NEXT_PUBLIC_FIREBASE_SERVICE_ACCOUNT_KEYS='{}'
    
  5. Start the development server:

    npm run dev
    

Firestore Security Rules

service cloud.firestore {
  match /databases/{database}/documents {
    
    function isAdmin() {
      return exists(/databases/$(database)/documents/admins/$(request.auth.token.email));
    }

    match /{document=**}/reviews/{reviewId} {
      allow read: if isAdmin();
    }

    match /admins/{id} {
      allow read: if true;
      allow write: if isAdmin();
    }

    match /brands/{id} {
      allow read: if true;
      allow write: if isAdmin();
    }

    match /categories/{id} {
      allow read: if true;
      allow write: if isAdmin();
    }

    match /collections/{id} {
      allow read: if true;
      allow write: if isAdmin();
    }

    match /orders/{id} {
      allow read: if isAdmin() || request.auth.uid == resource.data.uid;
      allow write: if isAdmin();
    }

    match /products/{id} {
      allow read: if true;
      allow write: if isAdmin();

      match /reviews/{uid} {
        allow read: if true;
        allow write: if isAdmin() || request.auth.uid == uid;
      }
    }

    match /users/{uid} {
      allow read: if isAdmin() || request.auth.uid == uid;
      allow write: if isAdmin() || request.auth.uid == uid;

      match /checkout_sessions/{id} {
        allow read: if isAdmin() || request.auth.uid == uid;
        allow write: if isAdmin() || request.auth.uid == uid;
      }

      match /checkout_sessions_cod/{id} {
        allow read: if isAdmin() || request.auth.uid == uid;
        allow write: if isAdmin() || request.auth.uid == uid;
      }

      match /payments/{id} {
        allow read, write: if false;
      }
    }
  }
}

Firestore Storage Security Rules

rules_version = '2';
service firebase.storage {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow read: if true;
      allow write: if request.auth.uid != null && firestore.exists(/databases/(default)/documents/admins/$(request.auth.token.email));
    }
  }
}

Demo

You can explore the demo of the e-commerce website at this link.

To access the Admin Panel, Contact Us.

Repository Structure

Snapify/
│
šŸ“¦ app/
ā”œā”€ā”€ layout.js                           # Main app layout (Next.js App Router)
ā”œā”€ā”€ (auth)/                             # Auth Module (Login, Signup, Reset Password)
│   ā”œā”€ā”€ layout.jsx
│   ā”œā”€ā”€ login/page.jsx
│   ā”œā”€ā”€ sign-up/page.jsx
│   └── forget-password/page.jsx
ā”œā”€ā”€ (checkout)/                         # Checkout Flow (Stripe & Firestore)
│   ā”œā”€ā”€ checkout-cod/page.jsx
│   ā”œā”€ā”€ checkout-failed/page.jsx
│   ā”œā”€ā”€ checkout-success/page.jsx
│   └── checkout-success/components/SuccessMessage.jsx
ā”œā”€ā”€ (pages)/                            # Product Browsing & Search (Algolia)
│   ā”œā”€ā”€ search/page.jsx
│   ā”œā”€ā”€ search/components/SearchBox.jsx
│   ā”œā”€ā”€ brands/[brandId]/page.jsx
│   ā”œā”€ā”€ categories/[categoryId]/page.jsx
│   ā”œā”€ā”€ collections/[collectionId]/page.jsx
│   └── products/[productId]/page.jsx
ā”œā”€ā”€ (user)/                             # User Area (Account, Cart, Favorites)
│   ā”œā”€ā”€ layout.jsx
│   ā”œā”€ā”€ account/page.jsx
│   ā”œā”€ā”€ cart/page.jsx
│   ā”œā”€ā”€ favorites/page.jsx
│   └── checkout/
│       ā”œā”€ā”€ layout.jsx
│       ā”œā”€ā”€ page.jsx
│       └── components/Checkout.jsx
ā”œā”€ā”€ admin/                              # Admin Management Panel
│   ā”œā”€ā”€ layout.jsx
│   ā”œā”€ā”€ page.jsx
│   ā”œā”€ā”€ customers/, products/, orders/, brands/, categories/, collections/, reviews/, admins/
│   │   ā”œā”€ā”€ page.jsx
│   │   ā”œā”€ā”€ form/page.jsx (if applicable)
│   │   ā”œā”€ā”€ components/
│   │   │   ā”œā”€ā”€ ListView.jsx
│   │   │   └── Form.jsx / ChangeStatus.jsx
│   └── components/
│       ā”œā”€ā”€ AdminLayout.jsx
│       ā”œā”€ā”€ Header.jsx
│       ā”œā”€ā”€ Sidebar.jsx
│       ā”œā”€ā”€ CountMeter.jsx
│       ā”œā”€ā”€ OrdersChart.jsx
│       └── RevenueChart.jsx
ā”œā”€ā”€ about-us/page.jsx                   # Static & Info Pages
ā”œā”€ā”€ contact-us/page.jsx
ā”œā”€ā”€ faq/page.jsx
└── privacy/page.jsx

šŸ“¦ app/api/
└── contact/route.js                    # Edge API - Contact Form

šŸ“¦ components/
└── ui/                                 # Design System UI Components
    ā”œā”€ā”€ badge.jsx
    ā”œā”€ā”€ button.jsx
    ā”œā”€ā”€ card.jsx
    └── skeleton.jsx
└── AddToCartButton.jsx, Header.jsx, Footer.jsx, etc.

šŸ“¦ contexts/
└── AuthContext.jsx                     # Global Auth Context Provider

šŸ“¦ lib/
ā”œā”€ā”€ firebase.jsx                        # Firebase Client SDK
ā”œā”€ā”€ firebase_admin.jsx                  # Firebase Admin SDK
ā”œā”€ā”€ utils.js                            # Common Utility Functions
└── firestore/                          # Firestore Access Layer (BaaS)
    ā”œā”€ā”€ user/, products/, orders/, checkout/
    └── brands/, categories/, collections/, reviews/, admins/

šŸ“„ next.config.mjs                      # Next.js Configuration
šŸ“„ tailwind.config.mjs                  # Tailwind CSS Config
šŸ“„ jsconfig.json                        # Path Aliases

Conclusion

This project provides a robust e-commerce solution leveraging modern technologies. Feel free to customize and extend its functionality as needed.

Top categories

Loading Svelte Themes