8000 GitHub - caoh29/petshop
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
8000

caoh29/petshop

Repository files navigation

🐾 PetShop Ecommerce

A modern, full-stack ecommerce platform for pet supplies built with Next.js 14, Prisma, and Redux. Features include user authentication, shopping cart functionality, and secure payments via Stripe.

TypeScript Next.js Prisma Tailwind CSS Redux

✨ Features

  • πŸ›οΈ Full ecommerce functionality
  • πŸ” Authentication with NextAuth.js (including Google OAuth)
  • πŸ’³ Secure payment processing with Stripe
  • πŸ›’ Shopping cart with Redux persistence
  • πŸ“± Responsive design with Tailwind CSS
  • 🎨 Modern UI components with Radix UI
  • πŸ” Type-safe with TypeScript
  • πŸ—ƒοΈ PostgreSQL database with Prisma ORM

πŸš€ Getting Started

Prerequisites

Environment Setup

  1. Clone the repository:
git clone https://github.com/yourusername/petshop-ecommerce.git
cd petshop-ecommerce
  1. Create a .env file in the root directory:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/petshop?schema=public"

# Auth
AUTH_SECRET="your-auth-secret-key"
NEXTAUTH_URL="http://localhost:3000"

# Google OAuth
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"

# Stripe
STRIPE_SECRET_KEY="your-stripe-secret-key"
STRIPE_WEBHOOK_SECRET="your-stripe-webhook-secret"
  1. Configure the database in docker-compose.yaml:
version: '3.8'
services:
  postgres:
    image: postgres:latest
    environment:
      POSTGRES_USER: your_username
      POSTGRES_PASSWORD: your_password
      POSTGRES_DB: petshop
    ports:
      - '5432:5432'
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  postgres_data:

Installation & Setup

  1. Start the PostgreSQL database:
docker-compose up -d
  1. Install dependencies:
npm install
# or
yarn install
  1. Run Prisma migrations:
npx prisma migrate dev
  1. Seed the database (optional):
npx prisma db seed
  1. Start the development server:
npm run dev
# or
yarn dev

Visit http://localhost:3000 to see your application running! πŸŽ‰

πŸ—οΈ Project Structure

petshop/
β”œβ”€β”€ .next/                    # Next.js build output
β”œβ”€β”€ node_modules/             # Project dependencies
β”œβ”€β”€ postgresql/               # Database container data
β”œβ”€β”€ prisma/                   # Database schema and migrations
β”œβ”€β”€ public/                   # Static assets and images
β”œβ”€β”€ src/                      # Source code
β”‚   β”œβ”€β”€ app/                  # Next.js app router components and pages
β”‚   β”œβ”€β”€ hooks/                # Custom React hooks
β”‚   β”œβ”€β”€ lib/                  # Utility functions and shared logic
β”‚   β”œβ”€β”€ mocks/                # Mock data and testing utilities
β”‚   β”œβ”€β”€ store/                # Redux store configuration
β”‚   β”œβ”€β”€ types/                # TypeScript type definitions
β”‚   β”œβ”€β”€ routes.ts             # Routes in app
β”‚   β”œβ”€β”€ middleware.ts         # Next.js middleware configuration
β”‚   └── auth.ts               # Authentication configuration
β”œβ”€β”€ .env                      # Environment variables
β”œβ”€β”€ docker-compose.yaml       # Docker configuration
β”œβ”€β”€ next.config.js            # Next.js configuration
β”œβ”€β”€ package.json              # Project dependencies and scripts
β”œβ”€β”€ postcss.config.js         # PostCSS configuration
β”œβ”€β”€ README.md                 # Project documentation
β”œβ”€β”€ tailwind.config.js        # Tailwind CSS configuration
└── tsconfig.json             # TypeScript configuration

Key Directories Explained

  • .next/: Contains the built production code
  • prisma/: Houses the database schema, migrations, and seed data
  • src/: Main source code directory
    • types/: TypeScript type definitions
    • app/: Frontend pages and components using Next.js App Router
    • hooks/: Reusable React hooks
    • lib/: Shared utilities and helper functions
    • mocks/: Testing utilities and mock data
    • store/: Redux store setup, slices, and actions

πŸ”§ Technologies Used

  • Frontend

    • Next.js 14
    • React
    • Redux Toolkit
    • Tailwind CSS
    • Radix UI Components
    • React Hook Form
  • Backend

    • Next.js API Routes and Server Actions
    • Prisma ORM
    • PostgreSQL
    • Auth.js v5
    • Stripe API

πŸ› οΈ Development

Available Scripts

# Development server
npm run dev

# Build for production
npm run build

# Production server
npm start

# Lint code
npm run lint

Database Management

# Generate Prisma client
npx prisma generate

# Open Prisma Studio
npx prisma studio

# Run migrations
npx prisma migrate dev

πŸ“ License

This project is open source and free.

🀝 Contributing

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

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

πŸ’– Support

Give a ⭐️ if this project helped you!

πŸ“ž Contact

Camilo Ordonez Herrera - @92iMAHC - cronox20@gmail.com

Project Link: https://store.caoh29.dev

About

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0