Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Sharothee Wedding Website CodeQL Config"

# Paths to analyze
paths:
- "client/src"
- ".github/workflows"

# Paths to ignore
paths-ignore:
- "client/node_modules"
- "client/.next"
- "client/out"
- "client/dist"
- "client/build"
- "client/coverage"
- "client/prisma/migrations"
- "docs"
- "copilot's docs"

# Additional queries for wedding website security
queries:
- name: security-extended
uses: security-extended
- name: security-and-quality
uses: security-and-quality

# Wedding-specific configuration
wedding-security-checks:
- authentication-bypass
- data-exposure
- rsvp-form-validation
- admin-panel-access
- guest-data-protection
299 changes: 299 additions & 0 deletions .github/workflows/ci-cd-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,299 @@
name: 🧪 Wedding Website CI/CD Pipeline

on:
push:
branches: [ "main", "develop" ]
paths:
- 'client/**'
- '.github/workflows/**'
pull_request:
branches: [ "main" ]
paths:
- 'client/**'
- '.github/workflows/**'
workflow_dispatch:
inputs:
deploy_environment:
description: 'Environment to deploy to'
required: false
default: 'development'
type: choice
options:
- development
- staging
- production

permissions:
contents: read
issues: write
pull-requests: write
checks: write

env:
NODE_VERSION: '20'
WORKING_DIRECTORY: './client'

jobs:
build-and-test:
runs-on: ubuntu-latest
timeout-minutes: 15

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: 'client/package-lock.json'

- name: Install dependencies
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npm ci --prefer-offline --no-audit
echo "✅ Dependencies installed successfully"

- name: Create environment file
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
cat << EOF > .env.local
# Database
DATABASE_URL="file:./dev.db"

# NextAuth
NEXTAUTH_SECRET="wedding-test-secret-key-for-ci"
NEXTAUTH_URL="http://localhost:3000"

# Email (Test keys)
RESEND_API_KEY="re_test_api_key"

# Cloudinary (Test keys)
CLOUDINARY_CLOUD_NAME="test-cloud"
CLOUDINARY_API_KEY="test-api-key"
CLOUDINARY_API_SECRET="test-api-secret"
EOF
echo "✅ Environment file created for CI"

- name: Generate Prisma client
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npx prisma generate
echo "✅ Prisma client generated"

- name: Lint code
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npm run lint
echo "✅ Code linting passed"

- name: Type check
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npm run type-check
echo "✅ TypeScript check passed"

- name: Run tests
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npm test -- --ci --coverage --watchAll=false
echo "✅ Tests completed"

- name: Build application
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npm run build
echo "✅ Build completed successfully"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: success()
with:
name: wedding-website-build
path: client/.next/
retention-days: 7

security-audit:
runs-on: ubuntu-latest
needs: build-and-test
if: success()

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: 'client/package-lock.json'

- name: Security audit
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npm audit --audit-level=high
echo "✅ Security audit completed"
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The security audit step uses continue-on-error: true which may mask critical security vulnerabilities. Consider making high-severity vulnerabilities fail the pipeline while allowing moderate/low severity issues to pass with warnings.

Suggested change
echo "✅ Security audit completed"
- name: Security audit (fail on high and above)
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npm audit --audit-level=high
echo "✅ No high or critical vulnerabilities found"
- name: Security audit (warn on moderate/low)
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npm audit --audit-level=moderate || echo "⚠️ Moderate or low vulnerabilities found"
echo "ℹ️ Moderate/low vulnerabilities do not fail the pipeline"

Copilot uses AI. Check for mistakes.
continue-on-error: true

- name: Check for vulnerable packages
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npx audit-ci --config ./audit-ci.json || echo "⚠️ Security vulnerabilities found"
continue-on-error: true

performance-test:
runs-on: ubuntu-latest
needs: build-and-test
if: success() && github.event_name == 'pull_request'

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: 'client/package-lock.json'

- name: Install dependencies
working-directory: ${{ env.WORKING_DIRECTORY }}
run: npm ci --prefer-offline --no-audit

- name: Create environment file
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
cat << EOF > .env.local
# Database
DATABASE_URL="file:./dev.db"

# NextAuth
NEXTAUTH_SECRET="wedding-test-secret-key-for-ci"
NEXTAUTH_URL="http://localhost:3000"

# Email (Test keys)
RESEND_API_KEY="re_test_api_key"

# Cloudinary (Test keys)
CLOUDINARY_CLOUD_NAME="test-cloud"
CLOUDINARY_API_KEY="test-api-key"
CLOUDINARY_API_SECRET="test-api-secret"
EOF
echo "✅ Environment file created for performance testing"

- name: Generate Prisma client
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
npx prisma generate
echo "✅ Prisma client generated"

- name: Lighthouse Performance Test
uses: treosh/lighthouse-ci-action@v11
with:
configPath: '${{ env.WORKING_DIRECTORY }}/lighthouserc.json'
uploadArtifacts: true
temporaryPublicStorage: true
artifactName: 'lighthouse-results'

