rohandeb2/Easy-shop-E-commerce
GitHub: rohandeb2/Easy-shop-E-commerce
一个基于 Next.js 的生产级全栈电商平台,集成了完整的 DevSecOps 流水线以演示从开发到 Kubernetes 部署的端到端自动化流程。
Stars: 2 | Forks: 0
# 🛍️ EasyShop — 现代电商平台
[](https://nextjs.org/)
[](https://www.typescriptlang.org/)
[](https://www.mongodb.com/)
[](https://redux.js.org/)
[](https://www.docker.com/)
[](https://kubernetes.io/)
[](LICENSE)
一个生产级、全栈电商平台,在 AWS EKS 上具备完整的 CI/CD pipeline。

## ✨ 功能
| 功能 | 详情 |
|---|---|
| 🎨 响应式 UI | 暗/亮模式,基于 Tailwind CSS 的移动优先设计 |
| 🔐 认证 | 安全的 JWT + NextAuth 会话管理 |
| 🛒 购物车 | 通过 Redux Toolkit 实现实时购物车状态 |
| 🔍 搜索 | 高级产品搜索和分类过滤 |
| 💳 结账 | 多步骤结账流程 |
| 👤 个人资料 | 用户账户及订单历史记录 |
| 📦 分类 | 电子产品、杂货、服装、家具、美妆等 |
## 🏗️ 架构
EasyShop 采用经典的三层架构,完全容器化并部署在 Kubernetes 上。
```
┌─────────────────────────────────────────────┐
│ Presentation Tier │
│ Next.js Components · Redux · Tailwind CSS │
└───────────────────┬─────────────────────────┘
│ HTTP
┌───────────────────▼─────────────────────────┐
│ Application Tier │
│ Next.js API Routes · Auth · Business Logic │
└───────────────────┬─────────────────────────┘
│ Mongoose ODM
┌───────────────────▼─────────────────────────┐
│ Data Tier │
│ MongoDB · CRUD · Validation │
└─────────────────────────────────────────────┘
```
## 🚀 技术栈
### 应用程序
[](https://nextjs.org/)
[](https://react.dev/)
[](https://www.typescriptlang.org/)
[](https://www.mongodb.com/)
[](https://redux.js.org/)
[](https://tailwindcss.com/)
### 基础设施与 CI/CD
[](https://aws.amazon.com/)
[](https://www.terraform.io/)
[](https://www.docker.com/)
[](https://kubernetes.io/)
[](https://www.jenkins.io/)
[](https://argoproj.github.io/cd/)
[](https://aquasecurity.github.io/trivy/)
## 📦 项目结构
```
easyshop/
├── src/
│ ├── app/ # Next.js App Router pages & layouts
│ ├── components/ # Reusable React components
│ └── lib/
│ ├── auth/ # NextAuth + JWT logic
│ ├── db/ # Mongoose connection
│ └── features/ # Redux slices
├── kubernetes/ # K8s manifests (namespace → ingress)
├── terraform/ # IaC for VPC, EKS, EC2 (Jenkins)
├── scripts/ # DB migration (ts-node + Docker)
├── Dockerfile # Multi-stage production build
├── docker-compose.yml # Local dev stack
└── Jenkinsfile # CI pipeline (Shared Library)
```
## ⚡ 快速开始(本地 — Docker Compose)
```
# 克隆
git clone https://github.com/rohandeb2/Easy-shop-E-commerce.git
cd Easy-shop-E-commerce
# 创建 .env.local
cp .env .env.local
# 编辑 NEXTAUTH_SECRET 和 JWT_SECRET:
openssl rand -base64 32 # → NEXTAUTH_SECRET
openssl rand -hex 32 # → JWT_SECRET
# 运行
docker compose up -d
# 打开
open http://localhost:3000
```
## 🔧 故障排除
**MongoDB 无法访问**
```
docker ps
docker logs easyshop-mongodb
docker network inspect easyshop-network
```
**构建错误 / 异常行为**
```
rm -rf .next
npm install
docker compose down -v && docker compose up -d
```
## 🤝 贡献
1. Fork 该仓库
2. 创建分支:`git checkout -b feature/my-feature`
3. 提交:`git commit -m 'feat: add my feature'`
4. 推送:`git push origin feature/my-feature`
5. 发起 Pull Request
标签:亚马逊云科技, 子域名突变, 电子商务, 自动化攻击, 请求拦截