|
1 | | -# Shopify - a simple eCommerce app |
| 1 | +```markdown |
| 2 | +# Shopify - DevOps Technical Assignment |
2 | 3 |
|
3 | | -Welcome to my E-commerce App! This project is a dummy e-commerce application built using React, Tailwind CSS, Vite, TypeScript, and Redux Toolkit. It aims to showcase various features commonly found in e-commerce platforms, including a homepage, product listing page, cart functionality, and user-authenticated pages like account and wishlist. |
| 4 | + |
| 5 | + |
| 6 | + |
4 | 7 |
|
5 | | -## Features |
| 8 | +This repository contains the solution for the **ABB DevOps Assignment**. The goal was to containerize a React eCommerce application and implement a secure, automated CI/CD pipeline using DevOps best practices. |
6 | 9 |
|
7 | | -- **Homepage:** Introduce users to your e-commerce platform with attractive banners, featured products, and navigation options. |
8 | | -- **Product Page:** Display a catalog of products with detailed information, including images, descriptions, and pricing. |
9 | | -- **Cart:** Allow users to add products to their cart, view cart contents, and proceed to checkout. |
10 | | -- **User Authentication:** Enable users to create accounts, log in, and access personalized features like wishlists and account settings. |
11 | | -- **Wishlist:** Allow users to save products they're interested in for future reference. |
| 10 | +## 🚀 Deployment & DevOps Architecture |
12 | 11 |
|
13 | | -## Technologies Used |
| 12 | +### Pipeline Workflow |
| 13 | +The solution implements a GitHub Actions pipeline that ensures code quality, security, and automated delivery. |
14 | 14 |
|
15 | | -- **React:** A popular JavaScript library for building user interfaces. |
16 | | -- **Tailwind CSS:** A utility-first CSS framework for building custom designs quickly. |
17 | | -- **Vite:** A modern build tool that serves your code via native ES Module imports during development for faster performance. |
18 | | -- **TypeScript:** A statically typed superset of JavaScript that enhances code quality and developer productivity. |
19 | | -- **Redux Toolkit:** A simplified state management library for managing application state efficiently. |
20 | | -- **Cypress:** A next-generation front-end testing tool designed for the modern web. |
| 15 | +```mermaid |
| 16 | +graph LR |
| 17 | + Push[Push to Main] --> CI_Start |
| 18 | + |
| 19 | + subgraph CI ["Continuous Integration (CI)"] |
| 20 | + direction TB |
| 21 | + CI_Start(Install & Lint) --> CI_Build(Build & Test) |
| 22 | + CI_Build --> Security{Trivy Scan} |
| 23 | + end |
| 24 | + |
| 25 | + subgraph CD ["Continuous Delivery (CD)"] |
| 26 | + direction TB |
| 27 | + Security -- Pass --> DeployWeb[Deploy to GH Pages] |
| 28 | + Security -- Pass --> DeployImg[Push Image to GHCR] |
| 29 | + end |
| 30 | + |
| 31 | + Security -- Fail --> Stop[Stop Pipeline] |
| 32 | + |
| 33 | + %% Estilos corregidos con texto negro forzado para alto contraste |
| 34 | + style Security fill:#ff9999,stroke:#333,stroke-width:2px,color:#000000 |
| 35 | + style CI fill:#e1f5fe,stroke:#01579b,stroke-dasharray: 5 5,color:#000000 |
| 36 | + style CD fill:#e8f5e9,stroke:#2e7d32,stroke-dasharray: 5 5,color:#000000 |
21 | 37 |
|
22 | | -## Getting Started |
| 38 | +``` |
23 | 39 |
|
24 | | -1. Clone this repository to your local machine. |
25 | | -2. Install dependencies using `npm install` or `yarn install`. |
26 | | -3. Start the development server using `npm run dev` or `yarn dev`. |
27 | | -4. Open your browser and navigate to `http://localhost:5173` to view the application. |
| 40 | +### Architecture Decisions |
28 | 41 |
|
29 | | -## Contributing |
| 42 | +| Component | Choice | Rationale & Benefits | |
| 43 | +| --- | --- | --- | |
| 44 | +| **CI/CD** | GitHub Actions | Native integration, zero-overhead setup, and immediate feedback loop. | |
| 45 | +| **Hosting** | GitHub Pages | Acts as the **Test Environment**. Perfect for SPA (Single Page Applications), cost-effective, and supports HTTPS automatically. | |
| 46 | +| **Container** | Docker Multi-stage | **Efficiency**: Separates build tools (Node) from runtime (Nginx) to minimize image size.<br> |
30 | 47 |
|
31 | | -Contributions are welcome! If you'd like to contribute to this project, please follow these steps: |
| 48 | +<br>**Security**: Runs Nginx Alpine to reduce attack surface. | |
| 49 | +| **Registry** | GHCR | Keeps artifacts close to the code. Images are versioned by commit SHA for traceability. | |
| 50 | +| **Security** | Trivy | Scans the final Docker image for OS/Library vulnerabilities (Critical severity blocks deployment). | |
32 | 51 |
|
33 | | -1. Fork the repository. |
34 | | -2. Create a new branch (`git checkout -b feature/your-feature-name`). |
35 | | -3. Make your changes and commit them (`git commit -am 'Add new feature'`). |
36 | | -4. Push to the branch (`git push origin feature/your-feature-name`). |
37 | | -5. Open a pull request. |
| 52 | +--- |
38 | 53 |
|
39 | | -## License |
| 54 | +## 🛠️ How to Run |
40 | 55 |
|
41 | | -This project is licensed under the [MIT License](LICENSE). |
| 56 | +### Prerequisites |
42 | 57 |
|
43 | | -## Acknowledgements |
| 58 | +* Docker & Docker Compose |
| 59 | +* Node.js (v20+) (Optional, for local non-docker dev) |
44 | 60 |
|
45 | | -- Since this is a frontend only project, all the data have been collected from [DummyJSON](https://dummyjson.com/). |
46 | | -- Special thanks to [Tailwind Labs](https://tailwindcss.com/) and [Redux Toolkit](https://redux-toolkit.js.org/) for their amazing tools and documentation. |
| 61 | +### Option A: Run with Docker (Recommended) |
47 | 62 |
|
48 | | -## Contact |
| 63 | +This mirrors the production environment using the optimized Nginx image. |
49 | 64 |
|
50 | | -For any inquiries or feedback, feel free to contact [me](mailto:alim1496@gmail.com). |
| 65 | +```bash |
| 66 | +# 1. Build and start the container |
| 67 | +docker compose up --build |
51 | 68 |
|
52 | | -Happy coding! 🚀 |
| 69 | +# 2. Access the application |
| 70 | +# Open http://localhost:8080 |
| 71 | + |
| 72 | +``` |
| 73 | + |
| 74 | +### Option B: Local Development |
| 75 | + |
| 76 | +To run the application using the local Node.js environment: |
| 77 | + |
| 78 | +```bash |
| 79 | +yarn install |
| 80 | +yarn dev |
| 81 | + |
| 82 | +``` |
| 83 | + |
| 84 | +--- |
| 85 | + |
| 86 | +## ✅ Verification Links |
| 87 | + |
| 88 | +Once the pipeline finishes successfully, you can verify the deployment here: |
| 89 | + |
| 90 | +* **Live Test Environment:** [https://luismlgdev.github.io/test-abb/](https://www.google.com/search?q=https://luismlgdev.github.io/test-abb/) |
| 91 | +* **Docker Registry:** `ghcr.io/luismlgdev/social-site-demo` |
| 92 | +* **Pipeline Logs:** [View Actions Tab](https://www.google.com/search?q=https://github.com/LuisMLGDev/test-abb/actions) |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +## 📦 Application Features |
| 97 | + |
| 98 | +*Based on the Simple React eCommerce application.* |
| 99 | + |
| 100 | +This project is a dummy e-commerce application built using React, Tailwind CSS, Vite, TypeScript, and Redux Toolkit. |
| 101 | + |
| 102 | +* **Homepage:** Banners, featured products, and navigation. |
| 103 | +* **Product Page:** Detailed information, images, and pricing. |
| 104 | +* **Cart:** Add products, view contents, and checkout simulation. |
| 105 | +* **User Simulation:** Login simulation for wishlist and account features. |
| 106 | +* **Testing:** End-to-End testing with **Cypress**. |
| 107 | + |
| 108 | +## 📄 License |
| 109 | + |
| 110 | +This project is part of a technical assignment. Original application code is licensed under the [MIT License](https://www.google.com/search?q=LICENSE). |
| 111 | + |
| 112 | +``` |
| 113 | + |
| 114 | +``` |
0 commit comments