Skip to content

Commit 02434ae

Browse files
Feat: Add Drizze Studio and update README
Feat: Add Drizze Studio and update README
2 parents 9fc8ba1 + c2b5f9e commit 02434ae

File tree

4 files changed

+113
-26
lines changed

4 files changed

+113
-26
lines changed

README.md

Lines changed: 100 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
<h1 align="center" id="header">
22
React Native CRUD
33
</h1>
4-
54
<p align="center">
65
<img src="https://img.shields.io/badge/React_Native-20232A?style=for-the-badge&logo=react&logoColor=61DAFB" alt="React Native">
76
<img src="https://img.shields.io/badge/Expo-000020?style=for-the-badge&logo=expo&logoColor=white" alt="Expo">
87
<img src="https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript">
98
<img src="https://img.shields.io/badge/Expo_Router-000000?style=for-the-badge&logo=expo&logoColor=white" alt="Expo Router">
109
<img src="https://img.shields.io/badge/NativeWind-38B2AC?style=for-the-badge&logo=tailwind-css&logoColor=white" alt="NativeWind">
1110
<img src="https://img.shields.io/badge/SQLite-003B57?style=for-the-badge&logo=sqlite&logoColor=white" alt="SQLite">
11+
<img src="https://img.shields.io/badge/Drizzle-C5F74F?style=for-the-badge&logo=drizzle&logoColor=black" alt="Drizzle ORM">
1212
<img src="https://img.shields.io/badge/Bun-000000?style=for-the-badge&logo=bun&logoColor=white" alt="Bun">
1313
</p>
14-
1514
<p align="center">
16-
A full-featured CRUD application built with React Native, Expo Router, NativeWind, and SQLite. Create, read, update, and delete records with a clean, production-ready mobile interface.
15+
A full-featured CRUD application built with React Native, Expo Router, NativeWind, Drizzle ORM, and SQLite. Create, read, update, and delete records with a clean, production-ready mobile interface.
1716
</p>
1817

1918
---
2019

2120
<h2 id="stack">
2221
Tech Stack
2322
</h2>
24-
2523
<p>
2624
<img src="https://github.com/tandpfun/skill-icons/blob/main/icons/React-Dark.svg" width="48" title="React Native">
2725
<img src="https://github.com/tandpfun/skill-icons/blob/main/icons/TypeScript.svg" width="48" title="TypeScript">
@@ -48,7 +46,13 @@ cd react-native-crud
4846
bun i
4947
```
5048

51-
### 3. Run the App (Start the development server):
49+
### 3. Generate Database Migrations
50+
51+
```bash
52+
bun run db:generate
53+
```
54+
55+
### 4. Run the App (Start the development server):
5256

5357
```bash
5458
bun run dev
@@ -64,6 +68,28 @@ Open the app:
6468

6569
---
6670

71+
<h2 id="scripts">
72+
Available Scripts
73+
</h2>
74+
75+
| Script | Description |
76+
| ------------------------ | ----------------------------------------------- |
77+
| `bun run dev` | Start the development server (with cache clear) |
78+
| `bun run android` | Start on Android Emulator |
79+
| `bun run ios` | Start on iOS Simulator |
80+
| `bun run web` | Start on Web |
81+
| `bun run db:generate` | Generate Drizzle ORM migration files |
82+
| `bun run prebuild` | Rebuild native directories with Expo Prebuild |
83+
| `bun run ios:native` | Run native iOS build |
84+
| `bun run android:native` | Run native Android build |
85+
| `bun run lint` | Check code with Biome |
86+
| `bun run lint:fix` | Auto-fix lint issues with Biome |
87+
| `bun run format` | Format code with Biome |
88+
| `bun run typecheck` | Run TypeScript type checking |
89+
| `bun test` | Run tests with Bun |
90+
91+
---
92+
6793
<h2 id="core-technologies">
6894
Core Technologies
6995
</h2>
@@ -74,6 +100,8 @@ Open the app:
74100
- **TypeScript** – Type-safe development
75101
- **NativeWind** – Tailwind CSS for React Native
76102
- **SQLite (Expo SQLite)** – Local persistent storage for CRUD operations
103+
- **Drizzle ORM** – Type-safe ORM for SQLite with migration support
104+
- **Expo Crypto** – Cryptographic utilities for secure ID generation and hashing
77105
- **React Native Reusables** – Accessible UI component system
78106

79107
---
@@ -84,6 +112,9 @@ Open the app:
84112

