Skip to content

Sprint 0 - Setup Initial

Sprint 0 - Setup Initial

Documentation technique

Durée estimée : 1-2 jours Objectif : Préparer l’infrastructure, les outils et les processus pour permettre le développement des slices
Statut : En cours

1. Vue d’ensemble

Le Sprint 0 est une phase de préparation dédiée à la mise en place de l’infrastructure, des outils de développement et des processus de travail. Aucun code métier n’est développé pendant ce sprint.

1.1. Objectifs

  • ✅ Infrastructure Cloudflare configurée et opérationnelle
  • ✅ Projet Sanity créé et accessible
  • ✅ Repository Git initialisé avec protections
  • ✅ CI/CD configuré et testé
  • ✅ Environnements (staging, production) séparés
  • ✅ Processus de travail défini et documenté
  • ✅ Guides de setup (Day 1) créés

1.2. Livrables1/2

  • Infrastructure Cloudflare (Workers, R2, Stream, Pages)
  • Projet Sanity avec credentials
  • Repository Git avec branches et protections
  • Pipeline CI/CD fonctionnel
  • Configuration Astro initiale

1.2. Livrables2/2

  • Configuration Wrangler initiale
  • Variables d’environnement définies
  • Secrets injectés
  • Documentation opérationnelle (runbooks, playbooks)
  • Guide Day 1 pour les nouveaux développeurs

2. Infrastructure Cloudflare

2.1. Comptes et sous-domaines

Ressource Action Détails
Compte Cloudflare done Compte temporaire avec free plan
Sous-domaine Workers A Configurer apres avoir creer un worker a la creation du premier worker il pointera sur worker-name.anderson-metsanou.workers.dev ensuite on le modifiera en worker-name.amn.lasommedesrosees.com
Sous-domaine Pages A Configurer apres avoir creer un page a la creation du premier worker il pointera sur page-name.anderson-metsanou.pages.dev ensuite on le modifiera en page-name.amn.lasommedesrosees.com
R2 Buckets voir section 2.3 -
Stream done Bibliothèque vidéo créée
Turnstile done Site key et secret key (a trouver dans la plateforme)

2.2. Wrangler CLI

Terminal window
# Installation
npm install -g wrangler
# Authentification
wrangler login
# Vérification
wrangler whoami

2.3. Création des ressources (A VOIR DANS ~/PP/GettingStarted/outputs-for-wrangler-toml-config.md)1/2

NB: La separation des environnements (dev et prod) se feront dans le fichier de configuration wrangler.toml pour les automatisations. Car la plateforme Cloudflare ne permet pas de creer des environnements differents pour les ressources R2, Queue et KV.

2.3. Création des ressources (A VOIR DANS ~/PP/GettingStarted/outputs-for-wrangler-toml-config.md)2/2

Terminal window
# Buckets R2
wrangler r2 bucket create medias-r2-prod
wrangler r2 bucket create medias-r2-dev
wrangler r2 bucket create backups-r2-prod
wrangler r2 bucket create backups-r2-dev
# Queue
wrangler queues create submissions-queue-prod
wrangler queues create submissions-queue-dev
# KV namespace
wrangler kv:namespace create WEBHOOK_LOCK_PROD
wrangler kv:namespace create WEBHOOK_LOCK_DEV

3. Projet Sanity

3.1. Création du projet1/2

3.1. Création du projet2/2

Terminal window
# Installation CLI
npm install -g @sanity/cli
# Création du projet
sanity init
# Configuration
✔ You are logged in as andsinus.ai@gmail.com using Google
✔ Fetching existing projects
✔ Create a new project or select an existing one amn (4wa7mvsz)
✔ Select dataset to use development
✔ Configure Sanity MCP and agent skills for these editors? Antigravity, VS Code
✔ MCP configured for Antigravity, VS Code
✔ Sanity agent skills installed: [sanity-best-practices, sanity-migration]
Universal (~/.agents/skills)
Antigravity, GitHub Copilot
✔ Project output path: /home/anderson/PP/amn
✔ Select project template Blog (schema)
✔ Do you want to use TypeScript? Yes
✔ Bootstrapping files from template
✔ Resolving latest module versions
✔ Creating default project files
✔ Package manager to use for installing dependencies? npm
✔ Running npm install
✅ Success! Your Studio has been created.
(cd /home/anderson/PP/amn to navigate to your new project directory)
Get started by running npm run dev to launch your Studio's development server
To set up your project with the MCP server, restart Antigravity and VS Code and type "Get started with Sanity" in the chat.
Learn more: https://mcp.sanity.io

3.2. Configuration API

Variable Description Source
SANITY_PROJECT_ID ID du projet Sanity Dashboard Sanity
SANITY_DATASET Dataset (production/development) Sanity CLI
SANITY_API_READ_TOKEN Token lecture API Tokens
SANITY_API_WRITE_TOKEN Token écriture API Tokens
SANITY_PREVIEW_SECRET Secret preview Généré aléatoirement

3.3. Injection des secrets (A FAIRE VIA CI/CD OU .ENV - CES CMD NE SONT PAS ENCORE EXECUTEES)

Terminal window
# Cloudflare Workers
wrangler secret put SANITY_PROJECT_ID
wrangler secret put SANITY_DATASET
wrangler secret put SANITY_API_READ_TOKEN
wrangler secret put SANITY_PREVIEW_SECRET
# Astro (via CI/CD ou .env)
# Voir §6

4. Repository Git

Ce depot doit etre gere selon l’approche trunk-based. une seule branche (main) et 02 environnements (prod et dev).

4.1. Initialisation

