Skip to content

feat: add dev container for zero-config local development#28915

Open
gfernandez-me wants to merge 4 commits into
calcom:mainfrom
gfernandez-me:feat/add-devcontainer
Open

feat: add dev container for zero-config local development#28915
gfernandez-me wants to merge 4 commits into
calcom:mainfrom
gfernandez-me:feat/add-devcontainer

Conversation

@gfernandez-me
Copy link
Copy Markdown

What does this PR do?

Adds a .devcontainer configuration so contributors can spin up a fully working development environment without installing PostgreSQL or Redis locally. Works with VS Code Dev Containers and GitHub Codespaces.

Changes:

  • .devcontainer/devcontainer.json — Node.js 20 dev environment; pre-sets DATABASE_URL, DATABASE_DIRECT_URL, and REDIS_URL via remoteEnv so contributors never need to touch those values; auto-copies .env.example.env on first container start (skipped if .env already exists); installs dependencies via yarn install
  • .devcontainer/docker-compose.yml — Postgres 15-alpine exposed on port 5450 (matching the default in .env.example) and Redis 7-alpine on 6379
  • README.md — adds a "Dev Container setup" section under Development with step-by-step instructions

The only manual step after the container starts is setting NEXTAUTH_SECRET and CALENDSO_ENCRYPTION_KEY in .env.

Visual Demo (For contributors especially)

N/A — infrastructure configuration, no UI changes.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works. N/A — this is a developer tooling addition with no application logic.

How should this be tested?

  1. Clone the repo and open it in VS Code with Docker running.
  2. When prompted, click Reopen in Container (or run Dev Containers: Reopen in Container from the Command Palette).
  3. Wait for postCreateCommand to finish — .env should be created and yarn install should complete.
  4. Open .env and fill in NEXTAUTH_SECRET (openssl rand -base64 32) and CALENDSO_ENCRYPTION_KEY (openssl rand -base64 24).
  5. Run yarn workspace @calcom/prisma db-migrate.
  6. Run yarn dev and confirm the app starts at http://localhost:3000.

DATABASE_URL, DATABASE_DIRECT_URL, and REDIS_URL are pre-configured by the container and do not need to be changed.

Checklist

  • I have read the contributing guide
  • My code follows the style guidelines of this project
  • My PR is small (3 files, ~107 lines added)

Adds a .devcontainer configuration so contributors can start coding
without installing PostgreSQL or Redis locally. Works with VS Code
Dev Containers and GitHub Codespaces.
@github-actions
Copy link
Copy Markdown
Contributor

Welcome to Cal.diy, @gfernandez-me! Thanks for opening this pull request.

A few things to keep in mind:

  • This is Cal.diy, not Cal.com. Cal.diy is a community-driven, fully open-source fork of Cal.com licensed under MIT. Your changes here will be part of Cal.diy — they will not be deployed to the Cal.com production app.
  • Please review our Contributing Guidelines if you haven't already.
  • Make sure your PR title follows the Conventional Commits format.

A maintainer will review your PR soon. Thanks for contributing!

@gfernandez-me gfernandez-me marked this pull request as ready for review April 16, 2026 10:55
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1472242192

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .devcontainer/docker-compose.yml
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 16, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a954c425-85ec-4e12-98d9-f402f0256b43

📥 Commits

Reviewing files that changed from the base of the PR and between ca3c745 and 43e13bb.

📒 Files selected for processing (3)
  • .devcontainer/docker-compose.yml
  • .env.example
  • README.md
✅ Files skipped from review due to trivial changes (2)
  • README.md
  • .devcontainer/docker-compose.yml

📝 Walkthrough

Walkthrough

Adds a VS Code Dev Container configuration at .devcontainer/devcontainer.json (named "Cal.diy") using Docker Compose (.devcontainer/docker-compose.yml) with service: "app" and workspace mounted at /workspace. Sets remoteEnv for DATABASE_URL, DATABASE_DIRECT_URL, and REDIS_URL; runs a postCreateCommand that copies .env.example to .env if missing and runs HUSKY=0 yarn install; forwards port 3000 and pre-installs extensions. Adds app (Node 20), database (Postgres 15, host port 5450) and redis (Redis 7, host port 6379) services with named volumes. Updates README with Dev Container setup and related steps.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add dev container for zero-config local development' accurately and clearly summarizes the primary change—introducing a dev container configuration for simplified local development setup.
Description check ✅ Passed The description comprehensively explains the PR's purpose, details all changes including files modified, testing instructions, and mandatory task completion, demonstrating clear relevance to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Stopped waiting for pipeline failures after 30000ms. One of your pipelines takes longer than our 30000ms fetch window to run, so review may not consider pipeline-failure results for inline comments if any failures occurred after the fetch window. Increase the timeout if you want to wait longer or run a @coderabbit review after the pipeline has finished.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.devcontainer/docker-compose.yml (1)

20-31: Make host port mappings configurable to reduce local collisions.

Fixed host ports (5450, 6379) can fail on machines already using those ports. Consider env-driven defaults so users can override without editing committed files.

Suggested compose refactor
     ports:
       # Expose on 5450 to match DATABASE_URL in .env.example
-      - "5450:5432"
+      - "${DEVCONTAINER_POSTGRES_PORT:-5450}:5432"
@@
     ports:
-      - "6379:6379"
+      - "${DEVCONTAINER_REDIS_PORT:-6379}:6379"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.devcontainer/docker-compose.yml around lines 20 - 31, Change the hard-coded
host port mappings for the postgres and redis services to use environment-driven
defaults so local port collisions can be avoided; replace the literal mappings
("5450:5432" and "6379:6379") with env variable expansions like
${POSTGRES_HOST_PORT:-5450}:5432 and ${REDIS_HOST_PORT:-6379}:6379 in the
docker-compose service definitions (postgres, redis) and update .env.example to
include POSTGRES_HOST_PORT and REDIS_HOST_PORT with the default values and a
short comment about overriding them.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@README.md`:
- Around line 215-216: Update the README sentence that currently references
`DATABASE_URL` and `REDIS_URL` to also mention `DATABASE_DIRECT_URL`;
specifically, amend the line "> The `DATABASE_URL` and `REDIS_URL` are
pre-configured by the Dev Container and do not need to be changed." to include
`DATABASE_DIRECT_URL` so it reads something like "The `DATABASE_URL`,
`DATABASE_DIRECT_URL`, and `REDIS_URL` are pre-configured by the Dev Container
and do not need to be changed." This ensures Prisma flows that rely on
`DATABASE_DIRECT_URL` are documented.

---

Nitpick comments:
In @.devcontainer/docker-compose.yml:
- Around line 20-31: Change the hard-coded host port mappings for the postgres
and redis services to use environment-driven defaults so local port collisions
can be avoided; replace the literal mappings ("5450:5432" and "6379:6379") with
env variable expansions like ${POSTGRES_HOST_PORT:-5450}:5432 and
${REDIS_HOST_PORT:-6379}:6379 in the docker-compose service definitions
(postgres, redis) and update .env.example to include POSTGRES_HOST_PORT and
REDIS_HOST_PORT with the default values and a short comment about overriding
them.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ef6c9d37-0c6c-439e-857f-2a148bb04ded

📥 Commits

Reviewing files that changed from the base of the PR and between 00693bb and 1472242.

📒 Files selected for processing (3)
  • .devcontainer/devcontainer.json
  • .devcontainer/docker-compose.yml
  • README.md

Comment thread README.md
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 16, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown

@SagarJadhav30 SagarJadhav30 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intresting

@github-actions
Copy link
Copy Markdown
Contributor

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions Bot added the Stale label Apr 29, 2026
@Qodo-Free-For-OSS
Copy link
Copy Markdown

Hi, README states Redis is exposed on host port 6379, but the devcontainer docker-compose does not publish Redis ports, so host tools cannot connect to Redis as documented.

Severity: action required | Category: correctness

How to fix: Expose Redis or update README

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

The Dev Container README claims Redis is exposed on host port 6379, but .devcontainer/docker-compose.yml does not publish Redis ports, so host clients (e.g. redis-cli, TablePlus) cannot connect as described.

Issue Context

  • Postgres is published to the host (5450:5432), but Redis lacks any ports: mapping.
  • README explicitly says Redis is exposed on 6379.

Fix Focus Areas

  • .devcontainer/docker-compose.yml[26-31]
  • README.md[215-232]

What to change

Either:

  1. Add ports: ["6379:6379"] under the redis service to match the documentation, or
  2. Update the README note to clarify Redis is only reachable inside the dev container / compose network (and remove the host-port claim).

Found by Qodo. Free code review for open-source maintainers.

@github-actions github-actions Bot removed the Stale label Apr 30, 2026
@Qodo-Free-For-OSS
Copy link
Copy Markdown

Hi, The devcontainer Postgres uses password postgres, but .env.example (copied to .env) uses an empty password, contradicting the README’s claim that host connections work “without any extra configuration.”

Severity: remediation recommended | Category: correctness

How to fix: Align Postgres creds and docs

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

Devcontainer Postgres requires a password, but .env.example’s DATABASE_URL omits it, and README claims host DB access works with .env.example defaults.

Issue Context

The container-internal app connection is fine because remoteEnv sets a URL with postgres:postgres@database:5432, and dotenv won’t override it by default. The problem is the host-machine tooling path described in README.

Fix Focus Areas

  • .devcontainer/docker-compose.yml[16-23]
  • .env.example[16-21]
  • README.md[231-231]

Suggested fix options

Pick one consistent story:

  1. Update .env.example to include the password for the published devcontainer DB, e.g. postgresql://postgres:postgres@localhost:5450/calendso (and same for DATABASE_DIRECT_URL), OR
  2. Change the devcontainer Postgres config to allow passwordless local connections (e.g., remove password + set appropriate auth method), OR
  3. Keep the current DB password, but update README note to mention the password requirement explicitly (so it’s not “no extra configuration”).

Found by Qodo code review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 9, 2026

This PR has been marked as stale due to inactivity. If you're still working on it or need any help, please let us know or update the PR to keep it active.

@github-actions github-actions Bot added the Stale label May 9, 2026
* Updated DATABASE_URL and DATABASE_DIRECT_URL in .env.example to include the password.
* Enhanced README.md to specify PostgreSQL credentials for host access.
* Added port exposure for Redis in docker-compose.yml for easier access.
@gfernandez-me
Copy link
Copy Markdown
Author

requested fixes done.

@github-actions github-actions Bot added ❗️ .env changes contains changes to env variables and removed Stale labels May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

❗️ .env changes contains changes to env variables size/L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants