Skip to content

Latest commit

 

History

History
255 lines (187 loc) · 8.47 KB

File metadata and controls

255 lines (187 loc) · 8.47 KB

React Native Basic Auth

React Native Expo Expo SDK 55 TypeScript Expo Router NativeWind SQLite Drizzle ORM Bun

A starter boilerplate for authentication in React Native, built with Expo Router, NativeWind, Drizzle ORM, and SQLite. Includes sign up, sign in, sign out, forgot password, and reset password flows — designed as a solid foundation to build on, not a production-ready solution out of the box.

⚠️ This is a starting point. Before shipping to production, review the Security Considerations section below. Several intentional simplifications were made to keep this boilerplate approachable.


Tech Stack


Security Considerations

This project is intentionally simplified. Before using it as a base for a real-world app, you should address the following:

Password Hashing

Passwords are hashed using react-native-argon2 with Argon2id, which is the current recommendation from OWASP and RFC 9106.

Other Areas to Improve Before Production

  • Password reset tokens — currently passed via route params (visible in navigation). Consider storing them only server-side or using a deeper link strategy.
  • Session management — sessions are stored in SQLite with no expiry. Add a expiresAt column and invalidate stale sessions.
  • Input validation — add stricter password rules (min length, complexity) via Zod schemas.
  • Rate limiting — no protection against brute-force login attempts exists in a local-first setup; consider adding attempt counters.
  • Token expiry — reset tokens expire after 15 minutes by default; adjust as needed for your use case.
  • No email verification — there is no email confirmation step on sign up.
  • Local-only — this project uses SQLite with no backend. For multi-device or server-side auth, you will need to integrate a backend (e.g., Supabase, Firebase, or a custom API).

Installation & Setup

1. Clone the Repository

git clone https://github.com/Victor-Zarzar/react-native-basic-auth
cd react-native-basic-auth

2. Install Dependencies

bun i

3. Generate Database Migrations

bun run db:generate

4. Run the App

# iOS (native build)
bun run ios:native

# Android (native build)
bun run android:native

Available Scripts

Script Description
bun run android Start on Android Emulator
bun run ios Start on iOS Simulator
bun run web Start on Web
bun run db:generate Generate Drizzle ORM migration files
bun run upgrade-deps Fix and align dependencies with Expo SDK
bun run prebuild Rebuild native directories with Expo Prebuild
bun run ios:native Run native iOS build
bun run android:native Run native Android build
bun run lint Check code with Biome
bun run lint:fix Auto-fix lint issues with Biome
bun run format Format code with Biome
bun run typecheck Run TypeScript type checking
bun test Run tests with Bun

Core Technologies

  • React Native – Cross-platform mobile framework
  • Expo SDK 55 – Development platform and tooling
  • Expo Router – File-based routing
  • TypeScript – Type-safe development
  • NativeWind – Tailwind CSS for React Native
  • SQLite (Expo SQLite) – Local persistent storage
  • Drizzle ORM – Type-safe ORM for SQLite with migration support
  • React Native Argon2 – Argon2id password hashing
  • React Native Reusables – Accessible UI component system

Key Features

  • Complete auth flow — Sign Up, Sign In, Sign Out, Forgot Password, Reset Password
  • Local data persistence with SQLite via Expo SQLite
  • Type-safe database queries with Drizzle ORM
  • Drizzle Studio integration via expo-drizzle-studio-plugin for database inspection during development
  • Password hashing with Argon2id via react-native-argon2
  • Production-ready scalable structure
  • File-based routing with Expo Router
  • Dark mode support
  • Reusable component system preconfigured
  • Edge-to-edge support
  • New Architecture enabled (Fabric + TurboModules)
  • Cross-platform (iOS, Android, Web)

Prerequisites

Before starting, ensure you have:

  • Node.js (v24+)
  • npm or Bun
  • Expo CLI
  • iOS Simulator (Mac) or Android Emulator
  • Git

Database & Migrations

This project uses Drizzle ORM on top of Expo SQLite for type-safe, local database operations.

Generating Migrations

After modifying the schema, run:

bun run db:generate

This will generate SQL migration files inside the drizzle/ folder using Drizzle Kit.

Inspecting the Database with Drizzle Studio

With the development server running, press Shift + M in the terminal to open the Dev Tools menu, then select expo-drizzle-studio-plugin from the list. Drizzle Studio will open in a new browser tab, allowing you to browse and manage your local SQLite database visually.

Note: This plugin is available during native development only (iOS/Android). It does not work on Web.


Screenshot 2026-04-13 at 18 48 48



Adding Components

bunx react-native-reusables/cli@latest add input textarea

Install all components:

bunx react-native-reusables/cli@latest add --all

Deployment

Using EAS (Recommended)

npm install -g eas-cli
eas login
eas build

Documentation: https://docs.expo.dev/eas/


Contributing

  1. Fork the project
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.


Author

Victor Zarzar - @Victor-Zarzar

Project Link: https://github.com/Victor-Zarzar/react-native-basic-auth