Environment Variables
The MC World Compressor Frontend requires environment variables to connect to the backend API.Creating the .env File
Create a.env file in the root of your project:
.env
NEXT_PUBLIC_BACKEND_URL
This is the primary environment variable used by the application:- Purpose: Points to the backend API that handles world compression
- Format: Full URL including protocol (http:// or https://)
- Access: Available in both client and server components (prefixed with
NEXT_PUBLIC_)
HTTPS Requirements
Example scenarios:| Frontend Protocol | Backend Protocol | Result |
|---|---|---|
| HTTP (localhost) | HTTP | ✅ Works |
| HTTPS (production) | HTTPS | ✅ Works |
| HTTPS (production) | HTTP | ❌ Blocked by browser |
Next.js Configuration
The Next.js configuration is minimal and uses default settings:next.config.mjs
- App Router enabled by default
- React Server Components enabled
- Automatic code splitting
- Image optimization via
next/image - Font optimization via
next/font
TailwindCSS Configuration
The project uses TailwindCSS v4 with PostCSS integration.PostCSS Configuration
postcss.config.mjs
Global Styles
TailwindCSS is imported inapp/globals.css:
app/globals.css
TailwindCSS v4 uses a simplified configuration approach. Instead of a separate
tailwind.config.js file, styles are configured directly through the CSS import.Path Aliases
Path aliases are configured injsconfig.json:
jsconfig.json
@/ as a shortcut to the root directory:
Sitemap Configuration
The project includes sitemap generation vianext-sitemap:
- Configured in
next-sitemap.config.js - Runs automatically after build (
postbuildscript) - Generates
sitemap.xmlandrobots.txt
Middleware
The project uses Next.js middleware for internationalization routing:- Located at
middleware.js - Handles locale detection and routing
- Supports EN, ES, HI, and AR languages
