Welcome to the Velvet Bloom project! This guide will help you set up the project on your local environment for development. Follow the steps below to get started.
Velvet Bloom is a monolithic e-commerce platform for a clothing store, featuring:
- A backend powered by Spring Boot and Java 21
- A frontend built with React and served by Nginx
- MongoDB for the database
- All components are containerized with Docker for consistency across environments.
Please ensure the following tools are installed on your machine:
- Docker: Download Docker
- Git: Download Git
- Node.js (for local frontend development): Version 18.x Download Node.js
The repository structure is as follows:
velvet-bloom/
├── backend/ # Spring Boot backend
│ ├── src/ # Source files
│ ├── target/ # Compiled JAR files (after build)
│ ├── Dockerfile # Dockerfile for backend
│ └── pom.xml # Maven dependencies for backend
├── frontend/ # React frontend
│ ├── public/ # Public assets
│ ├── src/ # Source files (components, pages)
│ ├── Dockerfile # Dockerfile for frontend
│ └── package.json # NPM dependencies for frontend
├── docker-compose.yml # Docker Compose file for multi-container setup
└── README.md # Project documentation
---
Follow these steps to get your local environment up and running.
git clone https://github.com/kasunjayasanka/velvet-bloom.git
cd velvet-bloom
To configure environment variables, copy the example files provided and rename them:
-
For frontend:
cp frontend/.env.example frontend/.env.local
Update
frontend/.env.local
to set the backend URL or any other frontend-specific environment variables. -
For backend:
cp backend/src/main/resources/application.example.properties backend/src/main/resources/application.properties
Edit
application.properties
to set up the MongoDB URI, JWT secrets, and any other backend configurations.
To run the project locally with Docker, use Docker Compose to build and start the containers.
-
Build and Start Services:
docker-compose up --build
This will start the following services:
- Backend: Accessible at http://localhost:8080
- Frontend: Accessible at http://localhost:3000
- MongoDB: Runs in the background on port
27017
-
Stop Services:
To stop the services, press
Ctrl+C
or run:docker-compose down
If you prefer running frontend and backend independently outside of Docker for development, follow these steps:
-
Navigate to the backend directory:
cd backend
-
Build the Application (Optional if not using Docker):
./mvnw clean package
-
Run the Application:
java -jar target/velvetbloom-0.0.1-SNAPSHOT.jar
The backend will run on http://localhost:8080.
-
Navigate to the frontend directory:
cd frontend
-
Install dependencies:
npm install
-
Run the Application:
npm start
The frontend will run on http://localhost:3000.
Follow these Git practices to ensure smooth collaboration:
-
Create a New Branch: Always work on a feature branch for new development.
git checkout -b yourname/your-feature-name
-
Commit Changes: Use descriptive commit messages.
git commit -m "Add feature XYZ"
-
Push Branch to Remote:
git push origin yourname/your-feature-name
-
Create a Pull Request: Open a pull request on GitHub for code review and merge.
- Database Connection Issues: Ensure MongoDB is running and accessible on port
27017
. - Port Conflicts: If another service is using port
3000
or8080
, stop that service or change the port indocker-compose.yml
. - Docker Build Errors: Run
docker-compose down --rmi all
to remove images and trydocker-compose up --build
again.
We welcome contributions! Please follow our CONTRIBUTING.md guidelines for submitting issues, pull requests, and feedback.
This project is licensed under the MIT License.
This Markdown file provides all the necessary information to help developers set up and collaborate on the project efficiently.