A containerized development environment for testing and developing applications across multiple server technologies simultaneously. This project provides hot-reloading development servers for HTML/CSS/JS, Python (Flask and FastAPI), and Node.js Express, all running in Docker containers with a unified dashboard for monitoring.
- Features
- Architecture
- Quick Start
- Service Access Points
- UI Features
- Development Workflow
- API Documentation
- Testing
- Managing Containers
- Performance Optimization
- Security Considerations
- Git Configuration
- Troubleshooting
- Contributing
- License
- Beautiful UI: Dark and light theme with modern component library
- Cross-platform compatibility: All services run in Docker containers
- Hot reloading: All servers automatically reload when code changes
- Unified dashboard: Monitor all services in one interface
- Standardized API endpoints: Common patterns across all server implementations
- CORS enabled: All services configured for cross-origin requests
- Health checks: Docker health checks implemented for all services
- API testing tools: Built-in interface for testing endpoints
- Theme switching: Toggle between dark and light themes with persistent preferences
- Loading screen: Smooth page load experience with animated loading indicator
- Responsive Layout: Mobile-friendly design with adaptive components
- Git workflow: Complete Git configuration with hooks, templates, and CI/CD
The development environment consists of the following components:
| Service | Technology | Port | Purpose |
|---|---|---|---|
| Dashboard | HTML/JS/CSS (Live Server) | 8081 | Monitor all services |
| Flask API | Python Flask | 8082 | Python web framework |
| FastAPI | Python FastAPI | 8083 | Modern Python API framework |
| Node.js API | Express.js | 8084 | JavaScript API server |
| Reverse Proxy | Nginx (optional) | 8080 | Unified routing |
- Docker and Docker Compose installed
- Git for version control
-
Clone the repository:
git clone https://github.com/pkeffect/dev-server.git cd dev-environment -
Create an environment file:
cp .env.example .env
-
Set up Git hooks (optional but recommended):
chmod +x .githooks/pre-commit git config core.hooksPath .githooks
-
Build and start all services:
docker-compose up --build
-
Access the dashboard:
- Open your browser and navigate to http://localhost:8081
Click to expand all service endpoints
- Dashboard: http://localhost:8081
- Live Server API: http://localhost:8081/api.html
- Flask API: http://localhost:8082
- FastAPI: http://localhost:8083
- OpenAPI Documentation: http://localhost:8083/docs
- Node.js Express: http://localhost:8084
- Unified Access (if using Nginx): http://localhost:8080
- Flask API: http://localhost:8080/flask
- FastAPI: http://localhost:8080/fastapi
- Node.js: http://localhost:8080/node
- Dark & Light Themes: Toggle between themes with persistent preferences that respect system settings
- Modern UI Components: Buttons, cards, alerts, badges, dropdowns, forms and more
- Loading Screen: Smooth page load experience with animated loading indicator
- Responsive Layout: Mobile-friendly design with adaptive components
- Interactive Dashboard: Real-time service status monitoring
- API Testing Panel: Built-in interface for testing endpoints across all services
- GitHub-Inspired Design: Familiar, clean interface for developers
dev-environment/
βββ app_flask.py # Flask application
βββ app_fastapi.py # FastAPI application
βββ app_node.js # Node.js Express application
βββ Dockerfile # Multi-stage Docker build
βββ compose.yml # Docker Compose configuration
βββ requirements.txt # Python dependencies
βββ package.json # Node.js dependencies
βββ .env.example # Environment variables template
βββ .gitignore # Git ignore patterns
βββ .gitattributes # Git attributes configuration
βββ .githooks/ # Git hooks
β βββ pre-commit # Pre-commit hook
βββ .github/ # GitHub configuration
β βββ workflows/ # GitHub Actions
β β βββ ci.yml # CI workflow
β βββ ISSUE_TEMPLATE/ # Issue templates
β βββ PULL_REQUEST_TEMPLATE.md # PR template
βββ healthcheck.sh # Health check script
βββ nginx/ # Nginx configuration
β βββ nginx.conf # Reverse proxy setup
βββ src/ # Front-end source files
β βββ index.html # Dashboard HTML
β βββ css/ # CSS styles
β β βββ main.css # Main shared styles
β β βββ components.css # UI component styles
β β βββ dark-theme.css # Dark theme styles
β β βββ light-theme.css # Light theme styles
β β βββ dashboard.css # Dashboard-specific styles
β β βββ utilities.css # Utility classes
β β βββ loading.css # Loading screen styles
β βββ js/ # JavaScript files
β β βββ main.js # Main functionality
β β βββ theme.js # Theme switching logic
β β βββ dashboard.js # Dashboard functionality
β β βββ loading.js # Loading screen manager
β βββ img/ # Images directory
β β βββ icons/ # SVG icons
β βββ api.html # Live Server API endpoint
βββ tests/ # Testing utilities
βββ api_tests.sh # Bash test suite
βββ test_suite.py # Python test suite
βββ test_flask.py # Flask-specific tests
βββ conftest.py # pytest configuration
βββ node-tests.js # Node.js tests
All code is mounted as volumes in the Docker containers, so changes to files will automatically trigger server reloads:
- HTML/CSS/JS: Edit files in the
src/directory - Python (Flask/FastAPI): Edit
app_flask.pyorapp_fastapi.py - Node.js: Edit
app_node.js
- Python: Add to
requirements.txtand restart the containers - Node.js: Add to
package.jsonand restart the containers
Configure your development environment by editing the .env file:
View example environment configuration
# Server Configurations
FLASK_ENV=development
FLASK_DEBUG=1
NODE_ENV=development
# API Keys (for demonstration)
DEMO_API_KEY=your_api_key_here
# Database Configuration (if needed)
DB_HOST=localhost
DB_PORT=5432
DB_NAME=devdb
DB_USER=devuser
DB_PASSWORD=devpassword
All services implement the following standard endpoints:
View API endpoints
GET /
Returns basic service information:
{
"message": "Hello from [Service]!",
"service": "[Service Name]",
"environment": "development",
"version": "1.0.0"
}GET /health
Returns service health status:
{
"status": "healthy",
"service": "[Service Name]"
}POST /echo
Body:
{
"message": "Hello world",
"data": { "key": "value" }
}Response:
{
"echo": {
"message": "Hello world",
"data": { "key": "value" }
},
"service": "[Service Name]"
}FastAPI automatically generates interactive API documentation:
- Swagger UI: http://localhost:8083/docs
- ReDoc: http://localhost:8083/redoc
The dashboard provides an interactive way to test all services:
- Open http://localhost:8081
- Use the "Test" buttons for individual services
- Click "Test All Services" for a comprehensive check
- Use the API Testing panel for custom endpoint tests
View command line testing options
# Run the bash test suite
./tests/api_tests.sh# Run the Python test suite
python tests/test_suite.py# Run the Node.js tests
npm test# Run the Flask tests
docker-compose exec flask-dev pytest tests/test_flask.py
# Run the FastAPI tests
docker-compose exec fastapi-dev pytestView Docker management commands
# Start all services
docker-compose up
# Start in detached mode
docker-compose up -d
# Start a specific service
docker-compose up flask-dev# Stop all services
docker-compose down
# Stop and remove volumes
docker-compose down -v# View logs from all services
docker-compose logs
# Follow logs
docker-compose logs -f
# View logs for a specific service
docker-compose logs flask-devThis environment includes several performance optimizations:
The FastAPI service includes CPU and memory limits to prevent resource contention:
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.25'
memory: 128MThe dashboard implements:
- Progressive loading of resources
- Efficient theme switching without page reloads
- Preloading of critical JavaScript
- Optimized SVG icons
For development, use the included hot-reload settings. For production, consider:
- Disabling hot-reload flags (
--reload) - Adjusting worker counts based on available CPU cores
- Setting appropriate logging levels
The Dockerfile includes options for running containers as non-root users:
# --- Create non-root user and group ---
RUN addgroup -S dev-group && adduser -S dev-user -G dev-group
# --- Change ownership of the application directory ---
RUN chown -R dev-user:dev-group /app
# --- Switch to the non-root user ---
USER dev-userUncomment these sections for improved container security in production.
Ensure sensitive information is stored in .env files and never committed to version control. The .gitignore file excludes .env files by default:
# Environment variables
.env
.env.*
!.env.example
This project includes a complete Git workflow setup:
.gitignore: Comprehensive ignore patterns for development files.gitattributes: Line ending normalization and file handling- GitHub Workflows: Automated CI/CD with GitHub Actions
- Issue & PR Templates: Standardized formats for contributions
- Git Hooks: Pre-commit validation for code quality
View Git setup instructions
# Make git hooks executable
chmod +x .githooks/pre-commit
# Set hooks path
git config core.hooksPath .githooksFollow the GitHub Flow branching strategy:
- Create a feature branch from main
- Make changes and commit
- Push branch and create a Pull Request
- After review, merge to main
For detailed instructions, see GIT_SETUP.md.
View common issues and solutions
Check the Docker logs:
docker-compose logs [service-name]Ensure the correct volume mounts are in place and file permissions are correct:
docker-compose down
docker-compose up --buildVerify the port mappings in compose.yml and check if the container is running:
docker-compose psCheck browser console for errors in theme.js. Local storage might be disabled or full.
Ensure the src/api.html file exists for the Live Server API endpoint. If the test still fails, check the browser console for CORS errors.
Check the GitHub Actions logs for detailed error information. Common issues include:
- Missing test files or incorrect paths
- Import errors in Python tests
- Timing issues with service startup
Each service has built-in health checks that Docker uses to monitor container status:
# View container health
docker psWe welcome contributions to this project! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please read our Code of Conduct and Security Policy before contributing.
This project is licensed under the MIT License - see the LICENSE file for details.