85113
- Full CRUD operations — Create, Read, Update, and Delete records
86114
- Local data persistence with SQLite via Expo SQLite
115+
- Type-safe database queries with Drizzle ORM
116+
- Drizzle Studio integration via `expo-drizzle-studio-plugin` for database inspection during development
117+
- Secure ID generation with Expo Crypto
87118
- Production-ready scalable structure
88119
- File-based routing with Expo Router
89120
- Dark mode support
@@ -117,33 +148,53 @@ Before starting, ensure you have:
117148
react-native-crud/
118149
├── src/
119150
│ ├── app/ # Expo Router routes
120-
│ │ ├── _layout.tsx # Root layout
121-
│ │ ├── index.tsx # Initial redirect
122151
│ │ ├── (auth)/ # Public auth routes
123-
│ │ │ ├── _layout.tsx
124-
│ │ │ ├── login.tsx
125-
│ │ │ ├── forgot-password.tsx
126-
│ │ │ └── reset-password.tsx
127-
│ │ └── (app)/ # Protected app routes
128-
│ │ ├── _layout.tsx
129-
│ │ ├── index.tsx # Home (logged in)
130-
│ │ ├── items/
131-
│ │ │ ├── index.tsx # List items
132-
│ │ │ ├── new.tsx # Create item
133-
│ │ │ └── [id].tsx # Edit / detail
134-
│ │ └── settings.tsx # Settings & logout
152+
│ │ │ ├── +html.tsx
153+
│ │ │ ├── +not-found.tsx
154+
│ │ │ └── _layout.tsx
135155
│ └── shared/
156+
│ ├── auth/ # Auth context & logic
157+
│ │ ├── context.ts
158+
│ │ ├── index.ts
159+
│ │ └── provider.tsx
160+
│ ├── components/
161+
│ │ ├── language/ # i18n / language components
162+
│ │ │ ├── flags/
163+
│ │ │ └── index.tsx
164+
│ │ └── ui/ # Reusable UI components
165+
│ │ ├── forgot-password-form.tsx
166+
│ │ ├── reset-password-form.tsx
167+
│ │ ├── sign-in-form.tsx
168+
│ │ ├── sign-up-form.tsx
169+
│ │ ├── social-connections.tsx
170+
│ │ ├── user-menu.tsx
171+
│ │ └── verify-email-form.tsx
172+
│ ├── constants/
173+
│ │ ├── Colors.ts
174+
│ │ └── theme-icon.tsx
136175
│ ├── db/ # Database layer
137176
│ │ ├── client.ts # SQLite client setup
138-
│ │ ├── migrations.ts # Schema migrations
139-
│ │ ├── auth.ts # Auth queries
140-
│ │ └── items.ts # Items queries (CRUD)
141-
│ ├── providers/
142-
│ │ └── auth-provider.tsx # Auth context & session
177+
│ │ ├── db-migration.tsx # Migration runner
178+
│ │ ├── index.ts
179+
│ │ ├── provider.tsx # DB context provider
180+
│ │ └── schema.ts # Drizzle schema definitions
181+
│ ├── hooks/
182+
│ │ ├── useAuth.ts
183+
│ │ └── useColorScheme.ts
184+
│ ├── lib/
185+
│ │ ├── theme.ts
186+
│ │ └── utils.ts
187+
│ ├── services/
188+
│ │ └── userService.ts
143189
│ └── types/
144-
│ └── auth.ts # Auth type definitions
190+
│ ├── auth.ts
191+
│ ├── icon.ts
192+
│ └── locale.ts
193+
├── tests/ # Test files
145194
├── assets/ # Images and fonts
195+
├── global.css # Global styles
146196
├── app.json # Expo configuration
197+
├── drizzle.config.ts # Drizzle Kit configuration
147198
├── package.json # Dependencies
148199
├── tailwind.config.js # NativeWind config
149200
├── tsconfig.json # TypeScript config
@@ -152,6 +203,30 @@ react-native-crud/
152203

153204
---
154205

206+
<h2 id="database">
207+
Database & Migrations
208+
</h2>
209+
210+
This project uses **Drizzle ORM** on top of **Expo SQLite** for type-safe, local database operations.
211+
212+
### Generating Migrations
213+
214+
After modifying the schema, run:
215+
216+
```bash
217+
bun run db:generate
218+
```
219+
220+
This will generate SQL migration files inside the `drizzle/` folder using Drizzle Kit.
221+
222+
### Inspecting the Database with Drizzle Studio
223+
224+
With the development server running (`bun run dev`), 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.
225+
226+
> **Note:** This plugin is available during native development only (iOS/Android). It does not work on Web.
227+
228+
---
229+
155230
<h2 id="adding-components">
156231
Adding Components
157232
</h2>

bun.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"expo": "~54.0.29",
4444
"expo-constants": "~18.0.12",
4545
"expo-crypto": "15.0.8",
46+
"expo-drizzle-studio-plugin": "^0.2.1",
4647
"expo-linking": "~8.0.10",
4748
"expo-localization": "~17.0.8",
4849
"expo-router": "~6.0.19",

src/shared/db/provider.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1-
import { SQLiteProvider } from "expo-sqlite";
1+
import { useDrizzleStudio } from "expo-drizzle-studio-plugin";
2+
import { SQLiteProvider, useSQLiteContext } from "expo-sqlite";
23
import type React from "react";
34
import { MigrationGate } from "./db-migration";
45

6+
function DrizzleStudio() {
7+
const db = useSQLiteContext();
8+
useDrizzleStudio(db);
9+
return null;
10+
}
11+
512
export function DbProvider({ children }: { children: React.ReactNode }) {
613
return (
714
<SQLiteProvider databaseName="app.db" useSuspense>
15+
<DrizzleStudio />
816
<MigrationGate>{children}</MigrationGate>
917
</SQLiteProvider>
1018
);

0 commit comments

Comments
 (0)