mirror of
https://github.com/shishantbiswas/bknd-examples.git
synced 2026-03-18 02:56:04 +00:00
All checks were successful
Build and Push to Gitea Registry / build-and-push (push) Successful in 7m54s
1.9 KiB
1.9 KiB
bknd + Tanstack Start Example (Docker)
This is a minimal example to shows how to integrate bknd with Tanstack Start for Docker deployment. Here is a Preview URL
Setup
bun install
bun run dev
How it works
bknd.config.ts- bknd configuration with database connection, schema, and seed datasrc/routes/api.$.ts- Handles/api/*requests for bkndsrc/routes/index.tsx- UsinggetApp()to fetch data in loadersrc/routes/ssr.tsx- Server Side example withgetApp()to fetch data on server
Directory Structure
├── bknd.config.ts
├── bun.lock
├── docker-compose.yml
├── Dockerfile
├── package.json
├── public
├── README.md
├── src
│ ├── bknd.ts # bknd singleton initialization
│ ├── logo.svg
│ ├── router.tsx
│ ├── routes
│ │ ├── api.$.ts # bknd API handler
│ │ ├── admin.$.tsx # Admin Dashboard
│ │ ├── index.tsx # Client Side Rendering example
│ │ └── ssr.tsx # Server Side Rendering example
│ │ ├── __root.tsx
│ ├── routeTree.gen.ts
│ └── styles.css
├── tsconfig.json
└── vite.config.ts
API Endpoints
GET /admin- for Admin DashboardGET /api/data/entity/todos- List todos (requires auth)POST /api/auth/password/login- Login
Test Credentials
- Email:
test@bknd.io - Password:
12345678
For Building the Docker Image
docker build -t bknd-examples:tanstack-start .
For Deployment on Docker (using docker compose)
- Run
docker compose up -d
For Local Development
- Run
bun run dev - Open
http://localhost:3000 - Open
http://localhost:3000/adminfor Admin Dashboard
For Cloudflare Workers deployment
Checkout the cf-tanstack branch for Cloudflare Workers deployment instructions.