deployment-check:
runs-on: ubuntu-latest
needs: [build-and-test, security-audit]
if: success() && (github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch')

steps:
- name: Deployment Readiness Check
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const deployInput = '${{ github.event.inputs.deploy_environment }}';
const environment = deployInput || 'development';
const isProduction = environment === 'production';

console.log(`🚀 Deployment readiness check for: ${environment}`);

if (isProduction) {
// Check for any open critical issues
const { data: criticalIssues } = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
labels: 'wedding-day-critical,critical',
state: 'open'
});

if (criticalIssues.length > 0) {
console.log(`⚠️ ${criticalIssues.length} critical issues found - proceed with caution`);

// Create deployment warning comment
const warningMessage = `🚨 **Production Deployment Warning**\n\n` +
`There are ${criticalIssues.length} critical issues open:\n\n` +
criticalIssues.map(issue => `- #${issue.number}: ${issue.title}`).join('\n') +
`\n\nPlease review these issues before deploying to production.\n\n` +
`*Automated check from Wedding Website CI/CD Pipeline*`;

if (context.issue && context.issue.number) {
await github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: warningMessage
});
}
} else {
console.log('✅ No critical issues found - ready for production');
}
}

// Log deployment readiness
console.log('📋 Deployment Checklist:');
console.log(' ✅ Build successful');
console.log(' ✅ Tests passed');
console.log(' ✅ Security audit completed');
console.log(' ✅ Code quality checks passed');
console.log(` 🎯 Target environment: ${environment}`);

return {
ready: true,
environment: environment,
timestamp: new Date().toISOString()
};

workflow-summary:
runs-on: ubuntu-latest
needs: [build-and-test, security-audit, deployment-check]
if: always()

steps:
- name: Workflow Summary
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const buildStatus = '${{ needs.build-and-test.result }}';
const securityStatus = '${{ needs.security-audit.result }}';
const deploymentStatus = '${{ needs.deployment-check.result }}';

console.log('🎯 Wedding Website CI/CD Pipeline Summary');
console.log('==========================================');
console.log(`Build & Test: ${buildStatus === 'success' ? '✅' : '❌'} ${buildStatus}`);
console.log(`Security Audit: ${securityStatus === 'success' ? '✅' : securityStatus === 'skipped' ? '⏭️' : '❌'} ${securityStatus}`);
console.log(`Deployment Check: ${deploymentStatus === 'success' ? '✅' : deploymentStatus === 'skipped' ? '⏭️' : '❌'} ${deploymentStatus}`);

const overallSuccess = buildStatus === 'success';
console.log(`Overall Status: ${overallSuccess ? '✅ SUCCESS' : '❌ FAILED'}`);

if (!overallSuccess) {
console.log('🚨 Pipeline failed - check logs and resolve issues before proceeding');
} else {
console.log('🎉 Pipeline completed successfully - wedding website is ready!');
}

return {
success: overallSuccess,
build: buildStatus,
security: securityStatus,
deployment: deploymentStatus
};
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ A comprehensive, bilingual (English & Bengali) wedding website serving as the di
- **Backend**: Next.js API Routes
- **Database**: MySQL with Prisma ORM
- **Authentication**: NextAuth.js with JWT tokens
- **File Storage**: Open-Source and Free provider for media management
- **Email Service**: NodeMailer and Gmail
- **File Storage**: Cloudinary for media management
- **Email Service**: Resend for notifications
- **Forms**: React Hook Form with Zod validation
- **State Management**: Zustand
- **Testing**: Jest with React Testing Library
Expand All @@ -50,8 +50,8 @@ A comprehensive, bilingual (English & Bengali) wedding website serving as the di
- Node.js 18+
- npm or yarn
- MySQL database
- Open-Source Free Provider account (for media storage)
- Gmail App Password and account (for emails) ([how to generate](https://support.google.com/accounts/answer/185833?hl=en))
- Cloudinary account (for media storage)
- Resend account (for emails)

### Installation

Expand Down Expand Up @@ -79,7 +79,13 @@ A comprehensive, bilingual (English & Bengali) wedding website serving as the di
NEXTAUTH_SECRET="your-secret-key"
NEXTAUTH_URL="http://localhost:3000"


# Cloudinary
CLOUDINARY_CLOUD_NAME="your-cloud-name"
CLOUDINARY_API_KEY="your-api-key"
CLOUDINARY_API_SECRET="your-api-secret"

# Resend
RESEND_API_KEY="your-resend-api-key"
```

4. **Set up the database**
Expand Down
4 changes: 4 additions & 0 deletions client/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
# next.js
/.next/
/out/
/.turbo

# production
/build
Expand All @@ -29,6 +30,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
*.log

# env files (can opt-in for committing if needed)

Expand All @@ -41,3 +43,5 @@ yarn-error.log*
next-env.d.ts

/src/generated/prisma
# playwright
/test-results
2 changes: 2 additions & 0 deletions client/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Uncomment the line below to enforce engine-strict dependency checks
# engine-strict=true
Loading
Loading