Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
131 changes: 131 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# =============================================================================
# Docker Ignore File
# =============================================================================
# This file tells Docker which files and directories to exclude when building
# the image. Excluding unnecessary files makes the build faster and the image
# smaller.
# =============================================================================

# -----------------------------------------------------------------------------
# Git and Version Control
# -----------------------------------------------------------------------------
.git
.gitignore
.gitattributes

# -----------------------------------------------------------------------------
# Docker Files (not needed inside the container)
# -----------------------------------------------------------------------------
Dockerfile
docker-compose.yml
docker-compose*.yml
.dockerignore
docker/

# -----------------------------------------------------------------------------
# Dependencies (will be installed during build)
# -----------------------------------------------------------------------------
# PHP dependencies - installed via Composer in the build
vendor/

# Node.js dependencies - installed via pnpm in the build
node_modules/

# Built assets - will be built during the Docker build
public/dist/

# -----------------------------------------------------------------------------
# Development and IDE Files
# -----------------------------------------------------------------------------
.idea/
.vscode/
*.iml
.sublime-project
.sublime-workspace
*.swp
*.swo
*~

# Claude Code configuration
.claude/
.junie/

# -----------------------------------------------------------------------------
# Environment and Configuration
# -----------------------------------------------------------------------------
# Environment files may contain secrets - NEVER include in image
.env
.env.local
.env.*.local

# Vagrant
.vagrant/
Vagrantfile

# -----------------------------------------------------------------------------
# Build and Test Artifacts
# -----------------------------------------------------------------------------
build/
tests/coverage*
phpunit.xml
phpunit*.xml
.phpunit.result.cache

# Log files (writable directory is mounted as volume)
writable/logs/*
writable/cache/*
writable/session/*
writable/uploads/*
writable/debugbar/*
php_errors.log

# Keep the directory structure but not the contents
!writable/logs/.gitkeep
!writable/cache/.gitkeep
!writable/session/.gitkeep
!writable/uploads/.gitkeep
!writable/debugbar/.gitkeep

# -----------------------------------------------------------------------------
# Operating System Files
# -----------------------------------------------------------------------------
# macOS
.DS_Store
.AppleDouble
.LSOverride
._*

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/

# Linux
*~
.directory
.Trash-*

# -----------------------------------------------------------------------------
# Documentation (optional - uncomment to exclude)
# -----------------------------------------------------------------------------
# README.md
# CLAUDE.md
# DOCKER.md
# docs/
# *.md

# -----------------------------------------------------------------------------
# Miscellaneous
# -----------------------------------------------------------------------------
# Backup files
*.bak
*.backup
*.old

# Temporary files
*.tmp
*.temp

# Results and output
results/
114 changes: 114 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# =============================================================================
# CodeIgniter 4 Chat Application - Environment Configuration
# =============================================================================
# Copy this file to .env and update the values for your environment.
# IMPORTANT: Never commit .env to version control!
#
# This file is used by both Docker Compose and CodeIgniter.
# =============================================================================

# -----------------------------------------------------------------------------
# Application Settings
# -----------------------------------------------------------------------------
# Environment: development, testing, or production
CI_ENVIRONMENT=development

# Application URL (used by CodeIgniter for generating links)
# For Docker: Use the host port, not the container port
APP_URL=http://localhost:8000

# Port to expose the web application (default: 8000)
APP_PORT=8000

# -----------------------------------------------------------------------------
# Database Configuration
# -----------------------------------------------------------------------------
# This application supports both MySQL and SQLite databases.
#
# QUICK START WITH SQLITE (recommended for beginners):
# 1. Set DB_DRIVER=SQLite3
# 2. Run: php spark migrate
# 3. That's it! No database server needed.
#
# FOR MYSQL (production or Docker):
# 1. Set DB_DRIVER=MySQLi (or leave unset, it's the default)
# 2. Configure the MySQL settings below
# 3. Run: php spark migrate
# -----------------------------------------------------------------------------

# Database driver: MySQLi (default) or SQLite3
# Set to SQLite3 for easy local development without a database server
DB_DRIVER=MySQLi

# -----------------------------------------------------------------------------
# MySQL Configuration (only needed if DB_DRIVER=MySQLi)
# -----------------------------------------------------------------------------
# These settings are used by both Docker Compose and CodeIgniter.

# Database name
DB_DATABASE=ci4_chat

# Database user (application account)
DB_USERNAME=ci4_user
DB_PASSWORD=ci4_password

# Database root password (only used by MySQL container)
DB_ROOT_PASSWORD=rootpassword

# Port to expose MySQL on the host (default: 3307 to avoid conflicts)
# Connect with a database client using localhost:3307
DB_PORT=3307

# -----------------------------------------------------------------------------
# SQLite Configuration (only needed if DB_DRIVER=SQLite3)
# -----------------------------------------------------------------------------
# When using SQLite, the database file is automatically created at:
# writable/database/chat.db
#
# No additional configuration is required for SQLite.
# The database directory is created automatically when the app starts.

# -----------------------------------------------------------------------------
# WebSocket Configuration
# -----------------------------------------------------------------------------
# Port for the WebSocket server
WEBSOCKET_PORT=8080

# WebSocket URL for the frontend to connect to
# This should be accessible from the user's browser
WEBSOCKET_URL=ws://localhost:8080

# -----------------------------------------------------------------------------
# CodeIgniter Settings (used when running locally without Docker)
# -----------------------------------------------------------------------------
# Uncomment and modify these for local development without Docker.
# When using Docker, the docker-compose.yml overrides these.

# database.default.hostname=localhost
# database.default.database=ci4_chat
# database.default.username=ci4_user
# database.default.password=ci4_password
# database.default.DBDriver=MySQLi
# database.default.port=3306

# -----------------------------------------------------------------------------
# Optional: Security Settings
# -----------------------------------------------------------------------------
# Encryption key for CodeIgniter (generate with: php spark key:generate)
# encryption.key=

# -----------------------------------------------------------------------------
# Optional: Email Settings
# -----------------------------------------------------------------------------
# email.protocol=smtp
# email.SMTPHost=
# email.SMTPUser=
# email.SMTPPass=
# email.SMTPPort=587
# email.SMTPCrypto=tls

# -----------------------------------------------------------------------------
# Optional: Session Settings
# -----------------------------------------------------------------------------
# session.driver=CodeIgniter\Session\Handlers\FileHandler
# session.savePath=writable/session
16 changes: 14 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,19 @@

version: 2
updates:
- package-ecosystem: "composer" # See documentation for possible values
directory: "/" # Location of package manifests
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"

- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
groups:
minor-and-patch:
patterns:
- "*"
update-types:
- "minor"
- "patch"
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
test:
name: PHP ${{ matrix.php }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ['8.4']

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

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: mbstring, xml, curl, intl, json, mysqlnd, sockets
coverage: none

- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --prefer-dist --no-progress --no-interaction

- name: Run PHPUnit tests
run: composer test

- name: Run Composer audit
run: composer audit
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ writable/uploads/*
writable/debugbar/*
!writable/debugbar/.gitkeep

writable/database/*
!writable/database/.gitkeep

php_errors.log

# Legacy CI3 paths
Expand Down Expand Up @@ -143,3 +146,9 @@ _modules/*

/results/
/phpunit*.xml

#-------------------------
# Static Analysis Cache
#-------------------------
.php-cs-fixer.cache
.phpunit.result.cache
Loading
Loading