Skip to content
Closed
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
72 changes: 72 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# AGENTS.md — BetterBase Repository Operating Guide

## Mission Context
This repository contains planning artifacts and the early implementation scaffold for **BetterBase**:
- An AI-native backend platform inspired by Supabase.
- Built with a **TypeScript-first** developer experience.
- Runtime and tooling emphasis: **Bun**, Turborepo, Drizzle, BetterAuth, Hono.

## Assistant Identity / Model Context
- If asked which model is running, reply with the runtime-configured model identifier when available; otherwise provide a neutral capability-focused response.

## Current Strategic Inputs
Primary planning docs to align with before implementation:
- `betterbase_blueprint.md`
- `betterbase_reuse_strategy.md`

## Persistent Project Prompt (Apply to Every New Task)
Use and preserve the following project prompt context for future BetterBase implementation tasks:

PROJECT: BetterBase - AI-Native Backend Framework
STACK: Bun + TypeScript + Hono + Drizzle ORM + SQLite (local) / Postgres (production)

PHILOSOPHY:
- AI-first: Generate `.betterbase-context.json` for AI agents to read
- Docker-less: Use `bun:sqlite` for <100ms startup
- Zero lock-in: Users own their schemas
- Type-safe: Strict TypeScript, Zod validation everywhere

BASE APP STRUCTURE:
- `/src/db` (`schema.ts`, `index.ts`)
- `/src/routes` (API endpoints)
- `/src/middleware` (auth, validation)
- `/src/lib` (utilities)
- `betterbase.config.ts`
- `drizzle.config.ts`

## Engineering Defaults
1. **Runtime:** Bun (prefer Bun commands and Bun workspaces).
2. **Language:** TypeScript in strict mode.
3. **Monorepo:** Turborepo with `apps/*` and `packages/*`.
4. **Core stack direction:**
- API/server templates: Hono
- ORM/migrations: Drizzle
- Auth direction: BetterAuth
5. **Approach:** Reuse Better-T-Stack patterns where strategic, build BetterBase-differentiating features from scratch.

## Repository Structure Guidance
When scaffolding implementation, use:
- `betterbase/packages/cli` → canonical `bb` CLI implementation
- `betterbase/apps/cli` → legacy wrapper/stub (delegates to package CLI)
- `betterbase/apps/dashboard` → dashboard app
- `betterbase/packages/core` → backend/core engine
- `betterbase/packages/client` → `@betterbase/client`
- `betterbase/packages/shared` → shared utilities/types
- `betterbase/templates/base` → base starter template
- `betterbase/templates/auth` → auth starter template

## Workflow Rules for Agents
1. Read this file and planning docs before major code generation.
2. Keep changes incremental and commit in logical units.
3. Prefer small, composable files and clear package boundaries.
4. Avoid introducing lock-in assumptions that conflict with BetterBase goals.
5. When uncertain, bias toward the blueprint and reuse strategy docs.
6. Ensure new templates follow the persistent project prompt above.

## Quality & Validation
- Run lightweight checks whenever possible (format/lint/typecheck when available).
- Keep generated scaffolding runnable with Bun commands.

## Documentation Expectations
- Update docs when structure or commands change.
- Keep command examples Bun-first.
25 changes: 25 additions & 0 deletions betterbase/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
node_modules
.bun
.turbo
dist
.next

.vscode/
.idea/

.env
.env.*
.env.local
.env.test
!.env.example

*.log
npm-debug.log
yarn-error.log
pnpm-debug.log

coverage/
.cache/
.parcel-cache/

.DS_Store
29 changes: 29 additions & 0 deletions betterbase/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# BetterBase Monorepo

Initial BetterBase monorepo scaffold with a concrete base template.

## Structure

