books/docs/architecture/development-workflow.md
Greg fa8acef423 Epic 1, Story 1.1: Project Initialization & Repository Setup
- Initialize Git repository with main branch
- Create comprehensive .gitignore for Node.js, React, and environment files
- Set up directory structure (frontend/, backend/, docs/)
- Create detailed README.md with project overview and setup instructions
- Add .env.example with all required environment variables
- Configure Prettier for consistent code formatting

All acceptance criteria met:
 Git repository initialized with appropriate .gitignore
 Directory structure matches Technical Assumptions
 README.md created with project overview and setup docs
 .env.example file with all required environment variables
 Prettier config files added for code formatting consistency

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 15:12:30 +01:00

1.8 KiB

Development Workflow

Local Development Setup

Prerequisites

# Install Node.js 20 LTS
# Check: node --version (should be 20.x)

# Install Docker and Docker Compose
# Check: docker --version && docker-compose --version

# Install global tools
npm install -g @kayvan/markdown-tree-parser  # For doc sharding (optional)

Initial Setup

# Clone repository
git clone <repo-url>
cd books

# Install frontend dependencies
cd frontend
npm install
cd ..

# Install backend dependencies
cd backend
npm install
cd ..

# Copy environment variables
cp .env.example .env
cp frontend/.env.example frontend/.env.local
cp backend/.env.example backend/.env

# Edit .env files with your database credentials

# Start database with Docker
docker-compose up -d postgres

# Run Prisma migrations
cd backend
npx prisma migrate dev
cd ..

Development Commands

# Start all services (frontend + backend + database)
docker-compose up

# OR start services individually:

# Start database only
docker-compose up postgres

# Start frontend only (dev server with HMR)
cd frontend
npm run dev
# Runs on http://localhost:5173

# Start backend only (nodemon for auto-reload)
cd backend
npm run dev
# Runs on http://localhost:3000

# Run tests
cd frontend
npm test

cd backend
npm test

# Build for production
cd frontend
npm run build

cd backend
# No build needed (Node.js runs directly)

Environment Configuration

Required Environment Variables

# Backend (.env in backend/)
DATABASE_URL="postgresql://user:password@localhost:5432/books"
API_PORT=3000
NODE_ENV=development
OPEN_LIBRARY_API_URL=https://openlibrary.org
CORS_ORIGIN=http://localhost:5173

# Frontend (.env.local in frontend/)
VITE_API_URL=http://localhost:3000/api

# docker-compose.yml uses shared .env at root
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=books