Skip to content

Commit 2459a48

Browse files
committed
Add cf durable object proxy
1 parent 944ad11 commit 2459a48

12 files changed

Lines changed: 580 additions & 56 deletions

File tree

‎.env.example‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
# This is an example of your .env file format, which pnpm db:setup will create.
2-
# Note: this must be .env, not .env.local, without further configuration changes.
1+
# Zero-config mode works without a `.env` file.
2+
# If you leave DATABASE_URL unset, the app uses the shared Durable Object SQLite proxy.
3+
# If you leave AUTH_SECRET unset, the app uses a built-in demo secret.
4+
# Note: if you do add this file, it must be `.env`, not `.env.local`, without further configuration changes.
35

4-
# For local SQLite database (default)
5-
DATABASE_URL=./local-sqlite-database.db
6+
# Optional: switch to local SQLite with `pnpm db:setup`
7+
# DATABASE_URL=./local-sqlite-database.db
68

7-
# For Turso connection (uncomment and replace with your Turso values)
9+
# Optional: point directly at your Durable Object sqlite-proxy URL
10+
# DATABASE_URL=https://your-durable-object-proxy.workers.dev
11+
12+
# Optional: Turso connection
813
# DATABASE_URL=libsql://your-database-name.turso.io
914
# DATABASE_AUTH_TOKEN=your-auth-token-here
1015

1116
BASE_URL=http://localhost:3000
12-
AUTH_SECRET=***
17+
# AUTH_SECRET=replace-me-for-non-demo-use

‎README.md‎

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ You can either:
2020

2121
- Run the tests against our pre-deployed application at [https://endform-playwright-tutorial.vercel.app](https://endform-playwright-tutorial.vercel.app)
2222
- Run the application locally, for this option you will need to:
23-
- Set up `.env` and run migrations on a local SQLite database: `pnpm db:setup`
24-
- Run the application: `pnpm dev`, or for better performance `pnpm build && pnpm start`
23+
- Install dependencies: `pnpm install`
24+
- Run the application right away: `pnpm dev`
25+
- Optionally switch to local SQLite instead of the shared demo Durable Object: `pnpm db:setup`
26+
- Optionally seed your local database: `pnpm db:seed`
2527
- Check that it loads correctly at [http://localhost:3000](http://localhost:3000)
2628

2729
## Coming from "Deploy with Vercel"?
@@ -52,27 +54,41 @@ This is a starter template for building a SaaS application using **Next.js** wit
5254
## Tech Stack
5355

5456
- **Framework**: [Next.js](https://nextjs.org/)
55-
- **Database**: [SQLite](https://www.sqlite.org/) with [libSQL client](https://github.com/tursodatabase/libsql-js) (supports both local files and [Turso](https://turso.tech/))
57+
- **Database**: [SQLite](https://www.sqlite.org/) via a shared Cloudflare Durable Object proxy by default, with optional local file SQLite and [Turso](https://turso.tech/) support
5658
- **ORM**: [Drizzle](https://orm.drizzle.team/)
5759
- **Payments**: Dummy payment system (for demonstration only)
5860
- **UI Library**: [shadcn/ui](https://ui.shadcn.com/)
5961

6062
## Getting Started
6163

6264
```bash
63-
git clone https://github.com/nextjs/saas-starter
64-
cd saas-starter
65+
git clone https://github.com/endformdev/playwright-tutorial
66+
cd playwright-tutorial
6567
pnpm install
6668
```
6769

6870
## Running Locally
6971

70-
Use the included setup script to create your `.env` file and run the database migrations:
72+
By default, the app works without any database or auth environment variables. If you do nothing, it connects to the shared demo SQLite database through an HTTP proxy backed by a Cloudflare Durable Object. That shared demo database is public and wiped on a schedule, so it is meant for quick starts and testing only.
73+
74+
Start the app immediately:
75+
76+
```bash
77+
pnpm dev
78+
```
79+
80+
If you want your own local SQLite file instead, use the included setup script to create `.env` and run the database migrations:
7181

7282
```bash
7383
pnpm db:setup
7484
```
7585

86+
You can optionally seed that local database too:
87+
88+
```bash
89+
pnpm db:seed
90+
```
91+
7692
Then, run the Next.js development server:
7793

7894
```bash
@@ -113,7 +129,6 @@ When you're ready to deploy your SaaS application to production, follow these st
113129
In your Vercel project settings (or during deployment), add the necessary environment variables:
114130

115131
1. `BASE_URL`: Set this to your production domain.
116-
2. `DATABASE_URL`: Set this to your SQLite database path for local files, or your Turso connection string (libsql://your-database.turso.io)
117-
3. `DATABASE_AUTH_TOKEN`: Required if using Turso - your database auth token
118-
3. `AUTH_SECRET`: Set this to a random string. `openssl rand -base64 32` will generate one.
119-
132+
2. `DATABASE_URL`: Leave unset to use the shared Durable Object proxy, set it to a local SQLite path, set it to your own proxy URL, or use a Turso connection string (`libsql://your-database.turso.io`)
133+
3. `DATABASE_AUTH_TOKEN`: Required if using Turso
134+
4. `AUTH_SECRET`: Optional in demo mode, but set this to a random string for any non-demo deployment. `openssl rand -base64 32` will generate one.

‎app/(dashboard)/terminal.tsx‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ export function Terminal() {
77
const [terminalStep, setTerminalStep] = useState(0);
88
const [copied, setCopied] = useState(false);
99
const terminalSteps = [
10-
"git clone https://github.com/nextjs/saas-starter",
10+
"git clone https://github.com/endformdev/playwright-tutorial",
1111
"pnpm install",
12-
"pnpm db:setup",
13-
"pnpm db:migrate",
14-
"pnpm db:seed",
15-
"pnpm dev 🎉",
12+
"pnpm dev",
13+
"pnpm db:setup # optional: switch to local SQLite",
14+
"pnpm db:seed # optional: add local sample data",
15+
"open http://localhost:3000 🎉",
1616
];
1717

1818
useEffect(() => {

0 commit comments

Comments
 (0)