-
Notifications
You must be signed in to change notification settings - Fork 514
Development
Welcome to ChurchCRM development! This guide will help you set up a complete development environment and start contributing to the project.
| New Developer? | Returning Developer? | Ready to Contribute? |
|---|---|---|
| Quick Start → | Development Cycle → | PR Checklist → |
| First-Time Setup → | npm Scripts → | Testing Guide → |
| Tech Stack → | Debugging → | Contributing → |
GitHub Codespaces is the recommended way to develop ChurchCRM. Everything is automatically set up for you:
- Go to ChurchCRM GitHub Repository
- Click "Code" → "Codespaces" → "Create codespace on master"
- Wait 2-3 minutes for automatic setup
- Code is ready immediately! You can edit files and run builds
- When ready to test the application: Run
npm run docker:dev:start - Access the app at http://localhost (login: admin/changeme)
What's automatically installed:
- ✅ PHP 8.2+
- ✅ Node.js 22 with all dependencies
- ✅ Git & Git LFS
- ✅ Docker support
- ✅ VS Code extensions (PHP IntelliSense, Copilot, Xdebug, etc.)
- ✅ Frontend & backend dependencies already built
Your devcontainer includes:
- All required PHP extensions (bcmath, curl, gd, gettext, intl, json, mbstring, mysqli, opcache, soap, sodium, xml, zip)
- Pre-configured VS Code settings and extensions
- Docker port forwarding (80, 3306, 8025, 8088)
- Automatic initialization script
For detailed devcontainer information, see Development Container Setup.
If you prefer to develop locally with VS Code:
- Install VS Code from code.visualstudio.com
- Install "Dev Containers" extension in VS Code (search in Extensions)
- Clone the repository:
git clone https://github.com/ChurchCRM/CRM.git - Open the folder in VS Code
- Click the "Reopen in Container" button that appears
- Wait for setup to complete (~2-3 minutes)
- Run
npm run docker:dev:startwhen ready to test
Same automatic setup as Codespaces - everything is pre-configured!
If you need to develop outside containers, follow these steps:
- Git: Installation guide
- PHP 8.2+: See System Requirements
- Node.js 22+: nodejs.org
- Composer: getcomposer.org
- Docker (optional, needed for testing):
# 1. Clone repository
git clone https://github.com/ChurchCRM/CRM.git
cd CRM
# 2. Install npm dependencies
npm ci
# 3. Install PHP dependencies
cd src
composer install
cd ..
# 4. Build frontend assets
npm run build:frontend
# 5. When ready to test, start Docker
npm run docker:dev:start
# 6. Access application at http://localhost/Everything is automatically ready after setup!
# 1. Immediately available (no Docker needed for builds):
npm run build # Full build (PHP + frontend)
npm run build:frontend # Rebuild JS/CSS only
npm run build:php # Update PHP dependencies
# 2. When ready to test the application:
npm run docker:dev:start # Start MariaDB, Apache, MailHog
npm run docker:dev:stop # Stop services
npm run docker:dev:logs # View service logs
# 3. Application is then available at:
# - Main app: http://localhost/
# - Email testing: http://localhost:8025/
# - Database admin: http://localhost:8088/
# - Login: admin / changeme- Code Changes: Edit files in VS Code
-
Frontend Changes: Run
npm run build:frontend(rebuilds CSS/JS) - Refresh Browser: See changes immediately
- Database Access: Use Adminer at http://localhost:8088/
- Email Testing: Check MailHog at http://localhost:8025/
- Code Changes: Edit files in your local repository
-
Build Assets: Run
npm run build:frontendto rebuild CSS/JS assets - View Changes: Refresh http://localhost/ to see your changes
- Database Access: Use http://localhost:8088/ (adminer) for database management
All available scripts are defined in package.json. Here's a comprehensive reference:
| Script | Description |
|---|---|
npm run build |
Build PHP dependencies + frontend assets |
npm run build:frontend |
Build frontend only (JS/CSS) |
npm run build:php |
Install PHP dependencies via Composer |
npm run build:webpack |
Run webpack bundler only |
npm run build:orm |
Regenerate Propel ORM models |
npm run build:signatures |
Generate file signatures for integrity checks |
npm run build:php:validate |
Validate PHP syntax for all files |
npm run deploy |
Full build + generate signatures (recommended) |
npm run deploy:clean |
Clean install + full deploy |
npm run package |
Create release package (.zip) |
npm run clean |
Remove all generated files and dependencies |
| Script | Description |
|---|---|
npm run docker:dev:start |
Start dev containers (web, database, mailhog) |
npm run docker:dev:stop |
Stop dev containers |
npm run docker:dev:logs |
View container logs (follow mode) |
npm run docker:dev:login:web |
Shell into web container |
npm run docker:dev:login:db |
Shell into database container |
| Script | Description |
|---|---|
npm run docker:test |
Start test containers |
npm run docker:test:stop |
Stop test containers |
npm run docker:test:down |
Stop and remove test containers + volumes |
npm run docker:test:rebuild |
Full rebuild of test containers |
npm run docker:test:restart |
Restart all test containers |
npm run docker:test:restart:db |
Restart database only (refresh schema) |
npm run docker:test:logs |
View test container logs |
npm run docker:test:login:web |
Shell into test web container |
npm run docker:test:login:db |
Shell into test database container |
npm run docker:test:subdir |
Start test with subdirectory config |
npm run docker:test:reset |
Reset CI containers (down + rebuild) |
| Script | Description |
|---|---|
npm run docker:ci:start |
Start CI containers (GitHub Actions) |
npm run docker:ci:down |
Stop and remove CI containers |
| Script | Description |
|---|---|
npm run test |
Run all Cypress tests (headless) |
npm run test:ui |
Open Cypress interactive UI |
npm run test:fast |
Run tests with headed Chrome (no exit) |
npm run test:api |
Run API tests only |
npm run test:ui-only |
Run UI tests only (no API tests) |
| Script | Description |
|---|---|
npm run locale:build |
Extract and build locale files |
npm run locale:audit |
Check translation completeness |
npm run locale:download |
Download translations from POEditor |
npm run locale:variants |
Populate language variants |
npm run locale:missing |
Build missing translation entries |
npm run locale:lint |
Lint locale files for issues |
| Script | Description |
|---|---|
npm run format:web |
Format code with Prettier |
npm run audit |
Fix npm security vulnerabilities |
Once your development environment is running, you'll need to complete initial setup:
-
Username:
admin -
Password:
changeme
Important: Change this password immediately after first login for security.
-
Access ChurchCRM
- If using Codespaces: Open the forwarded port link (port 80)
- If using Dev Containers: Visit
http://localhost/
-
Login with
admin/changeme -
Change Password
- You'll be prompted to change your password on first login
- Set a strong password for your development account
-
Configure Church Information (Optional for development)
- Go to System Settings to configure your church details
- This helps personalize the interface but is optional for development work
-
Test Email Integration (Optional)
- MailHog is running on port 8025 for testing email functionality
- Outgoing emails are captured and can be viewed at
http://localhost:8025
- Read First-Run Configuration Items for production setup
- Review Features Overview to understand ChurchCRM capabilities
- Check Database Structure to understand the data model
- Explore Code Functional Reference for API information
- Framework: AdminLTE (Bootstrap-based admin theme)
-
CSS: SASS compilation to
churchcrm.min.css - JavaScript: jQuery, plus React/TypeScript for newer components
- Build Tools: Grunt (task runner) + Webpack (React components)
- Language: PHP (see System Requirements for details)
- Framework: Slim Framework v4 (MVC architecture)
- Database ORM: Propel (with auto-generated models)
- Database: MySQL or MariaDB (see System Requirements for details)
- End-to-End: Cypress (browser automation)
- Integration: PHP-based tests
- Environment: Docker containers for consistent testing
Use Slim MVC architecture:
-
Models: Propel ORM entities in
src/ChurchCRM/model/ -
Views: PHP templates in
src/templates/or React components inreact/ -
Controllers: Slim route handlers in
src/api/routes/orsrc/v2/routes/
Follow AdminLTE design principles:
- Use existing AdminLTE components when possible
- Create modular, responsive designs
- Add custom styling in SASS files under
src/skin/scss/
-
Legacy code: jQuery-based, located in
src/skin/js/ -
New components: React/TypeScript, located in
react/ - Internationalization: Use i18next for user-facing text
- Edit schema in
src/mysql/upgrade.json - Run
npm run orm-gento regenerate Propel models - Test changes with Docker database container
- Development database includes sample families, people, and events
- Reset database: Use adminer or API endpoint
/api/database/reset
- Read the Contributing Guide
- Join the developer chat at Matrix
- Look for
good first issuelabels
- Fork the repository on GitHub
-
Create a feature branch:
git checkout -b fix/issue-123-description - Make your changes and test thoroughly
-
Run tests:
npm run test(required before PR) - Submit a pull request with clear description
- Follow PSR-12 for PHP code
- Use Propel ORM for all database access (no raw SQL)
- Use Bootstrap 4.6.2 CSS classes (not Bootstrap 5)
- Wrap all UI text with
gettext()(PHP) ori18next.t()(JS) - Add comments for complex logic
- Update documentation for user-facing changes
📘 Full Standards: See
.github/copilot-instructions.mdfor complete coding standards and patterns.
ChurchCRM uses GitHub Actions to automate quality checks. Understanding these helps you submit successful PRs.
When you open a Pull Request, these automated checks run:
| Workflow | What It Checks | Must Pass? |
|---|---|---|
| Build, Test and Package | Builds app, runs Cypress tests, creates release package | ✅ Yes |
| CI — Typecheck & Lint | TypeScript type checking, ESLint for React code | ✅ Yes |
| Security Analysis (DevSkim) | Scans for security vulnerabilities in code |
This is the main CI workflow (build-test-package.yml):
-
Install Dependencies -
npm ciand Composer install -
Build Application -
npm run package(frontend + backend) - Validate PHP Syntax - Checks all PHP files for syntax errors
- Start Docker - Spins up test containers (web, database, mailhog)
- Run Cypress Tests - Full end-to-end test suite
-
Create Artifact - Builds
ChurchCRM-{version}.zippackage
If tests fail:
- Cypress screenshots/videos are uploaded as artifacts
- Download
cypress-artifacts-{run_id}from the workflow run - Check
cypress/logs/for detailed error messages
This workflow (ci.yml) ensures TypeScript and React code quality:
-
TypeScript Check:
npx tsc --noEmit- Catches type errors -
ESLint:
npx eslint "react/**/*.{js,jsx,ts,tsx}"- Code style
Run locally before pushing:
npx tsc --noEmit --pretty # TypeScript check
npx eslint "react/**/*.{js,jsx,ts,tsx}" # Lint checkThe DevSkim security scanner (security-devskim.yml) runs on:
- Every push to
masteranddevelop - Every PR to
master - Weekly scheduled scans
It checks for common security issues like:
- SQL injection vulnerabilities
- XSS (cross-site scripting) risks
- Hardcoded credentials
- Insecure cryptographic patterns
| Workflow | Purpose | When It Runs |
|---|---|---|
| Locale Generate App Terms | Extracts translatable strings from code | Push to master (src/ changes) |
| Auto-comment on Issues | Posts helpful templates on new issues | New issue opened |
| Manage Stale Issues | Marks/closes inactive issues and PRs | Daily at 1:30 AM UTC |
Before submitting your PR, verify:
- Branch naming:
fix/issue-123-descriptionorfeature/description - Tests pass locally: Run
npm run test - TypeScript compiles: Run
npx tsc --noEmit - Linked to issue: PR description includes
Fixes #123
- Propel ORM used (no raw SQL or
RunQuery()) - Bootstrap 4.6.2 classes (not Bootstrap 5)
- UI text wrapped with
gettext()ori18next.t() - No
alert()calls - usewindow.CRM.notify() - Asset paths use
SystemURLs::getRootPath()
- Screenshot or GIF included in PR
- Responsive design tested
- Cypress UI test added/updated
- API test added in
cypress/e2e/api/ - Error responses use
SlimUtils::renderErrorJSON() - Documentation updated if needed
-
Container won't start: Check
npm run docker:dev:logsfor error messages - Port conflicts: Ensure ports 80, 3306, 8025, 8088 are available
-
Git LFS errors: Run
git lfs install && git lfs pullto download large files -
npm/Composer errors: Delete
node_modules/andvendor/folders, then runnpm ci && composer install
-
White page or 500 errors: Check
src/logs/error.logfor PHP errors -
Database connection issues: Verify credentials, check
npm run docker:dev:logsfor database errors -
Email not sending: MailHog captures emails at
http://localhost:8025/ -
Assets not loading: Run
npm run build:frontendto rebuild frontend assets
-
Database: Access via Adminer at
http://localhost:8088/(MySQL/MariaDB) -
PHP Logs: Located in
src/logs/- checkerror.logandaccess.log -
Container Logs:
npm run docker:dev:logsshows all container output - Xdebug: Pre-configured in dev container for step debugging via VS Code
- FAQs - Frequently asked questions about ChurchCRM
- Troubleshooting Guide - Common problems and solutions
- 500 Error Solutions - Server error troubleshooting
- Matrix Chat - Real-time developer discussions and questions
- GitHub Issues - Report bugs, request features, or ask technical questions
- GitHub Discussions - General questions and community support
- Contributing Guide - How to contribute code and documentation
-
Issue Labels - Find
help wantedorgood first issueto start contributing
For development inside containers:
# SSH into web container
npm run docker-dev-login-web
# Inside container
cd /home/ChurchCRM
npm run deploy
chmod a+rwx src/logs # Fix log permissions# Generate production assets
npm run deploy
# Create release package
grunt compress-
PHP Errors: Check
src/logs/for application logs -
Container Logs: Use
npm run docker:dev:logs - Database: Use adminer at http://localhost:8088/
- Email Testing: Check http://localhost:8025/ for sent emails
- Automated Testing - Cypress end-to-end testing guide
- Code Functional Reference
- Database Structure
- Localization System
- Matrix Chat - Developer discussions
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - General questions
In the ChurchCRM source directory run:
npm installNote: if you are running Apple Silicon (M1/M2 processor) you will get errors with
node-sass.
For example:
npm ERR! Binary has a problem: Error: dlopen(/path/to/ChurchCRM/node_modules/node-sass/vendor/darwin-arm64-120/binding.node, 0x0001):
tried:
'/path/to/ChurchCRM/node_modules/node-sass/vendor/darwin-arm64-120/binding.node' (not a mach-o file),
'/System/Volumes/Preboot/Cryptexes/OS/path/to/ChurchCRM/node_modules/node-sass/vendor/darwin-arm64-120/binding.node' (no such file),
'/path/to/ChurchCRM/node_modules/node-sass/vendor/darwin-arm64-120/binding.node' (not a mach-o file)'
If this happens, simply execute the following (fix courtesy of "m_kos" at Stack Overflow):
npm install node-sass@npm:sass{.sh} (requires npm >6.9)
Start the application and test it locally:
-
npm run deploy{.sh} -
npm run docker:test:start{.sh} - Open your browser and visit http://localhost/ and log in with admin/changeme
Download an IDE
- PHP Storm is a great but paid
- Visual Studio Code is a free IDE
- Installation Guide ← Start here!
- First Run Setup
- Features Overview
Day-to-day usage of ChurchCRM
- User Documentation
- People Management
- Groups & Events
- Tools
- Finances
Server management & configuration
- User Management
- System Maintenance
- Configuration
- Troubleshooting
- Localization
Contributing to ChurchCRM
- Quick Start
- Testing & CI/CD
- Code & Architecture
- Localization
- Release & Security
