This repository contains the source code for the Lumina E-Commerce application, a simple e-commerce project built with Node.js and Express.
frontend/: Contains the Express.js application serving the frontend.e2e/: Contains end-to-end (E2E) tests written using Playwright..github/workflows/: Contains the continuous integration (CI) and continuous deployment (CD) pipeline configurations for GitHub Actions.Dockerfile: A Dockerfile to containerize the application.
- Navigate to the
frontend/directory:cd frontend - Install the dependencies:
npm install
- Start the application:
PORT=3001 npm start
The project uses Playwright for E2E testing.
- Navigate to the
e2e/directory:cd e2e - Install the dependencies:
npm install
- Run the tests:
npm test
You can also build and run the application using Docker:
- Build the Docker image from the root directory:
docker build -t simple-ecommerce . - Run the Docker container:
docker run -p 3001:3001 simple-ecommerce
This project is equipped with GitHub Actions workflows for both CI and CD:
- CI Pipeline (
ci-pipeline.yml): Triggers on pull requests to themainorstagingbranches. It checks out the code, sets up Node.js, installs dependencies, and runs the configured tests. - CD Pipeline (
cd-pipeline.yml): Triggers on pushes to thestagingbranch or when published. It runs the automated tests, builds the Docker image, and explicitly pushes the latest image container to Docker Hub securely relying on GitHub Secrets.
This project uses Prometheus and Grafana for comprehensive system monitoring, orchestrated via Docker Compose.
- Boot up the containers:
docker-compose up --build
- Access the services:
- Frontend: http://localhost:3001
- Prometheus (Metrics collector): http://localhost:9090
- Grafana (Visualization dashboard): http://localhost:3000 (Login:
admin/admin)
- Log into Grafana and go to Connections > Data Sources.
- Click Add data source and select Prometheus.
- In the URL field, enter
http://prometheus:9090, then click Save & test. - Go to Dashboards > Import (from the left menu).
- Type
11159into the "Import via grafana.com" field and click Load. - Select your Prometheus data source at the bottom and click Import to start visualizing your Node.js performance metrics!