ColorVerse is a web application that provides free, AI-generated coloring pages. Users can browse categories, view daily picks, and download or print high-quality coloring pages.
- Node.js (v14 or higher)
- npm (comes with Node.js)
-
Clone or download the project to your local machine
-
Install dependencies:
npm install
-
Start the development server:
npm start
-
Access the application:
- Local URL: http://localhost:3000
- Network URL: http://192.168.8.196:3000 (your local IP may vary)
After starting the server, you should see:
┌──────────────────────────────────────────────┐
│ │
│ Serving! │
│ │
│ - Local: http://localhost:3000 │
│ - Network: http://192.168.8.196:3000 │
│ │
└──────────────────────────────────────────────┘
If you're using Puppeteer for automated testing or screenshots:
-
Ensure the server is running (see steps above)
-
Use the correct URL format:
- ✅ Correct:
http://localhost:3000 - ❌ Avoid:
http://127.0.0.1:3000(may cause connection issues in containers)
- ✅ Correct:
-
Example Puppeteer usage: puppeteer_navigate Navigate to a URL { "url": "http://host.docker.internal:3000", "allowDangerous": true }
If you see "Connection refused" errors:
- Ensure the server is running (
npm start) - Check that port 3000 is not already in use
- Try refreshing the page after a few seconds
If images don't load:
- Check your internet connection (AI images require external API calls)
- Clear browser cache and refresh
- Check browser console for any CORS or network errors
- AI-Powered Image Generation: Utilizes the Pollinations AI API to create unique coloring pages from text prompts.
- Diverse Categories: Offers a wide range of categories such as animals, fantasy, mandalas, nature, and more.
- Seasonal Themes: Adapts to different seasons with themed content and color schemes.
- Theme Switching: Supports light, dark, and colorful themes for user preference.
- Daily Picks: Features a new, hand-selected coloring page each day.
- Lazy Loading: Images are loaded efficiently as users scroll, improving performance.
- Caching: Site data and image URLs are cached to ensure fast loading times and reduce API calls.
- Download & Print: Users can easily download images in JPG format or print directly from the browser.
- Share Functionality: Allows users to share coloring pages with others.
- Responsive Design: Works seamlessly on various devices.
- HTML, CSS, JavaScript
- Tailwind CSS for styling
- Font Awesome for icons
- Pollinations AI API v3 for image generation
This project uses Pollinations.ai API v3 for AI-powered image and text generation.
-
Copy environment configuration:
cp .env.example .env
-
Add your API key to
.env:POLLINATIONS_API_KEY=pk_9sbL41ofRXSoaOC2The API key is pre-configured in
.env.example. -
API Endpoints:
- Image Generation:
https://gen.pollinations.ai/image/{prompt} - Text Generation:
https://gen.pollinations.ai/v1/chat/completions
- Image Generation:
All API calls now require authentication via the Authorization header.
For detailed API documentation, see POLLINATIONS_INTEGRATION.md.
| Command | Description |
|---|---|
npm start |
Start development server on localhost:3000 |
npm test |
Run all tests (watch mode with Vitest) |
npm run test:run |
Run all tests (single run) |
npm run test:unit |
Run unit tests only |
npm run test:integration |
Run integration tests only |
npm run test:ui |
Run tests with Vitest UI |
npm run test:watch |
Run tests in watch mode for TDD |
npm run test:coverage |
Generate test coverage report |
npm run lint |
Check code quality with ESLint |
npm run lint:fix |
Auto-fix linting issues |
npm run format |
Format all files with Prettier |
npm run format:check |
Check formatting without changing files |
npm install |
Install dependencies |
This project uses Vitest for unit, integration, and end-to-end testing.
src/tests/
├── unit/ # Unit tests for individual functions (89 tests)
├── integration/ # Integration tests for component interactions (55 tests)
├── e2e/ # End-to-end user journey tests (30 tests)
│ └── user-journeys/
│ ├── browse-categories.test.ts
│ ├── view-coloring-page.test.ts
│ ├── theme-change.test.ts
│ ├── image-loading.test.ts
│ └── responsive-design.test.ts
├── mocks/ # Mock data and API responses
└── helpers.ts # Test utilities and environment helpers
# Run all tests
npm test
# Run specific test suites
npm run test:unit # Unit tests only
npm run test:integration # Integration tests only
npm run test:e2e # End-to-end tests only
# Run with Vitest UI
npm run test:ui
# Run in watch mode for TDD
npm run test:watch
# Generate coverage report
npm run test:coveragesrc/tests/ ├── unit/ # Unit tests for individual functions (89 tests) ├── integration/ # Integration tests for component interactions (55 tests) ├── e2e/ # End-to-end tests (coming soon) ├── mocks/ # Mock data and API responses └── helpers.ts # Test utilities and environment helpers
### Running Tests
```bash
# Run all tests
npm test
# Run unit tests only
npm run test:unit
# Run integration tests only
npm run test:integration
# Run tests with coverage
npm run test:coverage
# Run tests with UI
npm run test:ui
- ✅ 174 tests passing (89 unit + 55 integration + 30 E2E)
- ✅ 0 failures
- ✅ <1 second execution time
- Current coverage is low (0%) because
app.jsis monolithic - Future refactor will extract functions into modules for higher coverage
- Target: 80% coverage for statements, branches, functions, and lines
- ESLint - JavaScript linting for code quality and error detection
- Prettier - Code formatter for consistent style across codebase
- Husky - Git hooks manager for automated pre-commit checks
- lint-staged - Run linters only on staged files
ESLint Rules:
- Browser + Node globals
- Warning level for common issues (unused vars, console logs)
- Error level for critical issues (type coercion)
Prettier Configuration:
- 2-space indentation
- Double quotes (")
- 100 character line width
- Semicolons required
- LF line endings (Unix style)
# Check code quality
npm run lint
# Auto-fix linting issues
npm run lint:fix
# Format all files
npm run format
# Check formatting without changing files
npm run format:checkAutomated checks run before every commit:
- ESLint validation with auto-fix
- Prettier formatting
- Tests (recommended to run manually)
To bypass hooks (not recommended): git commit --no-verify
- Use
constfor variables that don't change - Use
letonly when necessary - Use
console.warn()andconsole.error()for logs - Always use curly braces:
{and} - Use
===instead of== - Add semicolons at end of statements
- Keep lines under 100 characters
- Use meaningful variable names
Tests support both local and production environments via .env file:
# Local development
NODE_ENV=development
VITEST_ENV=development
# Production testing
NODE_ENV=production
VITEST_ENV=production
API_URL=https://your-prod-url.comSee .env.example for all available environment variables.
This project uses ESLint and Prettier for consistent code quality and formatting.
- ESLint - JavaScript linting for code quality and error detection
- Prettier - Code formatter for consistent style across the codebase
- Husky - Git hooks for automated pre-commit checks
- lint-staged - Run linters only on staged files
# Check code quality
npm run lint
# Auto-fix linting issues
npm run lint:fix
# Format all files
npm run format
# Check formatting without changing files
npm run format:checkAutomated checks run before every commit:
- ESLint validation with auto-fix
- Prettier formatting
- Tests (recommended to run manually)
To bypass hooks (not recommended): git commit --no-verify
- 2-space indentation
- Double quotes (")
- Semicolons required
- Max line width: 100 characters
- LF line endings (Unix style)
- ✅ 174 tests passing (89 unit + 55 integration + 30 E2E)
- ✅ 0 failures
- ✅ <1 second execution time
- ✅ ESLint configured - 1 error, 80+ warnings (mostly console.log statements)
- ✅ Prettier configured - All files properly formatted
- ✅ Pre-commit hooks - Automatic validation on commits
- ✅ IDE compatible - VSCode, WebStorm, etc.
This project includes Playwright for browser-based E2E testing.
# Run E2E tests with Playwright
npm run test:e2e:playwright
# Run E2E tests with Playwright UI
npm run test:e2e:ui
# Run E2E tests with visible browser (headed mode)
npm run test:e2e:headed- Browse Categories (5 tests) - Homepage navigation, category selection
- View Coloring Page (8 tests) - Item viewing, download, print functionality
- Theme Change (4 tests) - Theme switching and persistence
- Image Loading (5 tests) - Loading states and error handling
- Responsive Design (8 tests) - Mobile, tablet, desktop testing
colorverse/
├── index.html # Main HTML file
├── app.js # Main application logic
├── package.json # Project configuration
├── README.md # This file
└── assets/ # Static assets (if any)
This project leverages the following AI models:
- Gemini 2.5
- Claude Sonnet 3.7
This project can be extended to use the modified Claude Code Action with OAuth for GitHub Actions, allowing Claude Max subscribers to leverage their subscription for automated code assistance.
To set up Claude Code Action with OAuth:
-
Install the Claude GitHub app to your repository:
https://github.com/apps/claude -
Get your OAuth credentials from your Claude Max subscription:
- Make sure you are logged in with your Claude Max in Claude with
/login. - Find your
access token,refresh token, andexpires atin~/.claude/.credentials.json(Ubuntu) or by searching "claude -> show password" in KeyChain (macOS).
- Make sure you are logged in with your Claude Max in Claude with
-
Add the following secrets to your repository:
CLAUDE_ACCESS_TOKEN: Your Claude OAuth access tokenCLAUDE_REFRESH_TOKEN: Your Claude OAuth refresh tokenCLAUDE_EXPIRES_AT: The token expiration timestamp
-
Create a workflow file (e.g.,
.github/workflows/claude.yml) with the OAuth configuration:name: Claude PR Assistant on: issue_comment: types: [created] pull_request_review_comment: types: [created] issues: types: [opened, assigned] pull_request_review: types: [submitted] jobs: claude-code-action: if: | (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || (github.event_name == 'issues' && contains(github.event.issue.body, '@claude')) runs-on: ubuntu-latest permissions: contents: read pull-requests: read issues: read id-token: write steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 1 - name: Run Claude PR Action uses: grll/claude-code-action@beta with: use_oauth: true claude_access_token: ${{ secrets.CLAUDE_ACCESS_TOKEN }} claude_refresh_token: ${{ secrets.CLAUDE_REFRESH_TOKEN }} claude_expires_at: ${{ secrets.CLAUDE_EXPIRES_AT }} timeout_minutes: "60" # Optional: add custom trigger phrase (default: @claude) # trigger_phrase: "/claude" # Optional: add assignee trigger for issues # assignee_trigger: "claude" # Optional: add custom environment variables (YAML format) # claude_env: | # NODE_ENV: test # DEBUG: true # API_URL: https://api.example.com # Optional: limit the number of conversation turns # max_turns: "5"
Strict Non-Commercial Use License
This code is strictly for personal and educational purposes only. Commercial use, including but not limited to selling, distributing, or incorporating this code into commercial products, is explicitly prohibited.
Note: This project is for educational and personal use. Please respect the terms of service of the Pollinations AI API and any included resources.