A production-ready starter template for Angular applications with Supabase authentication. Includes Google OAuth, email magic link login, a functional auth guard, PWA support, and GitHub Pages deployment.
| Layer | Technology |
|---|---|
| Framework | Angular 21 — standalone components, signals, @for control |
| Styling | SCSS |
| Auth | Supabase — Google OAuth + Magic Link |
| PWA | @angular/pwa — service worker, web app manifest |
| Hosting | GitHub Pages (via GitHub Actions) |
| Unit Tests | Vitest + jsdom |
| E2E Tests | Playwright |
| Language | TypeScript ~5.9 |
| Runtime | Node.js 22 / npm 10 |
git clone https://github.com/your-org/angular-supabase-template.git my-app
cd my-app
npm install- Go to supabase.com and create a new project.
- Under Auth → URL Configuration, add the following to the Redirect URLs allow-list:
https://your-domain.com/login/callbackhttp://localhost:4200/login/callback
- In your project's Auth → Providers settings, enable Google and note the Callback URL (for OAuth) shown — you will need it in the next step.
- Go to console.cloud.google.com and create a new project (or select an existing one).
- Navigate to APIs & Services → OAuth consent screen:
- Choose External user type (unless this is an internal Google Workspace app).
- Fill in the required fields: App name, User support email, and Developer contact email.
- Add the scope
openid,email, andprofileunder Scopes (these are added by default for most apps). - Add your production domain under Authorized domains (e.g.
your-domain.com). - Save and continue through the remaining screens.
- Navigate to APIs & Services → Credentials and click Create Credentials → OAuth 2.0 Client ID:
- Application type: Web application
- Under Authorized redirect URIs, add the Supabase callback URL from step 2.3 (it looks like
https://<project-id>.supabase.co/auth/v1/callback). - Click Create and copy the generated Client ID and Client Secret.
- Back in the Supabase dashboard under Auth → Providers → Google, paste the Client ID and Client Secret, then save.
Update both environment files with your Supabase credentials and app URL:
src/environments/environment.ts (local dev):
export const environment = {
production: false,
supabase: {
url: 'https://your-project-id.supabase.co',
anonKey: 'your-supabase-anon-key',
},
appUrl: 'http://localhost:4200',
};src/environments/environment.prod.ts (production):
export const environment = {
production: true,
supabase: {
url: 'https://your-project-id.supabase.co',
anonKey: 'your-supabase-anon-key',
},
appUrl: 'https://your-domain.com',
};Your Supabase project URL and anon key are found in Project Settings → API.
Replace angular-supabase-template with your project name in:
package.json—"name"fieldangular.json— project key andbuildTargetreferences.github/workflows/deploy.yml—dist/angular-supabase-template/browserpathssrc/index.html—<title>tagpublic/manifest.webmanifest—"name"and"short_name"fields
The login page heading is in src/app/features/login/login-page.html:
<h1 id="login-heading">Sign in</h1>Update this to match your app name.
Add your logo to the public/ folder and reference it in your components. A placeholder SVG (public/logo.svg) is included.
Replace the icons in public/icons/ with your own app icons (72×72 through 512×512 PNG files).
npm start # Dev server → http://localhost:4200
npm test # Unit tests (Vitest, watch mode)
npm run test:e2e # Playwright e2e tests (starts dev server automatically)
ng build # Production build → dist/angular-supabase-templateThe included GitHub Actions workflow (.github/workflows/deploy.yml) builds and deploys to GitHub Pages on every push to main.
Required setup:
- In your GitHub repo, go to Settings → Pages and set the source to GitHub Actions.
- The
public/CNAMEfile contains the custom domain — update it with your domain or delete it if using the default*.github.iodomain.
src/
app/
core/
auth/
authentication.service.ts # Supabase auth methods (Google OAuth, magic link, session)
auth.guard.ts # Route guard — redirects unauthenticated users to /login
redirect-destination.ts # Stores/restores post-login redirect path in sessionStorage
supabase.provider.ts # Provides the SupabaseClient via DI
features/
login/
login-page.ts / .html # Combined login page (Google OAuth + magic link form)
auth-callback-page.ts # Handles OAuth/magic-link callback, exchanges code for session
login.routes.ts # Route definitions for /login and /login/callback
home/ # Placeholder home page (replace with your app content)
environments/
environment.ts # Dev environment config
environment.prod.ts # Production environment config
| Setting | Location |
|---|---|
| Supabase project URL | src/environments/environment*.ts |
| Supabase anon key | src/environments/environment*.ts |
| Production app URL | src/environments/environment.prod.ts → appUrl |
| App title | src/index.html, public/manifest.webmanifest |
| Project name (build output) | package.json, angular.json, .github/workflows/deploy.yml |
| GitHub Pages custom domain | public/CNAME |
| OAuth redirect URLs | Supabase dashboard → Auth → URL Configuration |
| Google OAuth credentials | Google Cloud Console + Supabase Auth → Providers |
| Login page heading | src/app/features/login/login-page.html |
| PWA icons | public/icons/ |
| Logo | public/logo.svg (replace with your own) |