Skip to content

Commit 9115b75

Browse files
committed
refacto Core to Shared and metadata
1 parent 42e7d4b commit 9115b75

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+224
-227
lines changed

.cursor/rules/back.mdc

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
description: backend development rules
3+
globs: app/*, *.php, *.yaml, *.yml
4+
alwaysApply: false
5+
---
6+
You are an expert in Symfony and modern web development technologies.
7+
8+
# **General Coding Principles**
9+
- Follow **SOLID principles** for maintainable and scalable code.
10+
- Use **strict typing**: `declare(strict_types=1);`
11+
- Apply **PSR-12 coding standards** consistently.
12+
- Prefer **composition over inheritance**.
13+
- Use **meaningful variable and method names**.
14+
- Document complex logic with PHPDoc and inline comments.
15+
- Use **PHP 8.3+** as the minimum required version.
16+
17+
# **Symfony Architecture**
18+
## **Architecture & Design**
19+
- Follow **Symfony's directory structure and conventions**.
20+
- Use **services and dependency injection** instead of static calls.
21+
- Implement **event listeners, subscribers, and middleware** when needed.
22+
- **No business logic in controllers** - Controllers should only:
23+
- Validate input
24+
- Call appropriate services
25+
- Return responses
26+
- Business logic belongs in dedicated services
27+
28+
## **Database & Doctrine**
29+
- Use **Doctrine ORM with optimized queries**.
30+
- **Write migrations** with `doctrine:migrations:diff`.
31+
- Ensure proper **indexing and database normalization**.
32+
- Implement **DTOs (Data Transfer Objects)** for data transfers.
33+
34+
## **Security & Authentication**
35+
- Implement **JWT authentication with refresh tokens** using LexikJWTAuthenticationBundle.
36+
- Use **role-based access control (RBAC)**.
37+
- Protect endpoints using **Voters and Security policies**.
38+
- Prevent **CSRF attacks** and ensure **input validation**.
39+
40+
## **RESTful API Best Practices**
41+
- Define **custom DTOs** for serialization instead of exposing entities.
42+
- Implement **pagination, filtering, and sorting** properly.
43+
- Document APIs using **OpenAPI specs**.
44+
- Optimize API calls using **HTTP caching and ETags**.
45+
- Handle errors with **custom exceptions and problem details format**.
46+
47+
# **Testing & Quality Assurance**
48+
## **Backend (Symfony 7, PHPUnit)**
49+
- Write **unit tests for services and repositories**.
50+
- Implement **integration tests for API endpoints**.
51+
- Use **fixtures and test databases** for reproducible tests.
52+
- Automate testing with **CI/CD pipelines**.
53+
54+
# **Performance Optimization**
55+
- Implement **Redis caching** for database queries and API responses.
56+
- Optimize **background jobs** using Symfony Messenger.
57+
- Use **database indexing and query profiling**.
58+
59+
# **Error Handling**
60+
- Define **domain exceptions** in Domain layer
61+
- Transform to **API responses** in Infrastructure
62+
- Implement **proper logging**
63+
64+
# **Deployment & DevOps**
65+
- Use **Docker and Docker Compose** for local development.
66+
- Implement **CI/CD** with GitHub Actions.
67+
- Monitor logs and performance with **Sentry**.
68+
- Enforce **environment variable management** using `.env` files securely.
69+
- Follow **Git Flow** branching model.
70+
71+
This rule set ensures best practices, maintainability, and high-performance web applications using Symfony technologies.

.cursor/rules/front.mdc

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
description: frontend development rules
3+
globs: assets/*
4+
---
5+
You are an expert in React frontend development, and modern web development technologies.
6+
7+
# **Frontend Development**
8+
## **React Stack (Mantine UI, TanStack Query, Orval, Zustand)**
9+
- Use **TypeScript** with strict mode enabled.
10+
- Fetch data using **TanStack Query** for automatic caching.
11+
- Generate API clients with **Orval from OpenAPI specs**.
12+
- Manage global state with **Zustand** as a lightweight alternative to Redux.
13+
- Ensure **responsive UI** with Mantine and Tailwind CSS.
14+
- Follow **component-driven development** and modularize UI.
15+
- Explore **React Server Components and Suspense** for performance optimization.
16+
- Implement PWA support when relevant.
17+
18+
# **Testing & Quality Assurance**
19+
## **Frontend (Jest/Vitest, Cypress)**
20+
- Unit test components with **Jest/Vitest**.
21+
- Implement **end-to-end (E2E) tests** with Cypress.
22+
- Mock API calls to prevent flaky tests.
23+
24+
# **Performance Optimization**
25+
- Implement **lazy loading and code splitting** in frontend.
26+
27+
This rule set ensures best practices, maintainability, and high-performance web applications using modern frontend technologies.

app/src/Budget/Controller/CreateBudgetController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use App\Budget\Dto\Payload\BudgetPayload;
88
use App\Budget\Service\BudgetService;
9-
use App\Core\Api\AbstractApiController;
9+
use App\Shared\Api\AbstractApiController;
1010
use Symfony\Component\HttpFoundation\JsonResponse;
1111
use Symfony\Component\HttpFoundation\Request;
1212
use Symfony\Component\HttpFoundation\Response;

app/src/Budget/Controller/DeleteBudgetController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use App\Budget\Entity\Budget;
88
use App\Budget\Service\BudgetService;
9-
use App\Core\Api\AbstractApiController;
9+
use App\Shared\Api\AbstractApiController;
1010
use Symfony\Component\HttpFoundation\JsonResponse;
1111
use Symfony\Component\HttpFoundation\Request;
1212
use Symfony\Component\Routing\Attribute\Route;

app/src/Budget/Controller/DuplicateBudgetController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace App\Budget\Controller;
66

77
use App\Budget\Service\BudgetService;
8-
use App\Core\Api\AbstractApiController;
8+
use App\Shared\Api\AbstractApiController;
99
use Symfony\Component\HttpFoundation\JsonResponse;
1010
use Symfony\Component\HttpFoundation\Request;
1111
use Symfony\Component\HttpFoundation\Response;

app/src/Budget/Controller/GetBudgetController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace App\Budget\Controller;
66

77
use App\Budget\Service\BudgetService;
8-
use App\Core\Api\AbstractApiController;
8+
use App\Shared\Api\AbstractApiController;
99
use Symfony\Component\HttpFoundation\JsonResponse;
1010
use Symfony\Component\HttpFoundation\Request;
1111
use Symfony\Component\Routing\Attribute\Route;

app/src/Budget/Controller/ListBudgetController.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
use App\Budget\Dto\Http\BudgetFilterQuery;
88
use App\Budget\Service\BudgetService;
9-
use App\Core\Api\AbstractApiController;
10-
use App\Core\Dto\PaginationQueryParams;
9+
use App\Shared\Api\AbstractApiController;
10+
use App\Shared\Dto\PaginationQueryParams;
1111
use Symfony\Component\HttpFoundation\JsonResponse;
1212
use Symfony\Component\HttpFoundation\Request;
1313
use Symfony\Component\HttpKernel\Attribute\MapQueryString;

app/src/Budget/Controller/UpdateBudgetController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use App\Budget\Dto\Payload\BudgetPayload;
88
use App\Budget\Entity\Budget;
99
use App\Budget\Service\BudgetService;
10-
use App\Core\Api\AbstractApiController;
10+
use App\Shared\Api\AbstractApiController;
1111
use Symfony\Component\HttpFoundation\JsonResponse;
1212
use Symfony\Component\HttpFoundation\Request;
1313
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;

app/src/Budget/Dto/Http/BudgetFilterQuery.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace App\Budget\Dto\Http;
66

7-
use App\Core\Contract\ORMFilterInterface;
7+
use App\Shared\Contract\ORMFilterInterface;
88
use Doctrine\Common\Collections\Criteria;
99

1010
class BudgetFilterQuery implements ORMFilterInterface

app/src/Budget/Repository/BudgetRepository.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace App\Budget\Repository;
66

77
use App\Budget\Entity\Budget;
8-
use App\Core\Repository\AbstractEntityRepository;
8+
use App\Shared\Repository\Abstract\AbstractEntityRepository;
99
use Symfony\Component\Security\Core\User\UserInterface;
1010

1111
/**

app/src/Budget/Repository/ExpenseRepository.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace App\Budget\Repository;
66

77
use App\Budget\Entity\Expense;
8-
use App\Core\Repository\AbstractEntityRepository;
8+
use App\Shared\Repository\Abstract\AbstractEntityRepository;
99

1010
/**
1111
* @extends AbstractEntityRepository<Expense>

app/src/Budget/Repository/IncomeRepository.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace App\Budget\Repository;
66

77
use App\Budget\Entity\Income;
8-
use App\Core\Repository\AbstractEntityRepository;
8+
use App\Shared\Repository\Abstract\AbstractEntityRepository;
99

1010
/**
1111
* @extends AbstractEntityRepository<Income>

app/src/Budget/Service/BudgetService.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
use App\Budget\Entity\Budget;
1313
use App\Budget\Repository\BudgetRepository;
1414
use App\Budget\Security\Voter\BudgetVoter;
15-
use App\Core\Dto\PaginatedResponseDto;
16-
use App\Core\Dto\PaginationMetaDto;
17-
use App\Core\Dto\PaginationQueryParams;
15+
use App\Shared\Dto\PaginatedResponseDto;
16+
use App\Shared\Dto\PaginationMetaDto;
17+
use App\Shared\Dto\PaginationQueryParams;
1818
use App\Shared\Entity\User;
1919
use App\Shared\Enum\ErrorMessagesEnum;
2020
use Carbon\Carbon;

app/src/Core/Api/AbstractApiController.php

-64
This file was deleted.

app/src/Core/Serialization/ApiSerializationGroups.php

-13
This file was deleted.

app/src/Core/Serialization/Model/PaginatedListMetadata.php

-103
This file was deleted.

0 commit comments

Comments
 (0)