mirror of
https://github.com/bitbaum/datacat.git
synced 2026-12-03 23:08:01 +01:00
- docs/business/README.md was a pasted chat transcript holding four docs at once (an old index, the business case, the full use cases and a stale copy of the architecture doc). Keep only the business case; restore the full use cases into use-cases.md (it held only the first 13 lines). - Point related-doc links at docs that exist; fix the blog.ts path and the backend migrate command (pnpm -C backend run migrate). - Live site: remove the FAQ nav link (/about/faq) and the footer's Privacy, Terms and Contact links — all four answered 404 and no such pages exist. Claude-Session: https://claude.ai/code/session_01PJkbo18cRNXtgPWZN2S9cD Co-authored-by: Claude <noreply@anthropic.com>
5.4 KiB
5.4 KiB
Development Environment Setup
created_date: 2025-07-28 last_modified_date: 2026-09-04 last_modified_summary: "Synced with the actual repo: pnpm, Node 20+, backend port 5001, Vitest/Playwright testing status."
Prerequisites
Required Software
| Tool | Version | Purpose |
|---|---|---|
| Node.js | 20+ (.nvmrc pins 24) |
Runtime for frontend and backend |
| pnpm | 11+ (see packageManager in package.json) |
Package manager |
| Git | Latest | Version control |
| Docker | Latest | Database and containerization (recommended) |
| PostgreSQL | 14+ | Database (if not using Docker) |
Optional Tools
- VS Code: Recommended editor with extensions:
- ESLint
- Prettier
- Tailwind CSS IntelliSense
- TypeScript and JavaScript Language Features
- Postman: API testing
- pgAdmin: Database administration
Installation Steps
1. Clone Repository
git clone <repository-url>
cd datacat
2. Install Dependencies
# Root dependencies (concurrently for dev servers)
pnpm install
# Frontend dependencies
cd frontend
pnpm install
cd ..
# Backend dependencies
cd backend
pnpm install
cd ..
3. Database Setup
Prisma migrations (backend/prisma/migrations/) are the single source of truth for
the schema — there is no standalone SQL script to load.
Option A: Docker Compose (Recommended)
# Start PostgreSQL, Redis, backend, frontend
pnpm run docker:dev
# In a separate terminal, once postgres is healthy: apply Prisma migrations
pnpm run docker:migrate
Option B: Local PostgreSQL
- Install PostgreSQL locally
- Create database and user:
CREATE DATABASE formbuilder; CREATE USER formbuilder WITH PASSWORD 'devpassword'; GRANT ALL PRIVILEGES ON DATABASE formbuilder TO formbuilder; - Apply the schema:
pnpm -C backend run migrate(runsprisma migrate dev)
4. Environment Configuration
Backend Environment
Create backend/.env:
# Database
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=formbuilder
DB_USER=formbuilder
DB_PASSWORD=devpassword
# Authentication
JWT_SECRET=your-super-secret-jwt-key-change-in-production
# Server
PORT=5001
NODE_ENV=development
Frontend Environment
Create frontend/.env.local:
# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:5001
# Branding (using default)
NEXT_PUBLIC_BRAND_PRESET=generic
5. Verify Setup
# Start both servers
pnpm run d
# Check endpoints
curl http://localhost:5001 # Backend API
curl http://localhost:3000 # Should load the Next.js app
Development Workflow
Starting Development
# Start both frontend and backend
pnpm run d
# Or start individually
pnpm run dev # Both servers with concurrently
cd frontend && pnpm run dev # Frontend only
cd backend && pnpm run start # Backend only
Available Scripts
From root directory:
| Command | Description |
|---|---|
pnpm run d |
Start both dev servers (shortcut) |
pnpm run dev |
Start both dev servers |
pnpm run build |
Build frontend for production |
pnpm run lint |
Lint frontend code |
pnpm run verify |
Full gate: format check + lint + typecheck + unit tests + build |
Ports
| Service | Port | URL |
|---|---|---|
| Frontend | 3000 | http://localhost:3000 |
| Backend | 5001 | http://localhost:5001 |
| Database | 5432 | localhost:5432 |
Common Issues
Frontend Won't Start
Issue: Cannot find module 'next-contentlayer'
Solution: Run pnpm install in frontend directory
Database Connection Failed
Issue: Backend can't connect to PostgreSQL Solutions:
- Ensure PostgreSQL is running
- Check
.envcredentials - Verify database exists
- For Docker:
docker psto check container status
Port Already in Use
Issue: EADDRINUSE: address already in use
Solutions:
- Kill existing processes:
lsof -ti:3000 | xargs kill(replace 3000 with port) - Use different ports in configuration
ESLint Warnings
Issue: Many warnings during development Current Status: Warnings are set to non-blocking for development Solution: Address gradually as per coding standards
IDE Configuration
VS Code Settings
Create .vscode/settings.json:
{
"typescript.preferences.importModuleSpecifier": "relative",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"tailwindCSS.includeLanguages": {
"typescript": "javascript",
"typescriptreact": "javascript"
}
}
VS Code Extensions
Install recommended extensions:
{
"recommendations": [
"bradlc.vscode-tailwindcss",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"ms-vscode.vscode-typescript-next"
]
}
Testing Setup
- Unit tests: Vitest (
pnpm testfrom the repo root; coversfrontend/src/**/*.test.tsandbackend/**/*.test.js) - E2E: Playwright (
pnpm run test:e2e; needs both servers plus a database running — not part of CI yet)
Next Steps
- Explore the Codebase: Start with
frontend/src/app/page.tsx - Read Architecture: System Architecture
- Check the Rearchitecture Plan: Rearchitecture Plan
- Try Rebranding:
./scripts/dev/rebrand.sh medical
Having issues? Check the troubleshooting section or create an issue with your specific problem.