Files
bolt-diy/docs/docs/CONTRIBUTING.md
Keoma Wright 56e602b7f4 fix: resolve .env.local not loading in docker compose
Fixes issue #1827 where Docker Compose wasn't properly loading .env.local file.

Problem:
- Docker Compose expects .env file for variable substitution but docs say to use .env.local
- This caused environment variables to not be loaded in Docker containers

Solution:
- Updated docker-compose.yaml to load both .env and .env.local files
- Created setup-env.sh script to help users sync .env.local to .env
- Updated documentation with clear instructions for Docker users
- Maintains backward compatibility with existing setups

Changes:
- Modified docker-compose.yaml to use array syntax for env_file
- Added scripts/setup-env.sh helper script
- Updated CONTRIBUTING.md and index.md documentation

This ensures environment variables work correctly in Docker while maintaining
the security best practice of using .env.local for sensitive data.

Contributed by: Keoma Wright
2025-08-24 10:31:23 +00:00

5.3 KiB
Raw Blame History

Contribution Guidelines

Welcome! This guide provides all the details you need to contribute effectively to the project. Thank you for helping us make bolt.diy a better tool for developers worldwide. 💡


📋 Table of Contents

  1. Code of Conduct
  2. How Can I Contribute?
  3. Pull Request Guidelines
  4. Coding Standards
  5. Development Setup
  6. Testing
  7. Deployment
  8. Docker Deployment
  9. VS Code Dev Containers Integration

🛡️ Code of Conduct

This project is governed by our Code of Conduct. By participating, you agree to uphold this code. Report unacceptable behavior to the project maintainers.


🛠️ How Can I Contribute?

1 Reporting Bugs or Feature Requests

  • Check the issue tracker to avoid duplicates.
  • Use issue templates (if available).
  • Provide detailed, relevant information and steps to reproduce bugs.

2 Code Contributions

  1. Fork the repository.
  2. Create a feature or fix branch.
  3. Write and test your code.
  4. Submit a pull request (PR).

3 Join as a Core Contributor

Interested in maintaining and growing the project? Fill out our Contributor Application Form.


Pull Request Guidelines

PR Checklist

  • Branch from the main branch.
  • Update documentation, if needed.
  • Test all functionality manually.
  • Focus on one feature/bug per PR.

Review Process

  1. Manual testing by reviewers.
  2. At least one maintainer review required.
  3. Address review comments.
  4. Maintain a clean commit history.

📏 Coding Standards

General Guidelines

  • Follow existing code style.
  • Comment complex logic.
  • Keep functions small and focused.
  • Use meaningful variable names.

🖥️ Development Setup

1 Initial Setup

  • Clone the repository:
    git clone https://github.com/stackblitz-labs/bolt.diy.git
    
  • Install dependencies:
    pnpm install
    
  • Set up environment variables:
    1. Rename .env.example to .env.local.
    2. Add your API keys:
      GROQ_API_KEY=XXX
      HuggingFace_API_KEY=XXX
      OPENAI_API_KEY=XXX
      ...
      
    3. For Docker users: Run the setup script or manually copy .env.local to .env:
      # Option 1: Use the setup script
      ./scripts/setup-env.sh
      
      # Option 2: Manual copy
      cp .env.local .env
      
      Docker Compose requires .env for variable substitution.
    4. Optionally set:
      • Debug level: VITE_LOG_LEVEL=debug
      • Context size: DEFAULT_NUM_CTX=32768

Note: Never commit your .env.local or .env files to version control. They're already in .gitignore.

2 Run Development Server

pnpm run dev

Tip: Use Google Chrome Canary for local testing.


🧪 Testing

Run the test suite with:

pnpm test

🚀 Deployment

Deploy to Cloudflare Pages

pnpm run deploy

Ensure you have required permissions and that Wrangler is configured.


🐳 Docker Deployment

This section outlines the methods for deploying the application using Docker. The processes for Development and Production are provided separately for clarity.


🧑‍💻 Development Environment

Build Options

Option 1: Helper Scripts

# Development build
npm run dockerbuild

Option 2: Direct Docker Build Command

docker build . --target bolt-ai-development

Option 3: Docker Compose Profile

docker compose --profile development up

Running the Development Container

docker run -p 5173:5173 --env-file .env.local bolt-ai:development

🏭 Production Environment

Build Options

Option 1: Helper Scripts

# Production build
npm run dockerbuild:prod

Option 2: Direct Docker Build Command

docker build . --target bolt-ai-production

Option 3: Docker Compose Profile

docker compose --profile production up

Running the Production Container

docker run -p 5173:5173 --env-file .env.local bolt-ai:production

Coolify Deployment

For an easy deployment process, use Coolify:

  1. Import your Git repository into Coolify.
  2. Choose Docker Compose as the build pack.
  3. Configure environment variables (e.g., API keys).
  4. Set the start command:
    docker compose --profile production up
    

🛠️ VS Code Dev Containers Integration

The docker-compose.yaml configuration is compatible with VS Code Dev Containers, making it easy to set up a development environment directly in Visual Studio Code.

Steps to Use Dev Containers

  1. Open the command palette in VS Code (Ctrl+Shift+P or Cmd+Shift+P on macOS).
  2. Select Dev Containers: Reopen in Container.
  3. Choose the development profile when prompted.
  4. VS Code will rebuild the container and open it with the pre-configured environment.

🔑 Environment Variables

Ensure .env.local is configured correctly with:

  • API keys.
  • Context-specific configurations.

Example for the DEFAULT_NUM_CTX variable:

DEFAULT_NUM_CTX=24576 # Uses 32GB VRAM