Deployment
Author: Daniel Bier
The OpenEU Frontend is deployed on Netlify, providing continuous deployment from the GitHub repository with automatic previews for pull requests and deployments from the main branch.
๐ Deployment Targetsโ
- Netlify โ Primary deployment platform
- Website: https://openeu.netlify.app
- Custom domain: https://openeu.csee.tech
- Automatic deployments from the
mainbranch - Preview deployments for pull requests
Screenshot of the Netlify production domain configuration for OpenEU
๐ Environment Variablesโ
The following environment variables are required for the application to function properly:
| Variable | Description |
|---|---|
NEXT_PUBLIC_API_URL | Backend API endpoint URL |
NEXT_PUBLIC_SUPABASE_URL | Supabase project URL |
NEXT_PUBLIC_SUPABASE_ANON_KEY | Supabase anonymous key for client-side access |
Setting up Environment Variablesโ
Local Developmentโ
- Create a
.envfile in the root directory of the project - Add the required variables:
NEXT_PUBLIC_SUPABASE_URL="YOUR_SUPABASE_URL"
NEXT_PUBLIC_SUPABASE_ANON_KEY="YOUR_SUPABASE_ANON_KEY"
NEXT_PUBLIC_API_URL="URL_TO_BACKEND_API"
Netlify Deploymentโ
- Navigate to your site settings in the Netlify dashboard
- Go to Site settings โ Environment variables
- Add each required variable with its corresponding value
- Redeploy your site for the changes to take effect
๐ Supabase Integrationโ
Supabase is used for authentication, database, and storage in the OpenEU Frontend.
Setting up Supabaseโ
- Create a Supabase project at supabase.com
- Obtain your project URL and anon key from the API settings
- Set up database tables and functions as provided in the backend repo
Authentication Flowโ
- The frontend uses Supabase's client library to handle authentication
- User sessions are managed through Supabase's session management
- Protected routes check for valid authentication before rendering
๐ Deployment Processโ
๐ Continuous Integration/Continuous Deployment (CI/CD)โ
The project uses GitHub Actions for CI and Netlify for CD:
- Pull requests trigger lint and type checks via GitHub Actions
- Netlify deploys preview environments for each PR
- When merged to main, the Netlify deployment is triggered
Deployment Configurationโ
The project includes a next.config.ts file that configures Next.js for deployment, including:
- Image optimization settings
- Redirects and rewrites
- Static file handling
๐งช Environment-Specific Considerationsโ
- Deployment uses Netlify environment variables
- Locally you can adjust the environment variables and API endpoints to point to the local instance of the backend and supabase