Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0282a21298 | ||
|
|
adf007b379 | ||
|
|
65c680da5b | ||
|
|
85a6c0d795 | ||
|
|
a119950806 | ||
|
|
2fe1062106 | ||
|
|
bf6f98d83b | ||
|
|
5ef90c3676 | ||
|
|
dce22c0ced | ||
|
|
ce95ae33b6 | ||
|
|
5e446df042 | ||
|
|
826ee83ca5 | ||
|
|
fef8a941b3 |
@@ -13,7 +13,7 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.RELEASE_TOKEN }}
|
||||
token: ${{ secrets.REGISTRY_TOKEN }}
|
||||
persist-credentials: true
|
||||
|
||||
- name: Create next tag from config/version.yaml
|
||||
|
||||
116
CLAUDE.md
116
CLAUDE.md
@@ -1,6 +1,69 @@
|
||||
# Coltura
|
||||
|
||||
CRM/ERP. Monorepo Symfony 8 (API Platform 4) + Nuxt 4.
|
||||
CRM/ERP. Monorepo Symfony 8 (API Platform 4) + Nuxt 4. **Architecture DDD (Domain-Driven Design).**
|
||||
|
||||
## Architecture DDD
|
||||
|
||||
Le projet suit une architecture DDD cote backend ET frontend. Le code est organise par **domaine metier** (Bounded Context), pas par type technique.
|
||||
|
||||
### Backend — Organisation par domaine
|
||||
|
||||
```
|
||||
src/
|
||||
Domain/ # Couche domaine (logique metier pure, aucune dependance framework)
|
||||
{BoundedContext}/ # Ex: Customer, Sales, Catalog, Invoice...
|
||||
Entity/ # Entites et Aggregates du domaine
|
||||
ValueObject/ # Value Objects (Money, Address, Email...)
|
||||
Repository/ # Interfaces des repositories (ports)
|
||||
Service/ # Services domaine (logique metier)
|
||||
Event/ # Domain Events
|
||||
Exception/ # Exceptions metier
|
||||
Application/ # Couche application (cas d'usage, orchestration)
|
||||
{BoundedContext}/
|
||||
Command/ # Commands (write) + Handlers
|
||||
Query/ # Queries (read) + Handlers
|
||||
DTO/ # Data Transfer Objects
|
||||
Infrastructure/ # Couche infrastructure (implementations techniques)
|
||||
{BoundedContext}/
|
||||
Repository/ # Implementations Doctrine des repositories
|
||||
Persistence/ # Mapping Doctrine (si XML/YAML)
|
||||
Shared/ # Services techniques partages (mail, storage, etc.)
|
||||
Api/ # Couche API (exposition HTTP)
|
||||
{BoundedContext}/
|
||||
Resource/ # ApiResource API Platform
|
||||
State/ # Providers & Processors API Platform
|
||||
```
|
||||
|
||||
**Regles DDD backend :**
|
||||
- Le domaine (`Domain/`) ne depend de RIEN (pas de Doctrine, pas de Symfony, pas d'API Platform)
|
||||
- Les repositories dans `Domain/` sont des **interfaces** ; les implementations Doctrine sont dans `Infrastructure/`
|
||||
- Les entites API Platform (`Api/Resource/`) sont decouples des entites domaine si necessaire
|
||||
- Chaque Bounded Context est autonome — pas d'import croise entre contextes (communiquer via events ou services application)
|
||||
- `User` et `Auth` restent dans `src/` (hors DDD) car c'est du framework pur (Security Bundle)
|
||||
|
||||
### Frontend — Organisation par domaine
|
||||
|
||||
```
|
||||
frontend/
|
||||
domains/ # Modules metier
|
||||
{bounded-context}/ # Ex: customer, sales, catalog, invoice...
|
||||
components/ # Composants Vue specifiques au domaine
|
||||
composables/ # Composables specifiques au domaine
|
||||
services/ # Services API du domaine
|
||||
dto/ # Types TypeScript du domaine
|
||||
pages/ # Pages du domaine (optionnel, ou dans pages/)
|
||||
stores/ # Store Pinia du domaine (si necessaire)
|
||||
components/ # Composants UI partages (non lies a un domaine)
|
||||
composables/ # Composables partages (useApi, useAppVersion)
|
||||
stores/ # Stores globaux (auth, ui)
|
||||
services/ # Services partages
|
||||
```
|
||||
|
||||
**Regles DDD frontend :**
|
||||
- Chaque domaine est un dossier autonome dans `frontend/domains/`
|
||||
- Un domaine ne doit pas importer depuis un autre domaine — utiliser les composables/stores partages
|
||||
- Les composants, services et types partages restent a la racine (`components/`, `composables/`, etc.)
|
||||
- Les pages peuvent etre dans `frontend/pages/` (routing Nuxt) et importer les composants du domaine
|
||||
|
||||
## Stack
|
||||
|
||||
@@ -12,26 +75,37 @@ CRM/ERP. Monorepo Symfony 8 (API Platform 4) + Nuxt 4.
|
||||
## Structure
|
||||
|
||||
```
|
||||
src/Entity/ # Entites Doctrine (User)
|
||||
src/ApiResource/ # Ressources API Platform decouples (AppVersion)
|
||||
src/State/ # Providers et Processors API Platform (MeProvider, AppVersionProvider, UserPasswordHasherProcessor)
|
||||
src/Service/ # Services metier
|
||||
src/Repository/ # Repositories Doctrine
|
||||
src/DataFixtures/ # Fixtures
|
||||
config/ # Config Symfony (security, api_platform, lexik_jwt, nelmio_cors, doctrine)
|
||||
config/jwt/ # Cles JWT (private.pem, public.pem)
|
||||
migrations/ # Migrations Doctrine
|
||||
infra/dev/ # Config Docker dev (Dockerfile, nginx, php.ini, xdebug)
|
||||
infra/prod/ # Config Docker prod (Dockerfile multi-stage, nginx, php-prod.ini)
|
||||
frontend/ # App Nuxt 4
|
||||
frontend/pages/ # Pages (index, login)
|
||||
frontend/layouts/ # Layouts (default)
|
||||
frontend/components/ # Composants Vue
|
||||
frontend/composables/# Composables (useApi, useAppVersion)
|
||||
frontend/stores/ # Stores Pinia (auth, ui)
|
||||
frontend/services/ # Services API (auth)
|
||||
frontend/services/dto/ # Types TypeScript
|
||||
frontend/i18n/locales/ # Fichiers de traduction
|
||||
src/
|
||||
Domain/{Context}/Entity/ # Entites domaine
|
||||
Domain/{Context}/ValueObject/ # Value Objects
|
||||
Domain/{Context}/Repository/ # Interfaces repositories
|
||||
Domain/{Context}/Service/ # Services domaine
|
||||
Domain/{Context}/Event/ # Domain Events
|
||||
Application/{Context}/Command/ # Commands + Handlers
|
||||
Application/{Context}/Query/ # Queries + Handlers
|
||||
Application/{Context}/DTO/ # Data Transfer Objects
|
||||
Infrastructure/{Context}/Repository/ # Implementations Doctrine
|
||||
Api/{Context}/Resource/ # ApiResource API Platform
|
||||
Api/{Context}/State/ # Providers & Processors
|
||||
Entity/ # Entites framework (User)
|
||||
DataFixtures/ # Fixtures
|
||||
config/ # Config Symfony
|
||||
config/jwt/ # Cles JWT
|
||||
migrations/ # Migrations Doctrine
|
||||
infra/dev/ # Docker dev
|
||||
infra/prod/ # Docker prod (multi-stage)
|
||||
frontend/
|
||||
domains/{context}/components/ # Composants du domaine
|
||||
domains/{context}/composables/ # Composables du domaine
|
||||
domains/{context}/services/ # Services API du domaine
|
||||
domains/{context}/dto/ # Types TS du domaine
|
||||
domains/{context}/stores/ # Store Pinia du domaine
|
||||
components/ # Composants UI partages
|
||||
composables/ # Composables partages (useApi, useAppVersion)
|
||||
stores/ # Stores globaux (auth, ui)
|
||||
pages/ # Pages (routing Nuxt)
|
||||
layouts/ # Layouts
|
||||
i18n/locales/ # Traductions
|
||||
```
|
||||
|
||||
## Commandes
|
||||
|
||||
99
README.md
99
README.md
@@ -1,26 +1,103 @@
|
||||
# Coltura
|
||||
|
||||
CRM/ERP - Symfony 8 + API Platform 4 + Nuxt 4
|
||||
CRM/ERP — Symfony 8 (API Platform 4) + Nuxt 4
|
||||
|
||||
## Stack
|
||||
|
||||
- **Backend** : PHP 8.4, Symfony 8, API Platform 4, Doctrine ORM, PostgreSQL 16
|
||||
- **Frontend** : Nuxt 4 (SPA), Vue 3, Pinia, Tailwind CSS, @malio/layer-ui
|
||||
- **Auth** : JWT HTTP-only cookie (Lexik)
|
||||
- **Infra** : Docker Compose (dev + prod multi-stage)
|
||||
- **CI/CD** : Gitea Actions (auto-tag + build Docker)
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
make start # Start Docker containers
|
||||
make install # Install dependencies, run migrations, build frontend
|
||||
make start # Demarrer les containers Docker
|
||||
make install # Composer, migrations, fixtures, build Nuxt
|
||||
```
|
||||
|
||||
Dev frontend: `make dev-nuxt` (hot reload on port 3003)
|
||||
Dev frontend (hot reload) :
|
||||
|
||||
```bash
|
||||
make dev-nuxt # Port 3003
|
||||
```
|
||||
|
||||
## Ports
|
||||
|
||||
| Service | Port |
|
||||
|----------|------|
|
||||
| API | 8083 |
|
||||
| Frontend | 3003 |
|
||||
| Service | Port |
|
||||
|------------|------|
|
||||
| API (Nginx)| 8083 |
|
||||
| Frontend | 3003 |
|
||||
| PostgreSQL | 5436 |
|
||||
|
||||
## Commandes
|
||||
|
||||
| Commande | Description |
|
||||
|----------|-------------|
|
||||
| `make start` | Demarrer les containers |
|
||||
| `make stop` | Arreter les containers |
|
||||
| `make restart` | Redemarrer les containers |
|
||||
| `make install` | Install complet |
|
||||
| `make reset` | Tout supprimer et reinstaller |
|
||||
| `make dev-nuxt` | Serveur dev Nuxt (hot reload) |
|
||||
| `make shell` | Shell dans le container PHP |
|
||||
| `make cache-clear` | Vider le cache Symfony |
|
||||
| `make migration-migrate` | Lancer les migrations |
|
||||
| `make fixtures` | Charger les fixtures |
|
||||
| `make db-reset` | Reset BDD + migrations + fixtures |
|
||||
| `make test` | PHPUnit |
|
||||
| `make php-cs-fixer-allow-risky` | Fix code style PHP |
|
||||
| `make logs-dev` | Tail logs Symfony |
|
||||
|
||||
## Structure
|
||||
|
||||
```
|
||||
src/ # Backend Symfony
|
||||
Entity/ # Entites Doctrine
|
||||
ApiResource/ # Ressources API Platform
|
||||
State/ # Providers & Processors
|
||||
Repository/ # Repositories Doctrine
|
||||
DataFixtures/ # Fixtures
|
||||
config/ # Config Symfony
|
||||
migrations/ # Migrations Doctrine
|
||||
frontend/ # App Nuxt 4
|
||||
pages/ # Pages Vue
|
||||
layouts/ # Layouts
|
||||
components/ # Composants
|
||||
composables/ # Composables (useApi, useAppVersion)
|
||||
stores/ # Stores Pinia (auth, ui)
|
||||
services/ # Services API + DTOs
|
||||
i18n/ # Traductions
|
||||
infra/
|
||||
dev/ # Docker dev (Dockerfile, nginx, php.ini, xdebug)
|
||||
prod/ # Docker prod (multi-stage, nginx, php-prod.ini)
|
||||
.gitea/workflows/ # CI Gitea (auto-tag, build Docker)
|
||||
```
|
||||
|
||||
## CI/CD
|
||||
|
||||
- **Auto Tag** : push sur `develop` → bump `config/version.yaml` → tag `vX.Y.Z`
|
||||
- **Build Docker** : push tag `v*` → build image multi-stage → push Gitea Registry
|
||||
|
||||
Secrets requis dans Gitea :
|
||||
- `RELEASE_TOKEN` — PAT avec droits `write:repository`
|
||||
- `REGISTRY_TOKEN` — token pour le registry Docker
|
||||
|
||||
## Credentials (dev)
|
||||
|
||||
- admin / admin (ROLE_ADMIN)
|
||||
- alice / alice (ROLE_USER)
|
||||
- bob / bob (ROLE_USER)
|
||||
| Username | Password | Role |
|
||||
|----------|----------|------|
|
||||
| admin | admin | ROLE_ADMIN |
|
||||
| alice | alice | ROLE_USER |
|
||||
| bob | bob | ROLE_USER |
|
||||
|
||||
## Conventions
|
||||
|
||||
### Commits
|
||||
|
||||
```
|
||||
<type>(<scope optionnel>) : <message>
|
||||
```
|
||||
|
||||
Types : `build`, `chore`, `ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `revert`, `style`, `test`
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
parameters:
|
||||
app.version: '0.1.0'
|
||||
app.version: '0.1.7'
|
||||
|
||||
0
frontend/domains/.gitkeep
Normal file
0
frontend/domains/.gitkeep
Normal file
@@ -74,13 +74,13 @@ RUN cd frontend && npm ci && npm run build:dist && rm -rf node_modules
|
||||
RUN chown -R www-data:www-data /var/www/html/var /var/www/html/frontend/dist
|
||||
|
||||
# PHP prod config
|
||||
COPY infra/deploy/php-prod.ini /usr/local/etc/php/php.ini
|
||||
COPY infra/prod/php-prod.ini /usr/local/etc/php/php.ini
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
# ── Nginx stage ──
|
||||
FROM nginx:1.27-alpine AS nginx
|
||||
|
||||
COPY infra/deploy/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY infra/prod/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=php-base /var/www/html/public /var/www/html/public
|
||||
COPY --from=php-base /var/www/html/frontend/dist /var/www/html/frontend/dist
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\State;
|
||||
namespace App\Api\Auth\State;
|
||||
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use ApiPlatform\State\ProviderInterface;
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\State;
|
||||
namespace App\Api\Auth\State;
|
||||
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use ApiPlatform\State\ProcessorInterface;
|
||||
use App\Entity\User;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
|
||||
/**
|
||||
@@ -15,7 +16,7 @@ use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
|
||||
class UserPasswordHasherProcessor implements ProcessorInterface
|
||||
{
|
||||
public function __construct(
|
||||
/** @var ProcessorInterface<User, User> */
|
||||
#[Autowire(service: 'api_platform.doctrine.orm.state.persist_processor')]
|
||||
private readonly ProcessorInterface $persistProcessor,
|
||||
private readonly UserPasswordHasherInterface $passwordHasher,
|
||||
) {}
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\ApiResource;
|
||||
namespace App\Api\Shared\Resource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use App\State\AppVersionProvider;
|
||||
use App\Api\Shared\State\AppVersionProvider;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [
|
||||
@@ -2,10 +2,11 @@
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\State;
|
||||
namespace App\Api\Shared\State;
|
||||
|
||||
use ApiPlatform\Metadata\Operation;
|
||||
use ApiPlatform\State\ProviderInterface;
|
||||
use App\Api\Shared\Resource\AppVersion;
|
||||
use Symfony\Component\DependencyInjection\Attribute\Autowire;
|
||||
|
||||
/**
|
||||
@@ -20,6 +21,6 @@ class AppVersionProvider implements ProviderInterface
|
||||
|
||||
public function provide(Operation $operation, array $uriVariables = [], array $context = []): object
|
||||
{
|
||||
return new \App\ApiResource\AppVersion($this->appVersion);
|
||||
return new AppVersion($this->appVersion);
|
||||
}
|
||||
}
|
||||
0
src/Application/.gitkeep
Normal file
0
src/Application/.gitkeep
Normal file
0
src/Domain/.gitkeep
Normal file
0
src/Domain/.gitkeep
Normal file
@@ -10,9 +10,9 @@ use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
use ApiPlatform\Metadata\Patch;
|
||||
use ApiPlatform\Metadata\Post;
|
||||
use App\Api\Auth\State\MeProvider;
|
||||
use App\Api\Auth\State\UserPasswordHasherProcessor;
|
||||
use App\Repository\UserRepository;
|
||||
use App\State\MeProvider;
|
||||
use App\State\UserPasswordHasherProcessor;
|
||||
use DateTimeImmutable;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
||||
|
||||
0
src/Infrastructure/Shared/.gitkeep
Normal file
0
src/Infrastructure/Shared/.gitkeep
Normal file
Reference in New Issue
Block a user