This project template provides the backend for developing a React Native application with Expo and Supertokens to authenticate. It is built with Nestjs and Supertokens.
- Sign in with Apple, GitHub, Google, or Email and Password: The authentication flow supports multiple sign-in options using Supertokens.
- Role Management: You can manage user roles and permissions within your application using Supertokens.
- Change Password, Verify E-Mail and Delete Account Views: Connect your app to a website by adding support for deep linking.
- Handlebars E-Mail Templates: It utilizes Expo Router, a versatile routing solution for navigating between screens in your application.
To use this template, follow the steps below:
- Install dependencies
pnpm install
- Configure the Supertokens Backend with your authentication providers (Apple, GitHub, Google, etc.)
- Setup environment variables:
-
cp ./apps/api.env.example ./apps/api/.env
-
Update the necessary environment variables for Supertokens configuration. For example:
SUPERTOKENS_CONNECTION_URI=your-supertokens-connection-uri SUPERTOKENS_API_KEY=your-supertokens-api-key ACCOUNT_JWT_SECRET=custom-jwt-secret # jwt secret for delete account token RESEND_API_KEY=your-resend-api-key # Get this from https://resend.com/api-keys EMAIL_FROM=test@example.com
- Start the app
pnpm run api
To configure Supertokens with your authentication providers, follow the documentation provided by Supertokens. This typically involves registering your app with each provider and obtaining API keys or tokens required for authentication.
Generate a private key for your Apple App ID. You can find more information about this here.
APPLE_CLIENT_ID=your-apple-client-id
APPLE_PRIVATE_KEY=your-apple-private-key
APPLE_TEAM_ID=your-apple-team-id
APPLE_KEY_ID=your-apple-key-id
Register your app with GitHub and obtain a client ID and secret. You can find more information about this here.
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
Register your app with Google and obtain a client ID and secret. You can find more information about this here.
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
Customizing the E-Mails in the template is easy. Simply edit the Handlebars templates in the ./emails/auth
folder. For Updating the HTML views, edit the files in the ./views/auth
folder.
For iOS, you need to setup the Apple App site association (ASA) file. This is required for deep linking to work on iOS. The File can be found in the ./public/.well-known
folder. You can find more information about this here.