This project was created with Better-T-Stack.
This is a modified version of the template to add on the following features:
- Zero Sync
- Effect
- Alchemy
Huge shoutout to @IzakFilmalter with OpenFaith for all of the legwork with integrating Effect and Zero together.
Note: I am learning Effect and using this project to try to better understand it so this is a work in progress.
- Backend logic leveraging Effect
- Drizzle for writing mutuations ('Effectful' usage of Drizzle) and Drizzle Kit for migrations
- Drizzle Zero to generate the Zero schema
- Zero for realtime sync on client(s) leveraging Effectful custom mutators
- Alchemy for running dev and deploying in production to Cloudflare Workers
- TypeScript - For type safety and improved developer experience
- TanStack Start - SSR framework with TanStack Router
- TailwindCSS - Utility-first CSS for rapid UI development
- shadcn/ui - Reusable UI components
- Hono - Lightweight, performant server framework
- Bun - Runtime environment
- Drizzle - TypeScript-first ORM
- PostgreSQL - Database engine
- Authentication - Email & password authentication with Better Auth
- Biome - Linting and formatting
- Turborepo - Optimized monorepo build system
-
Install dependencies:
bun install
-
Set up environment variables:
cp env.example .env
-
Start and set up the database container:
bun db:start
-
Push database schema to database using Drizzle Zero and Drizzle Kit:
bun db:push
-
Run the backend container in watch mode with Zero Cache for replication:
bun db:backend
-
In a second terminal, start the web app's Vite dev server using Alchemy:
bun dev
Open http://localhost:3001 in your browser to see the web application.
zero-effect-better-t/
├── apps/
│ ├── web/ # Frontend application (React + TanStack Start)
├── packages/
│ ├── backend/ # Backend code (Drizzle, Zero, etc.)
│ ├── env/ # Environment variables
│ ├── zero-effect/ # Effect compatible code to work with Zero - from @openfaith
│ ├── effect-bun-test/ # Effect Bun test code - from @openfaith
│ ├── tsconfig/ # TypeScript configuration
│ └── ... # Other packages
bun dev: Start the web application development server using Alchemybun db:start: Start and set up the database containerbun db:backend: Run the backend container in watch mode with Zero Cache for replicationbun db:push: Push schema changes to database using Drizzle Zero and Drizzle Kitbun db:studio: Open database studio UI
bun build: Build all applicationsbun check-types: Check TypeScript types across all appsbun check: Run Biome formatting and linting
bun deploy: Deploy the web application to production using Alchemy
createInsertSchemaandcreateSelectSchemafrom@zero-effect/backend/lib/drizzle-effectmust be used and imported with the same subpackage. If exported out the types end up asany.
- Public/Private Routes to show login/auth behavior
- Add mobile app - waiting for feat(zero-client): expo-sqlite storage to land