This is the backend application for our Dumps Selling Site. The backend is built using .NET Core and follows the principles of Clean Architecture.
- Getting Started
- Run Locally
- Run Using Docker
- Project Structure
- Branching Strategy
- Development Workflow
- Testing
- Code Quality
- Contributing
- License
To get started with the project, follow these steps:
- Clone the repository:
git clone git@github.com:shayar/Dumps-BE.git cd Dumps-BE
-
Install PostgreSQL
- If you haven't already, install PostgreSQL on your machine. You can find installation instructions on the PostgreSQL official website.
-
Add user in PostgreSQL
CREATE ROLE dumps_user WITH LOGIN PASSWORD 'dumps_pass' CREATEDB;
-
Install dependencies:
dotnet restore
-
Run the development server:
dotnet run
This will start the development server on http://localhost:5072.
-
Install Docker
- If you haven't already, install Docker on your machine. You can find installation instructions on the Docker official website.
-
Run docker
docker-compose up --build
This will start the development server on http://localhost:8080.
The project is structured according to the principles of Clean Architecture, ensuring a clear separation of concerns and maintainability.
backend/
│
├── src/
│ ├── Core/ # Domain layer: Entities, Interfaces, Specifications
│ ├── Application/ # Application layer: Use Cases, DTOs, Services
│ ├── Infrastructure/ # Infrastructure layer: Data access, External services
│ ├── Presentation/ # Presentation layer: Controllers, View Models, API
│ └── Tests/ # Test projects for each layer
│
├── .env # Environment variables
├── .gitignore # Git ignore rules
├── README.md # Project documentation
└── Backend.sln # Solution file
- Core: The domain layer containing business entities, interfaces, and domain logic.
- Application: The application layer implementing use cases, DTOs, and application services.
- Infrastructure: The infrastructure layer handling data persistence, external APIs, and other I/O concerns.
- Presentation: The presentation layer, mainly the API controllers, handling HTTP requests and responses.
We follow a structured branching strategy to ensure smooth development and deployment processes:
-
Main Branch (
main):- This is the master branch and should always contain the production-ready code.
-
Release Branch (
release):- This branch is used for the preparation of production releases. It contains stable code ready for production deployment.
-
Sprint Branches (
sprint-x):- A sprint branch is created from the
releasebranch for each sprint. All feature branches are created from the respective sprint branch.
- A sprint branch is created from the
-
Feature Branches:
- Feature branches are created from the current sprint branch. The name of the branch should correspond to the JIRA task ID (e.g.,
ID-10).
- Feature branches are created from the current sprint branch. The name of the branch should correspond to the JIRA task ID (e.g.,
-
Pull the
releasebranch:git checkout release git pull origin release
-
Create a new sprint branch from
release:git checkout -b sprint-x
-
Create a feature branch from the sprint branch:
git checkout -b ID-10
(Replace
ID-10with your actual JIRA task ID.) -
Work on your feature, commit changes, and push the branch:
git add . git commit -m "ID-10: Implemented feature XYZ" git push origin ID-10
-
Before pushing your final changes, pull the latest changes from the sprint branch:
git checkout sprint-x git pull origin sprint-x git checkout ID-10 git merge sprint-x
-
Push your feature branch and create a merge request into the sprint branch:
git push origin ID-10
-
Sprint Closure:
- After all features are merged into the sprint branch, create a pull request from the sprint branch to the
releasebranch and merge it. - Deploy the code from the
releasebranch to production.
- After all features are merged into the sprint branch, create a pull request from the sprint branch to the
-
Post-Release:
- Once the code is verified in production, create a pull request from the
releasebranch to themainbranch and merge it.
- Once the code is verified in production, create a pull request from the
-
Feature Development:
- Start a new branch for each feature or bugfix using the JIRA task ID as the branch name.
-
Commit Messages:
- Follow the format:
ID-XX: Your commit message, whereID-XXis the JIRA task ID.
- Follow the format:
-
Pull Requests:
- Open a pull request against the sprint branch when your feature is complete.
- Make sure all tests pass before requesting a review.
-
Code Reviews:
- All pull requests require at least one approval before merging.
-
Merge Requests:
- Merge your feature branch into the sprint branch once it has been reviewed and approved.
- Merge the sprint branch into
releaseafter the sprint is completed.
To start the project in development mode:
dotnet runTo build the project for production:
dotnet build -c ReleaseTo run the tests:
dotnet testEnsure that all tests pass before submitting a pull request.
-
Static Analysis:
- We use tools like SonarQube or ReSharper to enforce code quality standards. Run the analysis using:
dotnet sonarscanner begin /k:"project-key" dotnet build dotnet sonarscanner end
- We use tools like SonarQube or ReSharper to enforce code quality standards. Run the analysis using:
-
Formatting:
- Code formatting is enforced using a .NET code formatter. Format your code with:
dotnet format
- Code formatting is enforced using a .NET code formatter. Format your code with:
Please follow the contributing guidelines for details on our code of conduct, and the process for submitting pull requests.
This project is licensed under the MIT License. See the LICENSE file for details.
This README file outlines the key aspects of the backend project, including the branching strategy, workflow, and instructions for running and contributing to the project, while adhering to Clean Architecture principles. It serves as a guide for developers to maintain consistency and quality throughout the development process.