Terminal window
# Création du repository
git init
git branch -m main
git add .wrangler/ docs/ amn/
git commit -m "getting started the project"
git remote add origin git@github.com:audyssee/PP.git
git push -u origin main
# Trunk-based development
# Setup trunk-based development with the single branch main and 02 envs prod and dev.

4.2. Trunk-based development

Branche Protection Règles
main ✅ PR requis, reviews, tests passants
prod/* ❌ PR requis, reviews, tests passants
dev/* ❌ PR requis, reviews, tests passants

4.3. PR Template (A VOIR DANS .github/pull_request_template.md)

## Description
[Bref description de la modification]
## Type de modification
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Slice concerné
- Slice 1 : Schéma Sanity "page"
- Slice 2 : Schéma Sanity "post"
- ...
## Checklist
- [ ] Code suit les standards du projet
- [ ] Tests unitaires ajoutés/mis à jour
- [ ] Tests d'intégration ajoutés/mis à jour
- [ ] Documentation mise à jour (fiches d'objets)
- [ ] ADR créée si nécessaire
- [ ] CI/CD passe
## Screenshots (si applicable)
[Ajouter screenshots]

5. CI/CD (REVOIR LE CODE DES PIPLINE POUR SE RASSURER QU’ILS FONCTIONNENT CORRECTEMENT AVEC LA STRATEGIE TRUNK-BASED)

5.1. Pipeline GitHub Actions (A VOIR DANS .github/workflows/)1/3

.github/workflows/ci.yml
name: CI
on:
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run test
- run: npm run lint
- run: npm run typecheck

5.1. Pipeline GitHub Actions (A VOIR DANS .github/workflows/)2/3

.github/workflows/deploy-dev.yml
name: Deploy dev
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run build
- run: npx wrangler pages deploy dist --project-name=amn-dev

5.1. Pipeline GitHub Actions (A VOIR DANS .github/workflows/)3/3

.github/workflows/deploy-prod.yml
name: Deploy prod
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm ci
- run: npm run build
- run: npx wrangler pages deploy dist --project-name=amn-prod

5.2. Secrets CI/CD

Secret Description
CLOUDFLARE_ACCOUNT_ID ID du compte Cloudflare
CLOUDFLARE_API_TOKEN Token API Cloudflare
SANITY_PROJECT_ID ID du projet Sanity
SANITY_API_READ_TOKEN Token lecture Sanity
SANITY_API_WRITE_TOKEN Token écriture Sanity

6. Configuration Astro initiale

6.1. Initialisation du projet1/2

6.1. Initialisation du projet2/2

Terminal window
# Création du projet
npm create astro@latest
# Configuration
# astro Launch sequence initiated.
# dir Where should we create your new project?
# ./amn-astro
# tmpl How would you like to start your new project?
# Use blog template
# deps Install dependencies?
# Yes
# git Initialize a new git repository?
# No
# ◼ Sounds good! You can always run git init manually.
# ▲ error Error: Process exited with code 1
# ▲ error Dependencies failed to install, please run npm install to install them manually after setup.
# ✔ Project initialized!
# ■ Template copied
# ■ Dependencies installed
# next Liftoff confirmed. Explore your project!
# Enter your project directory using cd ./amn-astro
# Run npm run dev to start the dev server. q + ENTER to stop.
# Add frameworks like react or tailwind using astro add.
# Stuck? Join us at https://astro.build/chat
# Installation des dependances
npm install @astrojs/cloudflare @sanity/astro @astrojs/react @astrojs/starlight tailwindcss
npm install @sanity/image-url
npm install -D sanity

6.2. Configuration astro.config.mjs (CONF INITIALE - NON MODIFIEE)1/2

6.2. Configuration astro.config.mjs (CONF INITIALE - NON MODIFIEE)2/2

// @ts-check
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import { defineConfig, fontProviders } from 'astro/config';
// https://astro.build/config
export default defineConfig({
site: 'https://example.com',
integrations: [mdx(), sitemap()],
fonts: [
{
provider: fontProviders.local(),
name: 'Atkinson',
cssVariable: '--font-atkinson',
fallbacks: ['sans-serif'],
options: {
variants: [
{
src: ['./src/assets/fonts/atkinson-regular.woff'],
weight: 400,
style: 'normal',
display: 'swap',
},
{
src: ['./src/assets/fonts/atkinson-bold.woff'],
weight: 700,
style: 'normal',
display: 'swap',
},
],
},
},
],
});

6.3. Variables d’environnement (OU CREER CE FICHIER ET COMMENT LE NOMMER?)

.env.example
SANITY_PROJECT_ID=your-project-id
SANITY_DATASET=production
SANITY_API_READ_TOKEN=your-read-token
SANITY_API_WRITE_TOKEN=your-write-token
SANITY_PREVIEW_SECRET=your-preview-secret
CLOUDFLARE_ACCOUNT_ID=your-account-id

7. Configuration Wrangler initiale

7.1. Configuration wrangler.toml (OU CREER CE FICHIER?)

name = "amn"
main = "src/entrypoint"
compatibility_date = "2026-09-01"
[env.prod]
vars = { ENVIRONMENT = "prod" }
[env.dev]
vars = { ENVIRONMENT = "dev" }

7.2. Injection des secrets (VIA CI/CD OU .ENV - CES CMD NE SONT PAS ENCORE EXECUTEES.)

Terminal window
# Prod
wrangler secret put SANITY_PROJECT_ID
wrangler secret put SANITY_DATASET
wrangler secret put SANITY_API_READ_TOKEN
wrangler secret put SANITY_PREVIEW_SECRET
# dev
wrangler secret put SANITY_PROJECT_ID
wrangler secret put SANITY_DATASET
wrangler secret put SANITY_API_READ_TOKEN
wrangler secret put SANITY_PREVIEW_SECRET
Switch to normal mode

Contents