Environment Variables
EpiNeko requires specific environment variables to function properly. All configuration is stored in.env.local at the root of your project.
Required Variables
1
Get Supabase URL
- Go to app.supabase.com
- Select your project
- Navigate to Settings > API
- Copy the “Project URL”
2
Get Anon Key
- In the same API settings page
- Copy the “anon public” key
- This key is safe to use in the browser
3
Create .env.local
Create the file in your project root and paste both values
4
Restart Development Server
Changes to environment variables require a server restart
The
NEXT_PUBLIC_ prefix makes these variables available to the browser. This is required for client-side Supabase operations.Optional Variables
Add these for enhanced functionality:.env.local
Next.js Configuration
Thenext.config.ts file controls Next.js behavior and optimization settings.
Current Configuration
Image Optimization
EpiNeko loads anime images from MyAnimeList CDN. The configuration allows Next.js Image component to optimize these external images:Why configure remote patterns?
Why configure remote patterns?
Next.js requires explicit configuration for external image domains to prevent abuse and ensure security. Without this configuration, images from MyAnimeList won’t load.
Adding Additional Image Sources
If you want to allow images from other sources:next.config.ts
Other Useful Next.js Options
TypeScript Strict Mode
TypeScript Strict Mode
Enable strict TypeScript checking:
React Strict Mode
React Strict Mode
Enable React strict mode for development:
Redirects & Rewrites
Redirects & Rewrites
Configure URL redirects:
Environment Variables
Environment Variables
Make server-side env vars available:
Supabase Configuration
Client Configuration
The Supabase clients are configured in the utility files with error handling:Advanced Supabase Options
Customize the Supabase client with additional options:Database Configuration
Row Level Security (RLS)
EpiNeko uses RLS to protect user data. The policies are configured in the migration file:Database Indexes
For better performance, consider adding indexes:Styling Configuration
Tailwind CSS
EpiNeko uses Tailwind CSS v4 with custom configuration. The configuration is minimal by design:tailwind.config.ts
DaisyUI Configuration
DaisyUI provides pre-built components. Configure themes intailwind.config.ts:
TypeScript Configuration
EpiNeko uses TypeScript with strict mode enabled:tsconfig.json
The
@/* path alias allows you to import from src/ using @/ instead of relative paths.Middleware Configuration
The middleware configuration controls which routes are protected:src/middleware.ts
Customizing Protected Routes
To add route-specific logic:src/middleware.ts
Production Configuration
Environment Variables for Production
When deploying, ensure these variables are set:Production .env
Build Optimization
Optimize your production build:next.config.ts
Vercel Deployment
EpiNeko is optimized for Vercel deployment:1
Connect Repository
Import your Git repository in Vercel dashboard
2
Configure Environment Variables
Add your Supabase credentials in the Vercel project settings
3
Deploy
Vercel automatically detects Next.js and deploys
Troubleshooting
Environment variables not loading
Environment variables not loading
Solution:
- Ensure
.env.localis in the project root - Restart the development server
- Check for typos in variable names
- Verify the
NEXT_PUBLIC_prefix for client-side variables
Images not loading
Images not loading
Solution:
- Verify
next.config.tsincludes the CDN hostname - Check that the hostname matches exactly (no trailing slash)
- Restart the dev server after config changes
Database connection issues
Database connection issues
Solution:
- Verify Supabase project is active
- Check API keys are correct
- Ensure RLS policies are properly configured
- Check Supabase service status
TypeScript errors
TypeScript errors
Solution:
- Run
npm installto ensure all types are installed - Delete
.nextfolder and rebuild - Check
tsconfig.jsonpaths configuration