Skip to content

chiabdel/delivery-app-react-expo-light

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

26 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ React Native Supabase Boilerplate 2025

Overview

A React Native 0.76+ starter kit with Expo, TypeScript, and Supabase Authentication, designed to speed up the creation of new projects. This template comes with ESLint, Prettier, Jest, and GitHub Actions, ensuring code quality and best practices.


๐Ÿ› ๏ธ Technologies

React Native Expo TypeScript Supabase Jest


๐Ÿ“– Table of Contents


๐Ÿš€ Project Setup

Prerequisites

  • Node.js >= 22
  • npm >= 10
  • Expo CLI (npm install -g expo-cli)

โ–ถ๏ธ Running the Application

  1. Clone this repository:

    git clone https://github.com/yourusername/react-native-supabase-boilerplate-2025.git
    cd react-native-supabase-boilerplate-2025
  2. Install dependencies:

    npm install
  3. Setup your Supabase environment:

    • Create a project on Supabase.

    • At Supabase, create 'users' table and add the following columns:

      • id (uuid)
      • creeated_at (timestampz)
      • name (text)
      • last_name (text)
      • profile_picture (text)
      • email (text)
      • updated_at (timestampz)
    • Add a foreign key on users table:

      • Schema: auth
      • table to reference: users
      • public.users "id" => auth.users "id"
    • At "Authentication">Polices create a new policy:

      • Name: allow all access for auth users

      • Table: public.users

      • Policy Command: Select "ALL" option

      • Target Roles: auth.authenticated

      • Script:

          alter policy "allow all access for auth users"
          on "public"."users"
          to authenticated
          using (true);
    • At "SQL Editor" add and run a new script to create a function and trigger:

        -- inserts a row into public.users
        create function public.handle_new_user()
        returns trigger
        language plpgsql
        security definer set search_path = public
        as $$
        begin
          insert into public.users (id, name, last_name, email, updated_at)
          values (
            new.id,
            coalesce(new.raw_user_meta_data ->> 'first_name', ''),
            coalesce(new.raw_user_meta_data ->> 'last_name', ''),
            -- coalesce(new.raw_user_meta_data ->> 'profilePicture', ''),
            new.email,
            now()
          );
          return new;
        end;
        $$;
      
        -- trigger the function every time a user is created
        create trigger createAuthUser
          after insert on auth.users
          for each row execute procedure public.handle_new_user();
      
       -- insert test.
       -- insert into auth.users (id, email, raw_user_meta_data)
       -- values (
       --  gen_random_uuid(),
       --  'jane.doe2@example.com',
       --  '{"name": "Jane", "last_name": "Doe"}'
       -- ); -->
      
       -- DELETE FROM auth.users
       -- WHERE id = 'ADD USER ID';
       -- end test
    • Add your environment variables ('supabaseUrl', 'supabaseAnonKey') to src\constants\supabase\index.ts.

  4. Run the development server:

    npx expo start

๐Ÿงช Running Tests

Run all tests:

npm run test

Run all tests with noWatch:

npm run test:no-watch

Run tests with coverage:

npm run test:coverage

๐Ÿ“‚ Project Structure

๐Ÿ“ฆreact-native-boilerplate-supabase-2025
  โ”œโ”€โ”€.github/                # GitHub configurations
  โ”‚    โ””โ”€โ”€ workflows         # CI/CD workflows
  โ”œโ”€โ”€.husky/                 # husky configurations. pre-commit and  pre-push hooks
  โ”œโ”€โ”€.vscode/                # VS Code configurations
  โ””โ”€โ”€src/                    # Source code
      โ”œโ”€โ”€ app/               # Application: Logic and organization of pages and routes
      โ”‚   โ”œโ”€โ”€ (private)/     # Private pages
      โ”‚   โ”‚   โ”œโ”€โ”€ dashboard  # Dashboard page
      โ”‚   โ”‚   โ”œโ”€โ”€ product    # Product page
      โ”‚   โ”‚   โ””โ”€โ”€ profile    # Profile page
      โ”‚   โ””โ”€โ”€ (public)/      # Public pages
      โ”‚       โ””โ”€โ”€ (auth)/    # Authentication pages
      โ”‚           โ”œโ”€โ”€ signin # Sign-in page
      โ”‚           โ””โ”€โ”€ signup # Sign-up page
      โ”œโ”€โ”€ assets/            # Static files (images, fonts)
      โ”‚   โ”œโ”€โ”€ fonts          # Fonts used in the app
      โ”‚   โ””โ”€โ”€ images         # Images for the app
      โ”œโ”€โ”€ components/        # Reusable components
      โ”œโ”€โ”€ constants/         # Constants and fixed values (e.g., supabase, theme)
      โ”‚   โ”œโ”€โ”€ supabase       # Supabase configuration and integration
      โ”‚   โ””โ”€โ”€ theme          # Theme definitions
      โ”œโ”€โ”€ contexts/          # React contexts for state management
      โ”‚   โ””โ”€โ”€ auth           # Authentication context
      โ”œโ”€โ”€ hooks/             # Custom hooks
      โ””โ”€โ”€ lib/               # Libraries and utilities
          โ”œโ”€โ”€ i18n           # Internationalization (i18n)
          โ”‚   โ””โ”€โ”€ locales    # Translation files
          โ”œโ”€โ”€ supabase       # Supabase integration utilities
          โ””โ”€โ”€ zod            # Zod validation utilities

๐ŸŒ Routes Explanation

  • / โ€“ Splash Screen
  • /(public)/(auth)/signin/page โ€“ Sign In page
  • /(public)/(auth)/signup/page โ€“ Sign Up page
  • /(private)/dashboard/page โ€“ Dashboard (authenticated users only)
  • /(private)/profile/page โ€“ User Profile (authenticated users only)

โš™๏ธ GitHub Actions

The project uses GitHub Actions for:

  • Linting and formatting: Ensures code quality with ESLint and Prettier.
  • Running tests: Runs the Jest tests on every push and pull request.

๐Ÿ”ฎ Future Improvements

  • Add commit linting for enforcing commit message conventions.
  • Implement unit tests for all components and pages.
  • Create a dark mode version of the app.

๐Ÿ‘ค Author

This project was created by Jorge Hecherat.

Feel free to reach out if you have any questions or feedback!


๐Ÿ“œ License

This project is open-source and available under the MIT License.


๐Ÿค How to Contribute

  1. Fork the project.
  2. Create a new branch: git checkout -b feature/your-feature-name.
  3. Make your changes and commit them: git commit -m 'Add some feature'.
  4. Push to the branch: git push origin feature/your-feature-name.
  5. Submit a pull request.

About

React Native 0.76+ Boilerplate with Expo, TypeScript, and Supabase โ€” Pre-configured with Supabase Authentication, ESLint, Prettier, Jest, and GitHub Actions. The starter kit to accelerate your 2025 React Native projects. ๐Ÿš€

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 97.3%
  • JavaScript 2.7%