Skip to content

docs: add environment variables documentation and example file for backend setup#711

Open
firoziya wants to merge 3 commits into
GitMetricsLab:mainfrom
firoziya:main
Open

docs: add environment variables documentation and example file for backend setup#711
firoziya wants to merge 3 commits into
GitMetricsLab:mainfrom
firoziya:main

Conversation

@firoziya
Copy link
Copy Markdown
Contributor

@firoziya firoziya commented Jun 4, 2026

Related Issue


Description

This PR addresses the missing documentation for backend environment variables, which currently causes setup friction for new contributors.

Changes Made:

  1. Updated README.md: Added a dedicated "🔐 Environment Variables" section under the Setup Guide, including a table explaining each variable (MONGO_URI, SESSION_SECRET, PORT, LOG_LEVEL).
  2. Created backend/.env.example: Provides a template file with placeholder values that contributors can copy to .env.

These changes align with the issue's suggestions and will significantly improve the local development setup experience.


How Has This Been Tested?

  • Documentation: Verified that the markdown formatting renders correctly in a local preview.
  • .env.example: Confirmed that all variable names match those used in backend/server.js and backend/config/passportConfig.js.
  • Process: Manually simulated a contributor's setup by copying .env.example to .env, populating dummy values, and successfully starting the backend server.

Screenshots (if applicable)

New README Section Preview:
image

New .env.example file:

# Backend Environment Variables

# MongoDB Connection URI (required)
MONGO_URI=mongodb://127.0.0.1:27017/github_tracker

# Session Secret for express-session (required - use a strong random string)
SESSION_SECRET=your_super_secret_key_change_this_in_production

# Server Port (optional, defaults to 5000)
PORT=5000

# Log Level (optional: debug, info, warn, error)
LOG_LEVEL=debug

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

## Summary by CodeRabbit

* **Documentation**
  * Added a comprehensive environment variables configuration guide with step-by-step setup instructions for creating the required backend configuration file.
  * Included a pre-configured environment variables template containing all necessary settings for database connectivity and session management, along with optional configurations for server port and logging level.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 4, 2026

Deploy Preview for github-spy ready!

Name Link
🔨 Latest commit fc67e0e
🔍 Latest deploy log https://app.netlify.com/projects/github-spy/deploys/6a215b0f70ab740008687f61
😎 Deploy Preview https://deploy-preview-711--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 4, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds documentation and a template for backend environment variables to improve contributor onboarding. A new README section lists required and optional configuration variables alongside their defaults, and a corresponding backend/.env.example file provides a ready-to-use template with comments and example values.

Changes

Environment Variables Setup

Layer / File(s) Summary
Environment Variables Documentation and Template
backend/.env.example, README.md
README introduces an "Environment Variables" section documenting MONGO_URI, SESSION_SECRET, PORT, and LOG_LEVEL with descriptions and defaults. .env.example provides a commented template with example values for each variable, instructing users to copy from this template.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Hop along, dear contributor mine,
Variables all in a row, so fine!
Copy from .env, a template divine,
MongoDB, secrets, and logs align!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding environment variables documentation and an example file for backend setup.
Description check ✅ Passed The description comprehensively covers all template sections with detailed changes, testing methodology, screenshots, and type of change marked as documentation update.
Linked Issues check ✅ Passed All requirements from issue #675 are met: Environment Variables section added to README with variable explanations, backend/.env.example file created with required variables and values.
Out of Scope Changes check ✅ Passed All changes are directly related to issue #675 objectives: README documentation and .env.example file for environment variable setup.
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.

🧹 Nitpick comments (1)
backend/.env.example (1)

14-14: 💤 Low value

Add trailing newline at end of file.

The file should end with a newline character per POSIX convention. This prevents diff noise and potential linter warnings.

📝 Proposed fix
 # Log Level (optional: debug, info, warn, error)
 LOG_LEVEL=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 `@backend/.env.example` at line 14, The file backend/.env.example is missing a
trailing newline; update the file so it ends with a single newline character
(ensure your editor saves a newline at EOF or add one in your commit) to satisfy
POSIX conventions and remove diff/linter noise.
🤖 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.

Nitpick comments:
In `@backend/.env.example`:
- Line 14: The file backend/.env.example is missing a trailing newline; update
the file so it ends with a single newline character (ensure your editor saves a
newline at EOF or add one in your commit) to satisfy POSIX conventions and
remove diff/linter noise.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f65f2cd9-36c0-45b5-8df5-3081ad507967

📥 Commits

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

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

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