Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 2 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,5 @@
# Better Auth Starter
# AtriBot

![ChatGPT Image Jun 9, 2025, 07_09_10 PM](https://github.com/user-attachments/assets/660133ca-5463-4c77-9ece-37280caa229c)
AtriBot is a robotics learing platform. It is built using Next.js, Drizzle, Neon, and Better Auth.
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

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.

Suggested change
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.


## Overview

The Better Auth Starter is simple starter pack using Next.js, Better Auth, Shadcn, Drizzle, and Neon

## Getting Started

### Installation

To begin, install the required dependencies using the following command:

```bash
pnpm i
```

### Configuration

Create a copy of the provided `env.example` file and name it `.env`. Fill in the required OpenAI API Key in the newly created `.env` file, and Better Auth variables if you're going to use authentication:

`cp env.example .env`

```bash
BETTER_AUTH_SECRET="your-better-auth-secret"
BETTER_AUTH_URL="http://localhost:3000"

DATABASE_URL="your-database-url"

GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
```

Make sure to replace placeholder values with your actual API keys, and keep them safe!

# Development Server

After installing the dependencies, and adding configuration variables run the development server:

```bash
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
2 changes: 1 addition & 1 deletion lib/auth-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { organizationClient } from "better-auth/client/plugins";
import { createAuthClient } from "better-auth/react";

export const authClient = createAuthClient({
baseURL: "http://localhost:3000",
baseURL: process.env.NEXT_PUBLIC_BASE_URL || "http://localhost:3000",
plugins: [
organizationClient()
]
Expand Down
23 changes: 23 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[build]
command = "npm run build"
publish = ".next"
Comment on lines +1 to +3
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

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 js

Consider 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.


[build.environment]
NODE_VERSION = "20"
NPM_FLAGS = "--legacy-peer-deps"

[[plugins]]
package = "@netlify/plugin-nextjs"

[[redirects]]
from = "/api/*"
to = "/api/:splat"
status = 200

[[headers]]
for = "/*"
[headers.values]
X-Frame-Options = "DENY"
X-Content-Type-Options = "nosniff"
X-XSS-Protection = "1; mode=block"
Referrer-Policy = "strict-origin-when-cross-origin"
48 changes: 47 additions & 1 deletion next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,53 @@
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
/* config options here */
images: {
domains: ['lh3.googleusercontent.com', 'avatars.githubusercontent.com'],
},
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' },
]
}
]
},
Comment on lines +7 to +24
Copy link

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 config

Length 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.

// Disable static optimization for all pages
output: 'standalone',
// Configure page revalidation (ISR)
experimental: {
// Enable server actions
serverActions: {
bodySizeLimit: '2mb',
allowedOrigins: ['localhost:3000', 'atribot.com']
},
},
typescript: {
// Skip TypeScript checking during build to catch errors earlier
ignoreBuildErrors: false,
},
eslint: {
// Don't fail build on ESLint errors
ignoreDuringBuilds: true
},
};

// For Netlify deployment
if (process.env.NETLIFY === 'true') {
nextConfig.output = 'export';
nextConfig.images = {
unoptimized: true,
};
}

export default nextConfig;