Skip to content

docs: add environment variable documentation and .env.example file#682

Open
shrushtigaynar wants to merge 1 commit into
GitMetricsLab:mainfrom
shrushtigaynar:docs-add-env-documentation
Open

docs: add environment variable documentation and .env.example file#682
shrushtigaynar wants to merge 1 commit into
GitMetricsLab:mainfrom
shrushtigaynar:docs-add-env-documentation

Conversation

@shrushtigaynar
Copy link
Copy Markdown
Contributor

@shrushtigaynar shrushtigaynar commented Jun 2, 2026

Description

This PR improves the project setup experience by documenting the required backend environment variables and providing a sample .env.example file for contributors.

Changes Made

  • Added a dedicated Environment Variables section to the README.
  • Created a .env.example file containing all required variables with placeholder values.
  • Added brief descriptions for each environment variable to clarify their purpose.
  • Improved onboarding and local development setup for new contributors.

Benefits

  • Makes project configuration easier for contributors.
  • Reduces setup-related issues and confusion.
  • Provides a clear reference for required environment variables.

Closes #675

Summary by CodeRabbit

  • Chores

    • Added example environment configuration file to guide setup with placeholder values for database connection, session management, port settings, and logging preferences.
  • Documentation

    • Updated README with new Environment Variables section documenting all required configuration keys and providing practical setup example.

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 2, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit 6af1bcb
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a1ee2781a6cb90008c6e180
😎 Deploy Preview https://deploy-preview-682--github-spy.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds environment variable documentation to improve contributor onboarding. A new .env.example file provides example configuration values, and a README section explains the required environment variables—PORT, MONGO_URI, SESSION_SECRET, NODE_ENV, and LOG_LEVEL—with their purposes.

Changes

Environment Variable Setup and Documentation

Layer / File(s) Summary
Environment variable configuration and documentation
\.env.example, README.md
.env.example defines example configuration entries (PORT, MONGO_URI, SESSION_SECRET, NODE_ENV, LOG_LEVEL), and README.md adds a new Environment Variables section documenting each variable's purpose and providing a complete example configuration block.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit hops through config keys,
With .env.example files with ease,
The README now explains them all—
MongoDB, ports, and secrets tall!
Setup simplified for one and all! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main changes: adding environment variable documentation and a .env.example file.
Description check ✅ Passed The description includes all required sections: Related Issue, Description with changes made, and Type of Change (implied as documentation update).
Linked Issues check ✅ Passed All objectives from issue #675 are met: Environment Variables section added to README, .env.example file created with required variables, and brief explanations provided for each variable.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #675 requirements; no out-of-scope modifications detected in README.md and .env.example files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

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

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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.env.example:
- Line 5: Update the SESSION_SECRET example to clearly require a strong, random
secret: replace the generic placeholder "your_session_secret" with a descriptive
value indicating length and randomness (e.g., "32+ char random string, use a
secure generator") and add a short preceding comment recommending using a
cryptographically secure random value (at least 32 characters) and not
committing it to source control; reference the SESSION_SECRET entry so the
change is applied to that line.

In `@README.md`:
- Line 85: Replace the sentence "Create a `.env` file in the project root and
add the following variables:" in README.md with instructions to copy the
provided `.env.example` as the starting point (e.g., mention copying
`.env.example` to `.env`) and then edit values as needed; reference the
`.env.example` filename explicitly so readers use that template rather than
creating `.env` from scratch.
- Around line 87-93: The environment variable table entries (PORT, MONGO_URI,
SESSION_SECRET, NODE_ENV, LOG_LEVEL) are too terse—update each description to
include expected formats, examples and defaults: specify PORT as an integer with
a default (e.g., 3000), MONGO_URI with a connection string format example
(mongodb://user:pass@host:port/db) and required auth/replica set notes,
SESSION_SECRET with minimum length/entropy guidance or example placeholder and
note that it must be set in production, NODE_ENV with allowed values
(development|production|test) and default, and LOG_LEVEL with allowed values
(error|warn|info|debug|trace) and default; edit the README table rows for the
symbols PORT, MONGO_URI, SESSION_SECRET, NODE_ENV, and LOG_LEVEL to include
these details.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3bafc82a-50c3-4f71-a41a-b34d59475a01

📥 Commits

Reviewing files that changed from the base of the PR and between 53f820b and 6af1bcb.

📒 Files selected for processing (2)
  • .env.example
  • README.md

Comment thread .env.example

MONGO_URI=your_mongodb_connection_string

SESSION_SECRET=your_session_secret
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Enhance SESSION_SECRET placeholder to emphasize security requirements.

The current placeholder doesn't convey the security importance of using a strong, random value. Consider using a more descriptive placeholder that indicates the required characteristics (e.g., length, randomness).

🔒 Proposed improvement for SESSION_SECRET guidance
-SESSION_SECRET=your_session_secret
+SESSION_SECRET=your_random_session_secret_min_32_characters

Additionally, consider adding a comment above this line:

+# Generate a secure random string (min 32 characters). Example: openssl rand -base64 32
 SESSION_SECRET=your_random_session_secret_min_32_characters
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.env.example at line 5, Update the SESSION_SECRET example to clearly require
a strong, random secret: replace the generic placeholder "your_session_secret"
with a descriptive value indicating length and randomness (e.g., "32+ char
random string, use a secure generator") and add a short preceding comment
recommending using a cryptographically secure random value (at least 32
characters) and not committing it to source control; reference the
SESSION_SECRET entry so the change is applied to that line.

Comment thread README.md
```
## Environment Variables

Create a `.env` file in the project root and add the following variables:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Reference the .env.example file to streamline setup.

The instruction should mention copying the .env.example file as a starting point, rather than creating the .env file from scratch. This aligns with the PR's addition of the .env.example file and makes setup easier.

📝 Proposed improvement
-Create a `.env` file in the project root and add the following variables:
+Create a `.env` file in the project root by copying `.env.example` and configure the following variables:
+
+```bash
+cp .env.example .env
+```
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Create a `.env` file in the project root and add the following variables:
Create a `.env` file in the project root by copying `.env.example` and configure the following variables:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 85, Replace the sentence "Create a `.env` file in the
project root and add the following variables:" in README.md with instructions to
copy the provided `.env.example` as the starting point (e.g., mention copying
`.env.example` to `.env`) and then edit values as needed; reference the
`.env.example` filename explicitly so readers use that template rather than
creating `.env` from scratch.

Comment thread README.md
Comment on lines +87 to +93
| Variable | Description |
|----------|-------------|
| PORT | Port on which the backend server runs |
| MONGO_URI | MongoDB connection string |
| SESSION_SECRET | Secret key used for session management |
| NODE_ENV | Application environment |
| LOG_LEVEL | Logging level |
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win

Enhance variable descriptions with more helpful details.

The descriptions are quite brief and lack important details that would help contributors configure the application correctly. Consider adding:

  • Valid values for categorical variables (NODE_ENV, LOG_LEVEL)
  • Format examples or requirements (MONGO_URI, SESSION_SECRET)
  • Default values where applicable
📋 Proposed improvement
 | Variable | Description |
 |----------|-------------|
-| PORT | Port on which the backend server runs |
-| MONGO_URI | MongoDB connection string |
-| SESSION_SECRET | Secret key used for session management |
-| NODE_ENV | Application environment |
-| LOG_LEVEL | Logging level |
+| PORT | Port on which the backend server runs (default: 5000) |
+| MONGO_URI | MongoDB connection string (e.g., `mongodb://localhost:27017/github_tracker`) |
+| SESSION_SECRET | Secret key for session management (min 32 characters, use a randomly generated string) |
+| NODE_ENV | Application environment (`development`, `production`, or `test`) |
+| LOG_LEVEL | Logging verbosity level (`error`, `warn`, `info`, `debug`) |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 87 - 93, The environment variable table entries
(PORT, MONGO_URI, SESSION_SECRET, NODE_ENV, LOG_LEVEL) are too terse—update each
description to include expected formats, examples and defaults: specify PORT as
an integer with a default (e.g., 3000), MONGO_URI with a connection string
format example (mongodb://user:pass@host:port/db) and required auth/replica set
notes, SESSION_SECRET with minimum length/entropy guidance or example
placeholder and note that it must be set in production, NODE_ENV with allowed
values (development|production|test) and default, and LOG_LEVEL with allowed
values (error|warn|info|debug|trace) and default; edit the README table rows for
the symbols PORT, MONGO_URI, SESSION_SECRET, NODE_ENV, and LOG_LEVEL to include
these details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Environment Variables Documentation to README

1 participant