-
Notifications
You must be signed in to change notification settings - Fork 42
atribot #1
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
base: main
Are you sure you want to change the base?
atribot #1
Conversation
WalkthroughThe updates introduce a new Netlify deployment configuration, overhaul the Next.js project configuration with enhanced image, CORS, and server action settings, and update the authentication client to use a dynamic base URL. The README is rewritten to reflect a new project name and description, replacing the previous documentation. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant AuthClient
participant Env
Client->>AuthClient: Initialize authClient
AuthClient->>Env: Read NEXT_PUBLIC_BASE_URL
alt Env variable set
AuthClient->>Client: Use NEXT_PUBLIC_BASE_URL as baseURL
else Env variable not set
AuthClient->>Client: Use "http://localhost:3000" as baseURL
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
🧹 Nitpick comments (3)
next.config.ts (2)
28-34: Review server actions configuration for production readiness.The server actions configuration has a few considerations:
bodySizeLimit: '2mb'may be restrictive for file uploadsallowedOriginsincludes both localhost and production domains without protocol specificationConsider this adjustment for more explicit origin handling:
experimental: { serverActions: { bodySizeLimit: '2mb', - allowedOrigins: ['localhost:3000', 'atribot.com'] + allowedOrigins: [ + process.env.NODE_ENV === 'production' + ? 'https://atribot.com' + : 'http://localhost:3000' + ] }, },
35-42: Consider the trade-off of ignoring ESLint during builds.While
ignoreBuildErrors: falsefor TypeScript is good practice,ignoreDuringBuilds: truefor ESLint might hide important code quality issues in production builds.README.md (1)
1-6: Consider expanding documentation for better developer experience.While the minimal description serves its purpose, consider adding basic setup instructions, environment variable requirements, or development commands to help other developers get started with the project.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
README.md(1 hunks)lib/auth-client.ts(1 hunks)netlify.toml(1 hunks)next.config.ts(1 hunks)
🧰 Additional context used
🪛 LanguageTool
README.md
[grammar] ~3-~3: Ensure spelling is correct
Context: # AtriBot AtriBot is a robotics learing platform. It is built using Next.js, Dr...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (6)
next.config.ts (2)
4-6: LGTM! Image domains properly configured for OAuth providers.The allowed domains for Google and GitHub avatars are correctly configured for typical OAuth authentication flows.
45-51: LGTM! Netlify configuration properly handles static export requirements.The conditional Netlify configuration correctly switches to export mode and disables image optimization, which is required for static deployments.
lib/auth-client.ts (1)
5-5: LGTM! Environment-based baseURL configuration is correctly implemented.The use of
NEXT_PUBLIC_BASE_URLfollows Next.js conventions for client-side environment variables, and the fallback to localhost is appropriate for development.netlify.toml (3)
5-7: LGTM! Build environment properly configured.Node.js version 20 and legacy peer deps flag are appropriate for modern Next.js projects with potential dependency conflicts.
12-15: LGTM! API redirect configuration supports Next.js API routes.The redirect rule properly handles API routes for the exported static site on Netlify.
17-23: LGTM! Security headers follow best practices.The security headers provide good protection against common web vulnerabilities:
- X-Frame-Options prevents clickjacking
- X-Content-Type-Options prevents MIME sniffing
- X-XSS-Protection enables XSS filtering
- Referrer-Policy controls referrer information leakage
| [build] | ||
| command = "npm run build" | ||
| publish = ".next" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verify publish directory matches Next.js export configuration.
The publish directory is set to .next, but when using output: 'export' in Next.js (as configured for Netlify), the output directory is typically out. This mismatch could cause deployment issues.
#!/bin/bash
# Description: Check Next.js documentation for correct export output directory
# Expected: Should clarify the correct publish directory for export mode
echo "Checking for Next.js export output configuration..."
rg -A 5 -B 5 "output.*export" --type ts --type jsConsider updating the publish directory:
[build]
command = "npm run build"
- publish = ".next"
+ publish = "out"🤖 Prompt for AI Agents
In netlify.toml lines 1 to 3, the publish directory is set to ".next" which
conflicts with Next.js export mode that outputs to the "out" directory. Update
the publish directory value from ".next" to "out" to align with the Next.js
export configuration and ensure proper deployment.
| async headers() { | ||
| return [ | ||
| { | ||
| source: '/api/:path*', | ||
| headers: [ | ||
| { key: 'Access-Control-Allow-Credentials', value: 'true' }, | ||
| { | ||
| key: 'Access-Control-Allow-Origin', | ||
| value: process.env.NODE_ENV === 'production' | ||
| ? 'https://atribot.com' | ||
| : 'http://localhost:3000' | ||
| }, | ||
| { key: 'Access-Control-Allow-Methods', value: 'GET,OPTIONS,PATCH,DELETE,POST,PUT' }, | ||
| { key: 'Access-Control-Allow-Headers', value: 'X-Requested-With, X-Auth-Token, Content-Type, Authorization' }, | ||
| ] | ||
| } | ||
| ] | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Verify CORS configuration aligns with actual deployment domains.
The CORS setup looks comprehensive, but ensure the production origin matches your actual domain. The configuration currently uses 'https://atribot.com' - verify this is the correct production URL.
🏁 Script executed:
#!/bin/bash
# Description: Check if atribot.com domain is referenced consistently across the codebase
# Expected: Should find consistent usage of the domain
echo "Searching for domain references in the codebase..."
rg -i "atribot\.com" --type-add 'config:*.{ts,js,json,toml,md}' -t configLength of output: 310
Ensure CORS domains are consistent across configurations
We found two references to your production domain in the codebase:
- In next.config.ts headers() – production origin set to
'https://atribot.com' - In an allowedOrigins array – listed as
['localhost:3000', 'atribot.com']
To avoid mismatches (since browsers send the Origin header with protocol), update the allowedOrigins entry to use full origin strings. For example:
- allowedOrigins: ['localhost:3000', 'atribot.com']
+ allowedOrigins: ['http://localhost:3000', 'https://atribot.com']This keeps your CORS checks in sync with the values returned by headers().
Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In next.config.ts between lines 7 and 24, the production origin in the headers()
method uses the full origin string 'https://atribot.com', but the allowedOrigins
array elsewhere lists 'atribot.com' without the protocol. To fix this, update
the allowedOrigins array to use full origin strings including the protocol
(e.g., 'https://atribot.com' and 'http://localhost:3000') to ensure consistency
with the headers() configuration and avoid CORS mismatches.
| # AtriBot | ||
|
|
||
|  | ||
| AtriBot is a robotics learing platform. It is built using Next.js, Drizzle, Neon, and Better Auth. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix spelling error in project description.
There's a typo in "learing" which should be "learning".
-AtriBot is a robotics learing platform. It is built using Next.js, Drizzle, Neon, and Better Auth.
+AtriBot is a robotics learning platform. It is built using Next.js, Drizzle, Neon, and Better Auth.📝 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.
| AtriBot is a robotics learing platform. It is built using Next.js, Drizzle, Neon, and Better Auth. | |
| AtriBot is a robotics learning platform. It is built using Next.js, Drizzle, Neon, and Better Auth. |
🧰 Tools
🪛 LanguageTool
[grammar] ~3-~3: Ensure spelling is correct
Context: # AtriBot AtriBot is a robotics learing platform. It is built using Next.js, Dr...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🤖 Prompt for AI Agents
In README.md at line 3, correct the spelling mistake in the project description
by changing "learing" to "learning" to accurately describe the platform as a
robotics learning platform.
_s
Summary by CodeRabbit
New Features
Chores