Skip to content

mradeybee/dreen-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

835 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dreen.ai - AI-Powered Resume Builder

Professional resume building and optimization platform powered by AI

Deployed on Heroku Staging on Vercel Tests

Overview

Dreen.ai is a comprehensive AI-powered resume building and optimization platform that helps users create professional resumes with intelligent suggestions, ATS optimization, and real-time analysis.

Deployment Architecture

  • Production: Heroku (main branch) - https://dreen-ai-prod.herokuapp.com
  • Staging: Vercel (dev branch) - Automatic deployments from dev branch
  • Database: PostgreSQL on Heroku for production, separate staging database on Vercel

Quick Start

Development Setup

# Clone repository
git clone https://github.com/mradeybee/dreen-ai.git
cd dreen-ai

# Install dependencies
npm install

# Set up environment variables
cp env.example .env.local

# Run database migrations
npm run db:migrate:dev

# Start development server
npm run dev

Deployment

Production (Heroku)

# Setup Heroku (first time only)
bash scripts/setup-heroku.sh

# Deploy to production
git push heroku main

# Check deployment status
bash scripts/deployment-status.sh

Staging (Vercel)

# Deploy to staging
git push origin dev

# Vercel automatically deploys from dev branch

Code Quality & Pre-Push Hooks

This project uses Git hooks to ensure code quality before pushing. A pre-push hook automatically runs linting and tests to prevent broken code from being pushed to the repository.

Pre-Push Hook

The pre-push hook runs automatically when you try to push code and ensures:

  1. ESLint Check: Runs npm run lint to check for code style and potential issues
  2. Test Suite: Runs npm run test:ci to ensure all tests pass
  3. Block Push: If either check fails, the push is blocked until issues are resolved

Installing Hooks

Hooks are automatically installed when you run:

npm install

Or manually with:

npm run husky:install

Bypassing Hooks (Emergency Only)

If you absolutely need to bypass the pre-push hook (not recommended), use:

git push --no-verify

Testing

This project includes comprehensive test coverage for both utility functions and React hooks.

Running Tests

# Run all tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

# Run tests for CI/CD
npm run test:ci

Test Structure

  • __tests__/lib/ - Tests for utility functions

    • utils.test.ts - Tests for utility functions like cn
    • env-check.test.ts - Tests for environment variable checking
    • api-utils.test.ts - Tests for API utility functions
    • session-utils.test.ts - Tests for session management utilities
    • stripe-config.test.ts - Tests for Stripe configuration
  • __tests__/hooks/ - Tests for React hooks

    • use-mobile.test.tsx - Tests for mobile detection hook
    • use-guided-tour.test.tsx - Tests for guided tour functionality
    • use-session-expiration.test.tsx - Tests for session expiration handling
    • use-toast.test.tsx - Tests for toast notification system

Test Coverage

The project aims for 70% test coverage across all files. Tests cover:

  • ✅ Happy path scenarios
  • ✅ Error handling and edge cases
  • ✅ Component state management
  • ✅ API interactions
  • ✅ Utility functions

Environment Configuration

The application supports multiple environment configurations through the NODE_ENV environment variable.

Environment Options

  • development - Full console logging enabled, MongoDB logging disabled
  • staging - Console logging enabled, MongoDB logging enabled (for testing production-like behavior)
  • production - Console logging disabled, MongoDB logging enabled
  • vercel - Console logging enabled, MongoDB logging enabled (with Vercel-optimized connection pooling)

Environment Variables

Copy env.example to .env.local and configure the following variables:

# Environment
NODE_ENV="development" # Options: development, staging, production

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/dreen_ai"

# MongoDB (for logging)
MONGODB_URI="mongodb://localhost:27017/dreen-ai-logs"
# Note: MongoDB logging now works on Vercel with optimized connection pooling

# NextAuth
NEXTAUTH_SECRET="your-nextauth-secret-key-here"
NEXTAUTH_URL="http://localhost:3000"

# Additional configuration...

Logger Behavior by Environment

Environment Console Logging MongoDB Logging Use Case
development ✅ Enabled ❌ Disabled Local development
staging ✅ Enabled ✅ Enabled Testing production features
production ❌ Disabled ✅ Enabled Live production
vercel ✅ Enabled ✅ Enabled Vercel deployment with MongoDB logging

Vercel MongoDB Logging

The application now supports MongoDB logging on Vercel deployments:

  • Optimized Connection Pooling: Uses connection pooling optimized for serverless environments
  • Automatic Reconnection: Handles Vercel's cold starts and connection timeouts
  • Non-blocking Logging: All logging operations are asynchronous and won't affect response times
  • Fallback Handling: Gracefully falls back to console logging if MongoDB is unavailable

To enable MongoDB logging on Vercel:

  1. Set MONGODB_URI in your Vercel environment variables
  2. Set NODE_ENV to production or staging for MongoDB logging
  3. The system will automatically detect Vercel and use optimized connection settings

CI/CD Pipeline

The project uses GitHub Actions for continuous integration and deployment:

  1. Test Job: Runs tests on Node.js 18.x and 20.x
  2. Lint Job: Ensures code quality with ESLint
  3. Build Job: Builds the application
  4. Deploy Job: Deploys to Vercel (main/dev branches only)

Workflow Triggers

  • Push to main or dev branches
  • Pull requests to main or dev branches

Deployment

Your project is live at:

https://vercel.com/adebayo-adepojus-projects/v0-dreen-ai-design

Build your app

Continue building your app on:

https://v0.dev/chat/projects/0UccLxG6CwM

How It Works

  1. Create and modify your project using v0.dev
  2. Deploy your chats from the v0 interface
  3. Changes are automatically pushed to this repository
  4. Vercel deploys the latest version from this repository
  5. Tests run automatically on every push and pull request

Releases

Packages

Contributors

Languages