From 86a011e7831199db38431fce48a53efa0fc7c3c0 Mon Sep 17 00:00:00 2001 From: Udaykiran Date: Mon, 28 Jul 2025 18:24:29 +0530 Subject: [PATCH] atribot --- README.md | 44 ++---------------------------------------- lib/auth-client.ts | 2 +- netlify.toml | 23 ++++++++++++++++++++++ next.config.ts | 48 +++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 73 insertions(+), 44 deletions(-) create mode 100644 netlify.toml diff --git a/README.md b/README.md index ce1d87c..270930b 100644 --- a/README.md +++ b/README.md @@ -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. -## 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. diff --git a/lib/auth-client.ts b/lib/auth-client.ts index 000a5cf..31ead70 100644 --- a/lib/auth-client.ts +++ b/lib/auth-client.ts @@ -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() ] diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..6e994f1 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,23 @@ +[build] + command = "npm run build" + publish = ".next" + +[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" diff --git a/next.config.ts b/next.config.ts index e9ffa30..ee972c0 100644 --- a/next.config.ts +++ b/next.config.ts @@ -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' }, + ] + } + ] + }, + // 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;