Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions examples/with-drizzle-zero-better-auth/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ZERO_UPSTREAM_DB="postgresql://user:[email protected]/zstart_solid"
ZERO_CVR_DB="postgresql://user:[email protected]/zstart_solid_cvr"
ZERO_CHANGE_DB="postgresql://user:[email protected]/zstart_solid_cdb"
ZERO_REPLICA_FILE="/tmp/zstart_solid_replica.db"
ZERO_AUTH_JWKS_URL="http://localhost:3000/api/auth/jwks"
BETTER_AUTH_SECRET="secretkey"
VITE_PUBLIC_SERVER='http://localhost:4848'
53 changes: 53 additions & 0 deletions examples/with-drizzle-zero-better-auth/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# SolidStart

Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);

## Creating a project

```bash
# create a new project in the current directory
npm init solid@latest

# create a new project in my-app
npm init solid@latest my-app
```

## Developing

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:

```bash
# start postgres in docker container
npm run dev:db-up

# start cache server
npm run dev:zero-cache

# start the development server
npm run dev:ui
```

Once you change the drizzle schema, you need to update the migration files:

```bash
# update the m
npx drizzle-kit generate
```

## Building

Solid apps are built with _presets_, which optimise your project for deployment to different environments.

By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different preset, add it to the `devDependencies` in `package.json` and specify in your `app.config.js`.

## Documentation links:

[SolidJS Documentation](https://docs.solidjs.com/)

[Better Auth Documentation](https://www.better-auth.com/docs/introduction)

[Zero Documentation](https://zero.rocicorp.dev/docs/introduction)

[Drizzle ORM Documentation](https://orm.drizzle.team/docs/get-started)

## This project was created with the [Solid CLI](https://solid-cli.netlify.app)
9 changes: 9 additions & 0 deletions examples/with-drizzle-zero-better-auth/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { defineConfig } from "@solidjs/start/config";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
ssr: false,
vite: {
plugins: [tailwindcss()]
}
});
31 changes: 31 additions & 0 deletions examples/with-drizzle-zero-better-auth/docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
services:
postgres:
container_name: postgres
image: postgres:16.2-alpine
shm_size: 1g
user: postgres
restart: always
healthcheck:
test: "pg_isready -U user --dbname=postgres"
interval: 10s
timeout: 5s
retries: 5
ports:
- 5432:5432
environment:
POSTGRES_USER: user
POSTGRES_DB: postgres
POSTGRES_PASSWORD: password
command: |
postgres
-c wal_level=logical
-c max_wal_senders=10
-c max_replication_slots=5
-c hot_standby=on
-c hot_standby_feedback=on
volumes:
- ./.data/pgdata:/var/lib/postgresql/data
- ./:/docker-entrypoint-initdb.d
volumes:
docker_pgdata:
driver: local
3 changes: 3 additions & 0 deletions examples/with-drizzle-zero-better-auth/docker/seed.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CREATE DATABASE zstart_solid;
CREATE DATABASE zstart_solid_cvr;
CREATE DATABASE zstart_solid_cdb;
15 changes: 15 additions & 0 deletions examples/with-drizzle-zero-better-auth/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineConfig } from "drizzle-kit";

export default defineConfig({
dialect: "postgresql",
schema: ["./src/db/schema.ts", "./src/db/auth-schema.ts"],
casing: "snake_case",
dbCredentials: {
ssl: false,
user: "user",
password: "password",
host: "127.0.0.1",
port: 5432,
database: "zstart_solid"
}
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
CREATE TYPE "public"."status" AS ENUM('active', 'done');--> statement-breakpoint
CREATE TABLE "todos" (
"id" uuid PRIMARY KEY NOT NULL,
"user_id" text NOT NULL,
"title" varchar(255) NOT NULL,
"status" "status" DEFAULT 'active' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL
);
--> statement-breakpoint
CREATE TABLE "accounts" (
"id" text PRIMARY KEY NOT NULL,
"account_id" text NOT NULL,
"provider_id" text NOT NULL,
"user_id" text NOT NULL,
"access_token" text,
"refresh_token" text,
"id_token" text,
"access_token_expires_at" timestamp,
"refresh_token_expires_at" timestamp,
"scope" text,
"password" text,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "jwkss" (
"id" text PRIMARY KEY NOT NULL,
"public_key" text NOT NULL,
"private_key" text NOT NULL,
"created_at" timestamp NOT NULL
);
--> statement-breakpoint
CREATE TABLE "sessions" (
"id" text PRIMARY KEY NOT NULL,
"expires_at" timestamp NOT NULL,
"token" text NOT NULL,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
"ip_address" text,
"user_agent" text,
"user_id" text NOT NULL,
CONSTRAINT "sessions_token_unique" UNIQUE("token")
);
--> statement-breakpoint
CREATE TABLE "users" (
"id" text PRIMARY KEY NOT NULL,
"name" text NOT NULL,
"email" text NOT NULL,
"email_verified" boolean NOT NULL,
"image" text,
"created_at" timestamp NOT NULL,
"updated_at" timestamp NOT NULL,
"username" text,
"display_username" text,
CONSTRAINT "users_email_unique" UNIQUE("email"),
CONSTRAINT "users_username_unique" UNIQUE("username")
);
--> statement-breakpoint
CREATE TABLE "verifications" (
"id" text PRIMARY KEY NOT NULL,
"identifier" text NOT NULL,
"value" text NOT NULL,
"expires_at" timestamp NOT NULL,
"created_at" timestamp,
"updated_at" timestamp
);
--> statement-breakpoint
ALTER TABLE "todos" ADD CONSTRAINT "todos_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "accounts" ADD CONSTRAINT "accounts_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "sessions" ADD CONSTRAINT "sessions_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
Loading
Loading