refactor: flatten monorepo structure to backend/ frontend/ devops/

Rename subdirectories for a cleaner single-repo layout:
- website-monitoring-backend/  → backend/
- website-monitoring-frontend/ → frontend/
- website-monitoring-devops/   → devops/

Update all references in package.json scripts, CI workflows,
docker-compose, pre-commit hooks, and documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Dennis
2026-03-07 00:25:29 +01:00
parent 4607af8def
commit 50e25e3ee8
253 changed files with 54 additions and 51 deletions
+5 -5
View File
@@ -4,16 +4,16 @@ on:
push: push:
branches: [main, develop] branches: [main, develop]
paths: paths:
- "website-monitoring-backend/**" - "backend/**"
- ".github/workflows/backend.yml" - ".github/workflows/backend.yml"
pull_request: pull_request:
branches: [main] branches: [main]
paths: paths:
- "website-monitoring-backend/**" - "backend/**"
defaults: defaults:
run: run:
working-directory: website-monitoring-backend working-directory: backend
jobs: jobs:
lint-test-build: lint-test-build:
@@ -31,7 +31,7 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: npm cache: npm
cache-dependency-path: website-monitoring-backend/package-lock.json cache-dependency-path: backend/package-lock.json
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
@@ -52,5 +52,5 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: backend-coverage name: backend-coverage
path: website-monitoring-backend/coverage/ path: backend/coverage/
retention-days: 7 retention-days: 7
+4 -4
View File
@@ -15,17 +15,17 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Build all services - name: Build all services
run: docker compose -f website-monitoring-devops/docker-compose.yml build run: docker compose -f devops/docker-compose.yml build
- name: Start services - name: Start services
run: | run: |
docker compose -f website-monitoring-devops/docker-compose.yml up -d db backend docker compose -f devops/docker-compose.yml up -d db backend
sleep 15 sleep 15
- name: Verify backend health - name: Verify backend health
run: | run: |
docker compose -f website-monitoring-devops/docker-compose.yml exec -T backend curl -f http://localhost:5000/health || exit 1 docker compose -f devops/docker-compose.yml exec -T backend curl -f http://localhost:5000/health || exit 1
- name: Cleanup - name: Cleanup
if: always() if: always()
run: docker compose -f website-monitoring-devops/docker-compose.yml down -v run: docker compose -f devops/docker-compose.yml down -v
+4 -4
View File
@@ -4,16 +4,16 @@ on:
push: push:
branches: [main, develop] branches: [main, develop]
paths: paths:
- "website-monitoring-frontend/**" - "frontend/**"
- ".github/workflows/frontend.yml" - ".github/workflows/frontend.yml"
pull_request: pull_request:
branches: [main] branches: [main]
paths: paths:
- "website-monitoring-frontend/**" - "frontend/**"
defaults: defaults:
run: run:
working-directory: website-monitoring-frontend working-directory: frontend
jobs: jobs:
lint-test-build: lint-test-build:
@@ -31,7 +31,7 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: npm cache: npm
cache-dependency-path: website-monitoring-frontend/package-lock.json cache-dependency-path: frontend/package-lock.json
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
+4 -4
View File
@@ -1,16 +1,16 @@
#!/bin/sh #!/bin/sh
# Check if backend files changed # Check if backend files changed
if git diff --cached --name-only | grep -q "^website-monitoring-backend/"; then if git diff --cached --name-only | grep -q "^backend/"; then
echo "🔍 Linting backend..." echo "🔍 Linting backend..."
cd website-monitoring-backend && npx eslint src/ || exit 1 cd backend && npx eslint src/ || exit 1
cd .. cd ..
fi fi
# Check if frontend files changed # Check if frontend files changed
if git diff --cached --name-only | grep -q "^website-monitoring-frontend/"; then if git diff --cached --name-only | grep -q "^frontend/"; then
echo "🔍 Linting frontend..." echo "🔍 Linting frontend..."
cd website-monitoring-frontend && npx next lint || exit 1 cd frontend && npx next lint || exit 1
cd .. cd ..
fi fi
+4 -4
View File
@@ -24,8 +24,8 @@ cd website-monitoring
npm install npm install
# Install project dependencies # Install project dependencies
cd website-monitoring-backend && npm install && cd .. cd backend && npm install && cd ..
cd website-monitoring-frontend && npm install && cd .. cd frontend && npm install && cd ..
# Start everything # Start everything
npm run dev npm run dev
@@ -71,8 +71,8 @@ npm run dev
## Testing ## Testing
- **Backend**: Jest + Supertest — `cd website-monitoring-backend && npm test` - **Backend**: Jest + Supertest — `cd backend && npm test`
- **Frontend**: Jest + Testing Library — `cd website-monitoring-frontend && npm test` - **Frontend**: Jest + Testing Library — `cd frontend && npm test`
- Aim for tests on all API endpoints and critical business logic - Aim for tests on all API endpoints and critical business logic
- Use meaningful test names: `it("should return 400 when URL is missing")` - Use meaningful test names: `it("should return 400 when URL is missing")`
+5 -5
View File
@@ -77,14 +77,14 @@ cd website-monitoring
npm install npm install
# Setup backend # Setup backend
cd website-monitoring-backend cd backend
cp .env.example .env cp .env.example .env
npm install npm install
npm run build npm run build
cd .. cd ..
# Setup frontend # Setup frontend
cd website-monitoring-frontend cd frontend
cp .env.example .env # Fill in your Supabase keys cp .env.example .env # Fill in your Supabase keys
npm install npm install
cd .. cd ..
@@ -109,7 +109,7 @@ npm run docker:up
``` ```
website-monitoring/ website-monitoring/
├── website-monitoring-backend/ # Express.js API + Lighthouse engine ├── backend/ # Express.js API + Lighthouse engine
│ ├── src/ │ ├── src/
│ │ ├── index.ts # Server entry, health check, routing │ │ ├── index.ts # Server entry, health check, routing
│ │ └── routes/ │ │ └── routes/
@@ -117,7 +117,7 @@ website-monitoring/
│ ├── Dockerfile │ ├── Dockerfile
│ └── package.json │ └── package.json
├── website-monitoring-frontend/ # Next.js 15 dashboard ├── frontend/ # Next.js 15 dashboard
│ ├── src/ │ ├── src/
│ │ ├── app/ # Pages & API routes (20+ endpoints) │ │ ├── app/ # Pages & API routes (20+ endpoints)
│ │ ├── components/ # React components (dashboard, UI, auth) │ │ ├── components/ # React components (dashboard, UI, auth)
@@ -126,7 +126,7 @@ website-monitoring/
│ ├── Dockerfile │ ├── Dockerfile
│ └── package.json │ └── package.json
├── website-monitoring-devops/ # Infrastructure ├── devops/ # Infrastructure
│ ├── docker-compose.yml # Full stack orchestration │ ├── docker-compose.yml # Full stack orchestration
│ └── .devcontainer/ # VS Code Dev Container config │ └── .devcontainer/ # VS Code Dev Container config
+9 -9
View File
@@ -21,7 +21,7 @@ echo " ✅ Node $(node --version), Docker, Supabase CLI found"
# 2. Start Supabase (if not already running) # 2. Start Supabase (if not already running)
echo "" echo ""
echo -e "${YELLOW}[2/6] Starting local Supabase...${NC}" echo -e "${YELLOW}[2/6] Starting local Supabase...${NC}"
cd website-monitoring-frontend cd frontend
if supabase status 2>&1 | grep -q "API URL"; then if supabase status 2>&1 | grep -q "API URL"; then
echo " ✅ Supabase already running" echo " ✅ Supabase already running"
else else
@@ -50,32 +50,32 @@ SUPABASE_SERVICE_ROLE_KEY=${SERVICE_KEY}
LIGHTHOUSE_SERVICE_URL=http://localhost:5000 LIGHTHOUSE_SERVICE_URL=http://localhost:5000
CRON_SECRET=local-dev-secret CRON_SECRET=local-dev-secret
EOF EOF
echo " ✅ Created website-monitoring-frontend/.env.local" echo " ✅ Created frontend/.env.local"
cd .. cd ..
# 4. Create backend .env # 4. Create backend .env
echo "" echo ""
echo -e "${YELLOW}[4/6] Configuring backend environment...${NC}" echo -e "${YELLOW}[4/6] Configuring backend environment...${NC}"
cat > website-monitoring-backend/.env << EOF cat > backend/.env << EOF
PORT=5000 PORT=5000
CORS_ORIGIN=http://localhost:3000 CORS_ORIGIN=http://localhost:3000
NODE_ENV=development NODE_ENV=development
EOF EOF
echo " ✅ Created website-monitoring-backend/.env" echo " ✅ Created backend/.env"
# 5. Install dependencies # 5. Install dependencies
echo "" echo ""
echo -e "${YELLOW}[5/6] Installing dependencies...${NC}" echo -e "${YELLOW}[5/6] Installing dependencies...${NC}"
npm install --silent 2>/dev/null npm install --silent 2>/dev/null
cd website-monitoring-backend && npm install --silent 2>/dev/null && cd .. cd backend && npm install --silent 2>/dev/null && cd ..
cd website-monitoring-frontend && npm install --silent 2>/dev/null && cd .. cd frontend && npm install --silent 2>/dev/null && cd ..
echo " ✅ Dependencies installed" echo " ✅ Dependencies installed"
# 6. Run database migrations # 6. Run database migrations
echo "" echo ""
echo -e "${YELLOW}[6/6] Applying database migrations...${NC}" echo -e "${YELLOW}[6/6] Applying database migrations...${NC}"
cd website-monitoring-frontend cd frontend
supabase db reset --no-seed 2>/dev/null || echo " ⚠️ Migrations may need manual review (run: cd website-monitoring-frontend && supabase db reset)" supabase db reset --no-seed 2>/dev/null || echo " ⚠️ Migrations may need manual review (run: cd frontend && supabase db reset)"
cd .. cd ..
echo "" echo ""
@@ -92,7 +92,7 @@ echo -e "${YELLOW}📋 Quick commands:${NC}"
echo " npm test — run all tests" echo " npm test — run all tests"
echo " npm run build — build everything" echo " npm run build — build everything"
echo " npm run lint — lint everything" echo " npm run lint — lint everything"
echo " supabase stop — stop local DB (in website-monitoring-frontend/)" echo " supabase stop — stop local DB (in frontend/)"
echo "" echo ""
echo -e "${YELLOW}🔑 Test cron endpoints locally:${NC}" echo -e "${YELLOW}🔑 Test cron endpoints locally:${NC}"
echo " curl -H 'Authorization: Bearer local-dev-secret' http://localhost:3000/api/cron/uptime" echo " curl -H 'Authorization: Bearer local-dev-secret' http://localhost:3000/api/cron/uptime"
@@ -18,7 +18,7 @@ services:
backend: backend:
build: build:
context: ../website-monitoring-backend context: ../backend
dockerfile: Dockerfile dockerfile: Dockerfile
restart: unless-stopped restart: unless-stopped
ports: ports:
@@ -41,7 +41,7 @@ services:
frontend: frontend:
build: build:
context: ../website-monitoring-frontend context: ../frontend
dockerfile: Dockerfile dockerfile: Dockerfile
restart: unless-stopped restart: unless-stopped
ports: ports:
@@ -25,7 +25,7 @@ This project is a modern website monitoring platform built with Next.js (App Rou
### 1. Install Dependencies ### 1. Install Dependencies
```bash ```bash
cd website-monitoring-frontend cd frontend
npm install npm install
``` ```
@@ -47,6 +47,6 @@ This will:
In a separate terminal: In a separate terminal:
```bash ```bash
cd website-monitoring-frontend cd frontend
npm run dev npm run dev
``` ```

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 391 B

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 425 B

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 128 B

After

Width:  |  Height:  |  Size: 128 B

Before

Width:  |  Height:  |  Size: 385 B

After

Width:  |  Height:  |  Size: 385 B

Some files were not shown because too many files have changed in this diff Show More