A simple app to manage office attendance and receive updates.
make installmake startmake seedYou can generate VAPID keys using the following command:
npm install -g web-push
web-push generate-vapid-keysAdd them to your environment variables:
NEXT_PUBLIC_VAPID_PUBLIC_KEY=<your-public-key>
VAPID_PRIVATE_KEY=<your-private-key>
VAPID_SUBJECT=<your-subject>The application validates user email addresses against a configured domain to restrict registration.
Add the allowed email domain to your .env file:
NEXT_PUBLIC_ALLOWED_EMAIL_DOMAIN=yourdomain.comThis environment variable is used for:
- Client-side form validation and UI placeholders
- Server-side signup validation
- Database configuration sync
The email domain validation is also enforced at the database level. After setting the environment variable, you need to sync it to the database:
-
During seeding (recommended for development):
make seed
The seed script automatically updates the database configuration.
-
Manual update (for production or when changing domains): You can update the database configuration by calling the sync function in your application or directly in the database:
INSERT INTO public.app_config (key, value, description) VALUES ('allowed_email_domain', 'yourdomain.com', 'Email domain required for user registration') ON CONFLICT (key) DO UPDATE SET value = EXCLUDED.value, updated_at = NOW();
Once configured, the application will:
- Only allow user registration with emails ending in
@yourdomain.com - Show the configured domain in the signup form placeholder
- Enforce validation both client-side and server-side
- Block registration attempts at the database level
Note: Both the environment variable and database configuration must match for proper functionality.
make testmake storybookSupabase invite emails send a magic link including token_hash and type.
-
Ensure the confirm route is configured in Supabase Auth → URL Configuration:
- Site URL:
https://<your-domain> - Redirect URLs: include
/auth/confirm
- Site URL:
-
In the email template (Invite user), set the action URL to point to
/auth/confirmwithnextto a local set-password page, e.g.:${SITE_URL}/auth/confirm?token_hash={{ .TokenHash }}&type={{ .Type }}&next=/auth/set-password -
Our
/auth/confirmhandler verifies the token and redirects tonextif valid. -
The
/auth/set-passwordpage lets the user set their password via a server action callingsupabase.auth.updateUser({ password }).
Licensed under the MIT license.