- `apps/cli` — legacy CLI wrapper/stub
- `apps/dashboard` — dashboard/studio app
- `packages/cli` — canonical `@betterbase/cli` implementation
- `packages/core` — core backend engine
- `packages/client` — SDK (`@betterbase/client`)
- `packages/shared` — shared utilities/types
- `templates/base` — Bun + TypeScript + Hono + Drizzle starter template
- `templates/auth` — auth template placeholder
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Auth template is no longer just a "placeholder".

The PR adds a concrete auth template with Hono routes, middleware, and Drizzle schema. Update this line to reflect that.

Suggested fix
-- `templates/auth` — auth template placeholder
+- `templates/auth` — auth template (Hono + better-auth + Drizzle)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- `templates/auth` — auth template placeholder
- `templates/auth` — auth template (Hono + better-auth + Drizzle)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@betterbase/README.md` at line 14, Update the README entry for templates/auth
to reflect that it is a full auth implementation (not a placeholder): change the
line "`templates/auth` — auth template placeholder" to describe that
templates/auth contains a concrete auth template including Hono routes,
middleware, and a Drizzle schema (mention templates/auth, Hono routes,
middleware, and Drizzle schema so reviewers can locate the new auth
implementation).


## Tooling Direction

- Runtime/package manager: **Bun**
- Workspace orchestration: **Turborepo**
- Language: **TypeScript**

## Base Template Commands

From `templates/base`:

- `bun run dev`
- `bun run db:generate`
- `bun run db:push`
- `bun run typecheck`
6 changes: 6 additions & 0 deletions betterbase/apps/cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# @betterbase/cli-legacy

This package is a legacy wrapper placeholder.

- Canonical CLI implementation: `betterbase/packages/cli` (`@betterbase/cli`)
- This package exists only for backwards compatibility and forwards execution.
20 changes: 20 additions & 0 deletions betterbase/apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@betterbase/cli-legacy",
"version": "0.0.0",
"private": true,
"type": "module",
"bin": {
"bb-legacy": "./dist/index.js"
},
"scripts": {
"build": "bun build ./src/index.ts --outfile ./dist/index.js --target bun",
"dev": "bun run src/index.ts",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@betterbase/cli": "workspace:*"
},
"devDependencies": {
"typescript": "^5.9.3"
}
}
21 changes: 21 additions & 0 deletions betterbase/apps/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bun

/**
* Legacy bb wrapper entrypoint.
*
* Forwards execution to the canonical CLI implementation in packages/cli.
*/
export async function runLegacyCli(): Promise<void> {
const { runCli } = await import('@betterbase/cli');
await runCli(process.argv);
}

if (import.meta.main) {
(async () => {
await runLegacyCli();
})().catch((error) => {
const message = error instanceof Error ? error.message : String(error);
console.error(message);
process.exitCode = 1;
});
}
9 changes: 9 additions & 0 deletions betterbase/apps/cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": ".",
"types": ["bun"]
},
"include": ["src", "test"]
}
16 changes: 16 additions & 0 deletions betterbase/apps/dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Dashboard App (Scaffold)

Initial dashboard app scaffold for BetterBase.

## Included

- `src/index.ts` placeholder entry
- `package.json` with Bun scripts
- `tsconfig.json` strict TypeScript setup

## Planned Features (Optional)

- [ ] Table browser and editor
- [ ] API explorer / request runner
- [ ] Auth and session management views
- [ ] Project settings and environment controls
11 changes: 11 additions & 0 deletions betterbase/apps/dashboard/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@betterbase/dashboard",
"version": "0.1.0",
"private": true,
"type": "module",
"scripts": {
"build": "echo 'dashboard: no build step yet'",
"dev": "bun run src/index.ts",
"typecheck": "tsc -p tsconfig.json --noEmit"
}
}
1 change: 1 addition & 0 deletions betterbase/apps/dashboard/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('BetterBase Dashboard scaffold initialized.');
8 changes: 8 additions & 0 deletions betterbase/apps/dashboard/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"types": ["bun"],
"outDir": "dist"
},
"include": ["src/**/*.ts"]
}
Loading