ujusum:3-codage:1-repository:2-prisma-schema
Ceci est une ancienne révision du document !
Table des matières
Gestion Git complète du projet
Objectif
Mettre en place un dépôt Git professionnel prêt pour :
- Développement multi-développeurs
- CI/CD
- Revue de code
- Releases
- Hotfixes
- Déploiements automatiques
À la fin de cette procédure :
Git local GitHub Branches Protection CI Versioning Templates Hooks Documentation
seront opérationnels.
Étape 1 — Initialisation locale
Création du dépôt
mkdir rental-platform cd rental-platform git init
Vérification
git status
Résultat :
On branch main No commits yet
Étape 2 — Configuration Git globale
Vérifier
git config --global user.name git config --global user.email
Configurer
git config --global user.name "Votre Nom" git config --global user.email "email@domaine.com"
Configuration utile
git config --global init.defaultBranch main git config --global pull.rebase false git config --global core.autocrlf input
Étape 3 — Création du dépôt GitHub
Créer :
rental-platform
Options :
Private README .gitignore = Node License = MIT (ou propriétaire)
Ajouter le remote
git remote add origin git@github.com:organisation/rental-platform.git
Vérifier
git remote -v
Étape 4 — Génération de la clé SSH
Vérifier
ls ~/.ssh
Générer
ssh-keygen -t ed25519 \ -C "email@domaine.com"
Afficher
cat ~/.ssh/id_ed25519.pub
Ajouter dans GitHub
Settings SSH Keys New SSH Key
Tester
ssh -T git@github.com
Étape 5 — Création du .gitignore
Racine
.gitignore
Contenu
node_modules/ dist/ .next/ coverage/ .env .env.* *.log .prisma/client .idea/ .vscode/ .DS_Store tmp/ .cache/
Étape 6 — README principal
Créer
README.md
Contenu minimal
# Rental Platform Property Management System ## Installation docker compose up ## Documentation /swagger ## Architecture NestJS NextJS Prisma PostgreSQL Redis
Étape 7 — Premier commit
git add . git commit -m "chore: initial repository setup"
Push
git push -u origin main
Étape 8 — Protection de branche
GitHub
Settings Branches Add Rule
Branche
main
Activer
Require Pull Request Require Status Checks Require Review Dismiss Stale Reviews Prevent Force Push
Étape 9 — Stratégie Git
Branches permanentes
main develop
Création
git checkout -b develop git push -u origin develop
Branches temporaires
feature/auth-module feature/user-module feature/property-module bugfix/login hotfix/security
Étape 10 — Convention de commits
Format
type(scope): description
Types
feat fix refactor perf docs test chore build ci
Exemples
feat(auth): add login endpoint feat(users): add profile page fix(jwt): refresh token validation docs(api): update swagger
Étape 11 — Commitlint
Installation
npm install -D \ @commitlint/cli \ @commitlint/config-conventional
commitlint.config.js
module.exports = { extends: [ '@commitlint/config-conventional' ] }
Étape 12 — Husky
Installation
npm install -D husky
Initialisation
npx husky init
Hook pre-commit
.husky/pre-commit
npm run lint
npm run test
Hook commit-msg
.husky/commit-msg
npx commitlint --edit $1
Étape 13 — Pull Request Template
Créer
.github/pull_request_template.md
Contenu
## Description ## Changes ## Screenshots ## Tests ## Checklist - [ ] Tests OK - [ ] Swagger OK - [ ] Migration OK
Étape 14 — Issue Templates
Créer
.github/ISSUE_TEMPLATE
Bug
bug_report.yml
Feature
feature_request.yml
Étape 15 — GitHub Labels
Créer :
bug feature enhancement documentation security performance infra backend frontend api database
Étape 16 — GitHub Projects
Colonnes
Backlog Ready In Progress Review Testing Done
Étape 17 — GitHub Actions
Créer
.github/workflows/ci.yml
Pipeline minimal
name: CI on: pull_request: push: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 - run: npm install - run: npm run lint - run: npm run test - run: npm run build
Étape 18 — Gestion des secrets
GitHub
Settings Secrets Actions
Ajouter
DATABASE_URL JWT_SECRET REDIS_URL MINIO_ACCESS_KEY MINIO_SECRET_KEY
Étape 19 — Gestion des releases
Convention
v1.0.0 v1.1.0 v1.2.0 v2.0.0
Créer
git tag v1.0.0 git push origin v1.0.0
Étape 20 — CODEOWNERS
Créer
.github/CODEOWNERS
Exemple
* @techlead apps/api/* @backend-team apps/web/* @frontend-team prisma/* @backend-team
Étape 21 — Documentation du dépôt
Créer
docs/ docs/architecture docs/api docs/database docs/deployment
Vérification finale
Le dépôt est considéré opérationnel lorsque :
✓ Git initialisé ✓ GitHub connecté ✓ SSH fonctionnel ✓ Branch protection active ✓ Workflows CI actifs ✓ Pull Requests obligatoires ✓ Husky actif ✓ Commitlint actif ✓ Templates actifs ✓ Releases configurées ✓ CODEOWNERS actif ✓ Documentation présente
Niveau Enterprise recommandé
Pour ce projet SaaS Enterprise, ajouter également :
✓ Dependabot ✓ CodeQL ✓ Secret Scanning ✓ Container Scanning ✓ SBOM ✓ SAST ✓ DAST ✓ Security Policy ✓ CHANGELOG automatique
Ces éléments seront nécessaires à partir des Sprints 12 à 20 pour maintenir un niveau de qualité et de sécurité compatible avec une exploitation professionnelle à grande échelle.
ujusum/3-codage/1-repository/2-prisma-schema.1780800251.txt.gz · Dernière modification : 2026/06/07 04:44 de 91.170.108.99 · Actuellement bloqué par : 192.168.0.100,216.73.216.72