NuxtEcommerce
Описание
Пробуем vibecoding. Очень любопытно, что получится
Языки
- TypeScript50,3%
- Vue39,1%
- Dockerfile4,2%
- Shell4%
- CSS2,1%
- JavaScript0,3%
Nuxt Shop - E-commerce Platform
Modern e-commerce web application built with Nuxt 4, TypeScript, and PostgreSQL.
Features
- 🛍️ Product catalog with categories and filtering
- 🛒 Shopping cart functionality
- 👤 User authentication and authorization
- 📦 Order management system
- 💳 Payment integration (ЮKassa, Сбербанк)
- 🚚 Delivery integration (СДЭК, Почта России)
- ⭐ Product reviews and ratings
- ❤️ Wishlist functionality
- 🔐 Admin panel for store management
- 📱 Responsive design
- 🎨 Modern UI with Tailwind CSS
Tech Stack
Frontend
- Nuxt 4 - Vue.js framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Pinia - State management
- Vee-Validate + Zod - Form validation
Backend
- Nitro - Server engine
- Prisma - Database ORM
- PostgreSQL - Database
- nuxt-auth-utils - Authentication
- bcrypt - Password hashing
Integrations
- ЮKassa - Payment gateway
- Sberbank - Payment gateway
- СДЭК - Delivery service
- Почта России - Delivery service
Getting Started
Prerequisites
- Node.js 18+
- PostgreSQL 14+
- npm or yarn
Installation
-
Clone the repository: ```bash git clone cd nuxt-shop ```
-
Install dependencies: ```bash npm install ```
-
Set up environment variables: ```bash cp .env.example .env ```
Edit and configure your database and API keys.
- Set up the database: ```bash
Generate Prisma client
npm run db:generate
Run migrations
npm run db:migrate
Seed the database (optional)
npm run db:seed ```
- Start the development server: ```bash npm run dev ```
The application will be available at
Project Structure
``` nuxt-shop/ ├── assets/ # Uncompiled assets (CSS, images) ├── components/ # Vue components │ ├── ui/ # Reusable UI components │ ├── product/ # Product-related components │ ├── cart/ # Cart components │ ├── checkout/ # Checkout components │ ├── layout/ # Layout components │ └── admin/ # Admin panel components ├── composables/ # Vue composables ├── layouts/ # Nuxt layouts ├── middleware/ # Route middleware ├── pages/ # File-based routing │ ├── index.vue # Homepage │ ├── products/ # Product pages │ ├── cart.vue # Shopping cart │ ├── checkout/ # Checkout flow │ ├── account/ # User account │ ├── admin/ # Admin panel │ └── auth/ # Authentication pages ├── prisma/ # Prisma schema and migrations ├── public/ # Static files ├── server/ # Nuxt server │ ├── api/ # API routes │ ├── middleware/ # Server middleware │ └── utils/ # Server utilities ├── stores/ # Pinia stores ├── types/ # TypeScript types └── utils/ # Client utilities ```
Available Scripts
- Start development servernpm run dev- Build for productionnpm run build- Preview production buildnpm run preview- Lint codenpm run lint- Type checknpm run typecheck- Generate Prisma clientnpm run db:generate- Run database migrationsnpm run db:migrate- Push schema changes to databasenpm run db:push- Seed database with sample datanpm run db:seed- Open Prisma Studionpm run db:studio
Database Schema
The application uses PostgreSQL with the following main entities:
- User - User accounts with roles (CUSTOMER, MANAGER, ADMIN)
- Product - Products with variants, pricing, and inventory
- Category - Hierarchical product categories
- Order - Customer orders with items and status tracking
- CartItem - Shopping cart items
- Review - Product reviews and ratings
- WishlistItem - User wishlist items
- Address - Shipping and billing addresses
- Payment - Payment transactions
See for the complete schema.
API Endpoints
Authentication
- User registrationPOST /api/auth/register- User loginPOST /api/auth/login- User logoutPOST /api/auth/logout- Get current userGET /api/auth/me
Products
- List productsGET /api/products- Get product detailsGET /api/products/:id- Create product (admin)POST /api/products- Update product (admin)PUT /api/products/:id- Delete product (admin)DELETE /api/products/:id
Cart
- Get user cartGET /api/cart- Add item to cartPOST /api/cart/add- Update cart itemPUT /api/cart/:id- Remove cart itemDELETE /api/cart/:id- Clear cartDELETE /api/cart/clear
Orders
- List user ordersGET /api/orders- Get order detailsGET /api/orders/:id- Create orderPOST /api/orders
See for complete API documentation.
Environment Variables
Required environment variables:
```env
Database
DATABASE_URL=postgresql://user:password@localhost:5432/nuxt_shop
Auth
AUTH_SECRET=your-secret-key-min-32-characters-long
Payment
YUKASSA_SHOP_ID=your-shop-id YUKASSA_SECRET_KEY=your-secret-key SBERBANK_USERNAME=your-username SBERBANK_PASSWORD=your-password
Delivery
CDEK_CLIENT_ID=your-client-id CDEK_CLIENT_SECRET=your-client-secret POCHTA_TOKEN=your-token
RESEND_API_KEY=your-api-key
Storage
CLOUDINARY_CLOUD_NAME=your-cloud-name CLOUDINARY_API_KEY=your-api-key CLOUDINARY_API_SECRET=your-api-secret
App
APP_URL=http://localhost:3000 ```
Deployment
Production Build
```bash npm run build ```
Deploy to Vercel
```bash vercel ```
Deploy to Other Platforms
The application can be deployed to any platform that supports Node.js:
- Netlify
- DigitalOcean
- AWS
- Heroku
- Railway
Make sure to:
- Set all environment variables
- Run database migrations: npm run db:migrate:deploy
- Build the application: npm run build
Development Workflow
- Create a new branch for your feature
- Make your changes
- Run linting and type checking
- Test your changes
- Create a pull request
Security
- Passwords are hashed using bcrypt
- Session-based authentication with HTTP-only cookies
- CSRF protection enabled
- Input validation using Zod schemas
- SQL injection prevention via Prisma ORM
- XSS protection via Vue's automatic escaping
Contributing
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
This project is licensed under the MIT License.
Support
For support, email info@nuxtshop.com or create an issue in the repository.
Roadmap
See for planned features and future enhancements.