Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added env variable NEXT_PUBLIC_API_URL #245

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

OsoThevenin
Copy link
Contributor

@OsoThevenin OsoThevenin commented Nov 15, 2024

Description

Added env variable NEXT_PUBLIC_API_URL in .env.example files

Related Issues

Closes #<issue_number>

Checklist

  • My code follows the code style of this project.
  • I have performed a self-review of my code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation, if necessary.
  • I have added tests that prove my fix is effective or my feature works.
  • New and existing tests pass locally with my changes.

Screenshots (if applicable)

Additional Notes

I find it useful for me to query the API from web and app

Summary by CodeRabbit

  • New Features

    • Introduced a new environment variable NEXT_PUBLIC_API_URL for client-side applications, allowing configuration of the API endpoint.
  • Chores

    • Moved the existing NEXT_PUBLIC_DOCS_URL variable to a new line without changing its value.

Copy link

vercel bot commented Nov 15, 2024

@OsoThevenin is attempting to deploy a commit to the Hayden Bleasel Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

coderabbitai bot commented Nov 15, 2024

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • .github/workflows/build.yml is excluded by none and included by none

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes introduce a new environment variable NEXT_PUBLIC_API_URL set to http://localhost:3002 in the .env.example files of three applications: api, app, and web. Additionally, the existing variable NEXT_PUBLIC_DOCS_URL is moved to a new line in the api application's .env.example file, but its value remains unchanged. The overall structure of the environment variables is preserved across all files.

Changes

File Path Change Summary
apps/api/.env.example Added NEXT_PUBLIC_API_URL="http://localhost:3002"; moved NEXT_PUBLIC_DOCS_URL to a new line (value unchanged).
apps/app/.env.example Added NEXT_PUBLIC_API_URL="http://localhost:3002".
apps/web/.env.example Added NEXT_PUBLIC_API_URL="http://localhost:3002".

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 0

🧹 Outside diff range and nitpick comments (2)
apps/web/.env.example (1)

26-26: Document the purpose of NEXT_PUBLIC_API_URL.

Consider adding documentation about this environment variable's purpose and usage in the project's README or documentation.

Example documentation:

### Environment Variables

- `NEXT_PUBLIC_API_URL`: URL for the API service, used by web and app interfaces for making API requests.
apps/app/.env.example (1)

27-27: Document the API URL configuration

Since this is a new API endpoint configuration, ensure it's properly documented in the project's documentation.

Consider adding:

  • Purpose of the API endpoint
  • Expected configuration in different environments
  • Any specific requirements for local development

Would you like me to help create documentation for this new configuration?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d524760 and 13598a7.

⛔ Files ignored due to path filters (1)
  • packages/env/index.ts is excluded by none and included by none
📒 Files selected for processing (3)
  • apps/api/.env.example (1 hunks)
  • apps/app/.env.example (1 hunks)
  • apps/web/.env.example (1 hunks)
🔇 Additional comments (4)
apps/web/.env.example (1)

26-26: LGTM! Verify port availability.

The new environment variable follows the established naming conventions and is appropriately placed in the Client section. The localhost port pattern is consistent with other services.

Let's verify there are no port conflicts:

✅ Verification successful

Port 3002 is correctly assigned to the API service

The port 3002 is consistently used across the codebase for the API service:

  • Documented in docs/structure/apps.mdx as the designated port for the API service
  • Referenced in API's package.json for development server and Stripe webhook forwarding
  • Mentioned in setup documentation as the API endpoint
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any other services using port 3002 in the codebase

# Search for other occurrences of port 3002
rg -g '!*.env*' '3002'

# Search for docker-compose files that might define services
fd 'docker-compose' --exec cat {}

Length of output: 496

apps/app/.env.example (1)

27-27: Verify port 3002 availability across the application stack

The addition of NEXT_PUBLIC_API_URL follows proper naming conventions and is correctly placed in the Client section. However, let's ensure port 3002 doesn't conflict with other services.

✅ Verification successful

Port 3002 is correctly assigned and documented for the API service

The verification confirms that port 3002 is:

  • Documented in docs/setup.mdx and docs/structure/apps.mdx as the designated port for the API service
  • Configured in apps/api/package.json for both the Next.js dev server and Stripe webhook forwarding
  • No port conflicts found with other services in the codebase
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any other services using port 3002 in the codebase
# and verify documentation of port usage

# Search for other occurrences of port 3002
rg -g '!*.env*' '3002'

# Check if ports are documented in README or similar files
fd -g 'README*' -X cat
fd -g 'CONTRIBUTING*' -X cat

Length of output: 1232

apps/api/.env.example (2)

27-28: LGTM! Changes follow environment variable best practices

The changes look good:

  • Logical grouping with other NEXT_PUBLIC_ variables
  • Consistent use of localhost URLs in example file
  • Clear and descriptive variable naming

27-28: Verify the purpose of duplicate localhost:3002 URLs

I notice that both NEXT_PUBLIC_API_URL and NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL are set to "http://localhost:3002". Could you clarify if these serve different purposes? If they're meant for the same thing, we might want to consolidate them to avoid confusion.

Let's check how these variables are used across the codebase:

✅ Verification successful

These environment variables serve distinct purposes - no consolidation needed

Based on the codebase analysis, these variables have different use cases:

  • NEXT_PUBLIC_API_URL is used for API schema validation and configuration in the env package
  • NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL is specifically used for:
    • Generating sitemap URLs in web app
    • Setting canonical URLs for blog posts
    • Configuring robots.txt
    • As documented, it's automatically provided by Vercel for production deployments

The duplicate localhost URL in the example file is just a development placeholder and doesn't indicate an actual conflict in production usage.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usages of both environment variables to understand their distinct purposes
echo "Searching for NEXT_PUBLIC_API_URL usage:"
rg "NEXT_PUBLIC_API_URL" -A 2

echo -e "\nSearching for NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL usage:"
rg "NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL" -A 2

Length of output: 2698

Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
next-forge ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 5:01pm

@haydenbleasel
Copy link
Owner

@OsoThevenin Is this env var required anywhere currently? Or is it just future-facing?

@OsoThevenin
Copy link
Contributor Author

@haydenbleasel this is future-facing. I thought it could be useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants