File tree Expand file tree Collapse file tree 5 files changed +16
-291
lines changed
Expand file tree Collapse file tree 5 files changed +16
-291
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ services:
1717 - POSTGRES_URL=postgresql://postgres:postgres@db:5432/simstudio
1818 - BETTER_AUTH_URL=http://localhost:3000
1919 - NEXT_PUBLIC_APP_URL=http://localhost:3000
20- - NEXT_PUBLIC_DISABLE_AUTH=true
2120 depends_on :
2221 - db
2322 command : npm run dev
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ DATABASE_URL="postgresql://postgres:password@localhost:5432/postgres"
44# Authentication (Required)
55BETTER_AUTH_SECRET = your_secret_key # Use `openssl rand -hex 32` to generate, or visit https://www.better-auth.com/docs/installation
66BETTER_AUTH_URL = http://localhost:3000
7- # NEXT_PUBLIC_DISABLE_AUTH=true # Uncomment to disable authentication for local development
87
98# Email Provider (Optional)
109# RESEND_API_KEY= # Uncomment and add your key from https://resend.com to send actual emails
@@ -14,4 +13,4 @@ BETTER_AUTH_URL=http://localhost:3000
1413NEXT_PUBLIC_APP_URL = http://localhost:3000
1514
1615# StackBlitz (Webcontainer) API Key (Optional, for handling sandboxed code execution for functions/custom-tools)
17- WEBCONTAINER_CLIENT_ID = your_webcontainer_client_id
16+ # WEBCONTAINER_CLIENT_ID= # Uncomment and add your key from https://stackblitz.com/docs/webcontainer-api#webcontainer-client-id
Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ const resend =
1717 ? new Resend ( process . env . RESEND_API_KEY )
1818 : {
1919 emails : {
20- send : async ( ...args : any [ ] ) => logger . info ( 'Email sent:' , args ) ,
20+ send : async ( ...args : any [ ] ) => {
21+ logger . info ( 'Email would have been sent in production. Details:' , args )
22+ return { id : 'local-dev-mode' }
23+ } ,
2124 } ,
2225 }
2326
@@ -91,6 +94,17 @@ export const auth = betterAuth({
9194 throw new Error ( 'Email is required' )
9295 }
9396
97+ // In development with no RESEND_API_KEY, log verification code
98+ if ( ! process . env . RESEND_API_KEY || process . env . RESEND_API_KEY . trim ( ) === '' ) {
99+ logger . info ( '🔑 VERIFICATION CODE FOR LOGIN/SIGNUP' , {
100+ email : data . email ,
101+ otp : data . otp ,
102+ type : data . type ,
103+ } )
104+ return
105+ }
106+
107+ // In production, send an actual email
94108 const result = await resend . emails . send ( {
95109 from : 'Sim Studio <onboarding@simstudio.ai>' ,
96110 to : data . email ,
@@ -111,7 +125,6 @@ export const auth = betterAuth({
111125 logger . error ( 'Error sending verification code:' , {
112126 error,
113127 email : data . email ,
114- otp : data . otp ,
115128 } )
116129 throw error
117130 }
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -7,11 +7,6 @@ export async function middleware(request: NextRequest) {
77 return NextResponse . redirect ( new URL ( '/w/1' , request . url ) )
88 }
99
10- // Skip auth check if DISABLE_AUTH is set (for standalone mode)
11- if ( process . env . DISABLE_AUTH === 'true' || process . env . NEXT_PUBLIC_DISABLE_AUTH === 'true' ) {
12- return NextResponse . next ( )
13- }
14-
1510 const sessionCookie = getSessionCookie ( request )
1611 if ( ! sessionCookie ) {
1712 return NextResponse . redirect ( new URL ( '/login' , request . url ) )
You can’t perform that action at this time.
0 commit comments