feat: add prisma
This commit is contained in:
@@ -16,32 +16,33 @@ Draft
|
||||
2. Docker Compose configuration with app service and PostgreSQL 16
|
||||
3. Prisma configured and connected to PostgreSQL
|
||||
4. shadcn/ui installed with base components (Button, Input, Card, Table)
|
||||
5. ESLint + Prettier configured with recommended rules
|
||||
6. GitLab CI pipeline: build, lint, test stages
|
||||
5. Biome configured for linting and formatting
|
||||
6. Gitea Actions workflow: build, lint, test stages
|
||||
7. Dockerfile multi-stage pour production build
|
||||
8. README avec instructions de setup local
|
||||
9. Application démarre et affiche une page d'accueil "Dofus Manager"
|
||||
10. Health check endpoint `/api/health` pour Docker healthcheck
|
||||
|
||||
## Tasks / Subtasks
|
||||
|
||||
- [ ] Task 1: Initialize TanStack Start project (AC: 1)
|
||||
- [x] Task 1: Initialize TanStack Start project (AC: 1)
|
||||
- [x] Create new TanStack Start project with `pnpm create @tanstack/start`
|
||||
- [ ] Configure `tsconfig.json` with strict mode enabled
|
||||
- [ ] Configure path aliases (`@/` pointing to `src/`)
|
||||
- [ ] Verify TypeScript strict compilation works
|
||||
- [x] Configure `tsconfig.json` with strict mode enabled
|
||||
- [x] Configure path aliases (`@/` pointing to `src/`)
|
||||
- [x] Verify TypeScript strict compilation works
|
||||
|
||||
- [ ] Task 2: Setup Docker environment (AC: 2, 7)
|
||||
- [ ] Create `docker/` directory
|
||||
- [ ] Create `docker/Dockerfile` with multi-stage build (builder + runner)
|
||||
- [ ] Create `docker/docker-compose.yml` with app and postgres services
|
||||
- [ ] Create `docker/docker-compose.dev.yml` for local development (postgres only)
|
||||
- [ ] Configure PostgreSQL 16-alpine with healthcheck
|
||||
- [ ] Test database connectivity
|
||||
- [x] Task 2: Setup Docker environment (AC: 2, 7)
|
||||
- [x] Create `docker/` directory
|
||||
- [x] Create `docker/Dockerfile` with multi-stage build (builder + runner)
|
||||
- [x] Create `docker/docker-compose.yml` with app and postgres services
|
||||
- [x] Create `docker/docker-compose.dev.yml` for local development (postgres only)
|
||||
- [x] Configure PostgreSQL 16-alpine with healthcheck
|
||||
- [x] Test database connectivity
|
||||
|
||||
- [ ] Task 3: Configure Prisma ORM (AC: 3)
|
||||
- [ ] Install Prisma dependencies (`prisma`, `@prisma/client`)
|
||||
- [ ] Initialize Prisma with `pnpm prisma init`
|
||||
- [ ] Configure `prisma/schema.prisma` with PostgreSQL provider
|
||||
- [x] Install Prisma dependencies (`prisma`, `@prisma/client`)
|
||||
- [x] Initialize Prisma with `pnpm prisma init`
|
||||
- [x] Configure `prisma/schema.prisma` with PostgreSQL provider
|
||||
- [ ] Create `src/lib/server/db.ts` for Prisma client singleton
|
||||
- [ ] Create `.env.example` with DATABASE_URL template
|
||||
- [ ] Verify Prisma connects to database
|
||||
@@ -60,12 +61,12 @@ Draft
|
||||
- [ ] Add lint and format scripts to `package.json`
|
||||
- [ ] Verify linting works on project files
|
||||
|
||||
- [ ] Task 6: Setup GitLab CI/CD pipeline (AC: 6)
|
||||
- [ ] Create `.gitlab-ci.yml` with stages: test, build, deploy
|
||||
- [ ] Configure test stage: lint, typecheck, test
|
||||
- [ ] Configure build stage: Docker image build and push
|
||||
- [ ] Configure deploy stages (staging/production) with manual triggers
|
||||
- [ ] Add caching for node_modules
|
||||
- [ ] Task 6: Setup Gitea Actions workflow (AC: 6)
|
||||
- [ ] Create `.gitea/workflows/ci.yml`
|
||||
- [ ] Configure test job: lint, typecheck, test
|
||||
- [ ] Configure build job: Docker image build and push
|
||||
- [ ] Configure deploy jobs (staging/production) with manual triggers
|
||||
- [ ] Add caching for pnpm store
|
||||
|
||||
- [ ] Task 7: Create README documentation (AC: 8)
|
||||
- [ ] Document project overview
|
||||
@@ -81,7 +82,13 @@ Draft
|
||||
- [ ] Create `src/styles/globals.css` with Tailwind imports
|
||||
- [ ] Verify application starts and renders correctly
|
||||
|
||||
- [ ] Task 9: Final verification
|
||||
- [ ] Task 9: Create health check endpoint (AC: 10)
|
||||
- [ ] Create `src/routes/api/health.ts` server function
|
||||
- [ ] Return JSON `{ status: "ok", timestamp: Date }`
|
||||
- [ ] Optionally check database connectivity
|
||||
- [ ] Verify endpoint responds at `GET /api/health`
|
||||
|
||||
- [ ] Task 10: Final verification
|
||||
- [ ] Run `pnpm dev` and verify app starts
|
||||
- [ ] Run `pnpm lint` and verify no errors
|
||||
- [ ] Run `pnpm typecheck` and verify no errors
|
||||
@@ -118,7 +125,7 @@ Draft
|
||||
|
||||
- Docker
|
||||
- Docker Compose
|
||||
- GitLab CI
|
||||
- Gitea Actions
|
||||
|
||||
**Dev Tools:**
|
||||
|
||||
@@ -131,9 +138,13 @@ Draft
|
||||
|
||||
```
|
||||
dofus-manager/
|
||||
├── .gitea/
|
||||
│ └── workflows/
|
||||
│ └── ci.yml
|
||||
├── docker/
|
||||
│ ├── Dockerfile
|
||||
│ └── docker-compose.yml
|
||||
│ ├── docker-compose.yml
|
||||
│ └── docker-compose.dev.yml
|
||||
├── prisma/
|
||||
│ ├── schema.prisma
|
||||
│ └── migrations/
|
||||
@@ -156,7 +167,9 @@ dofus-manager/
|
||||
│ │ └── logger.ts
|
||||
│ ├── routes/
|
||||
│ │ ├── __root.tsx
|
||||
│ │ └── index.tsx
|
||||
│ │ ├── index.tsx
|
||||
│ │ └── api/
|
||||
│ │ └── health.ts
|
||||
│ ├── styles/
|
||||
│ │ └── globals.css
|
||||
│ └── app.tsx
|
||||
@@ -187,22 +200,66 @@ dofus-manager/
|
||||
- PostgreSQL 16-alpine with healthcheck
|
||||
- Traefik labels for reverse proxy (production)
|
||||
|
||||
### GitLab CI/CD [Source: architecture/14-deployment-architecture.md#gitlab-cicd-pipeline]
|
||||
### Gitea Actions [Adapted from architecture]
|
||||
|
||||
**Stages:** test, build, deploy
|
||||
**Workflow file:** `.gitea/workflows/ci.yml`
|
||||
|
||||
**Test stage:**
|
||||
**Jobs:** test, build, deploy
|
||||
|
||||
- image: node:20-alpine
|
||||
- Commands: pnpm lint, pnpm typecheck, pnpm test
|
||||
- Cache node_modules
|
||||
**Test job:**
|
||||
|
||||
**Build stage:**
|
||||
- runs-on: ubuntu-latest
|
||||
- Steps: checkout, setup pnpm, setup node, install, lint, typecheck, test
|
||||
- Cache pnpm store
|
||||
|
||||
- image: docker:24
|
||||
- Build and push Docker image to registry
|
||||
**Build job:**
|
||||
|
||||
- needs: test
|
||||
- Build and push Docker image
|
||||
- Only on main/develop branches
|
||||
|
||||
**Exemple de workflow:**
|
||||
|
||||
```yaml
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: pnpm/action-setup@v2
|
||||
with:
|
||||
version: 9
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
cache: "pnpm"
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm lint
|
||||
- run: pnpm typecheck
|
||||
- run: pnpm test
|
||||
|
||||
build:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: docker/setup-buildx-action@v3
|
||||
- uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
push: true
|
||||
tags: registry.example.com/dofus-manager:${{ github.sha }}
|
||||
```
|
||||
|
||||
### Environment Variables [Source: architecture/13-development-workflow.md#environment-variables]
|
||||
|
||||
```bash
|
||||
@@ -234,9 +291,45 @@ SESSION_SECRET="your-secret-key-min-32-chars"
|
||||
- Types/Interfaces: PascalCase
|
||||
- Constants: SCREAMING_SNAKE_CASE
|
||||
|
||||
### Important Discrepancy Note
|
||||
### Health Check Endpoint [Source: architecture/19-monitoring-observability.md]
|
||||
|
||||
AC #5 specifies "ESLint + Prettier" but the architecture documents (3-technology-stack.md) specify **Biome** for linting and formatting. Recommend following the architecture document and using Biome instead, as it's the project standard.
|
||||
**Endpoint:** `GET /api/health`
|
||||
|
||||
**Response:**
|
||||
|
||||
```json
|
||||
{
|
||||
"status": "ok",
|
||||
"timestamp": "2026-01-19T10:00:00.000Z",
|
||||
"database": "connected"
|
||||
}
|
||||
```
|
||||
|
||||
**Implementation avec TanStack Start:**
|
||||
|
||||
```typescript
|
||||
// src/routes/api/health.ts
|
||||
import { createAPIFileRoute } from "@tanstack/start/api";
|
||||
import { prisma } from "@/lib/server/db";
|
||||
|
||||
export const Route = createAPIFileRoute("/api/health")({
|
||||
GET: async () => {
|
||||
let dbStatus = "disconnected";
|
||||
try {
|
||||
await prisma.$queryRaw`SELECT 1`;
|
||||
dbStatus = "connected";
|
||||
} catch {
|
||||
dbStatus = "error";
|
||||
}
|
||||
|
||||
return Response.json({
|
||||
status: "ok",
|
||||
timestamp: new Date().toISOString(),
|
||||
database: dbStatus,
|
||||
});
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
## Testing
|
||||
|
||||
@@ -264,9 +357,10 @@ AC #5 specifies "ESLint + Prettier" but the architecture documents (3-technology
|
||||
|
||||
## Change Log
|
||||
|
||||
| Date | Version | Description | Author |
|
||||
| ---------- | ------- | ---------------------- | -------- |
|
||||
| 2026-01-19 | 1.0 | Initial story creation | SM Agent |
|
||||
| Date | Version | Description | Author |
|
||||
| ---------- | ------- | --------------------------------------------- | -------- |
|
||||
| 2026-01-19 | 1.0 | Initial story creation | SM Agent |
|
||||
| 2026-01-19 | 1.1 | Gitea Actions, Biome, Health endpoint ajoutés | SM Agent |
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user