Files
taskplaner/.planning/phases/01-foundation/01-01-PLAN.md
Thomas Richter 92e0d5188a docs(01): create phase 1 foundation plans
Phase 01: Foundation
- 2 plans in 2 waves
- Wave 1: Project setup with SvelteKit + Drizzle schema
- Wave 2: Repository layer + verification page
- Ready for execution

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-29 04:26:48 +01:00

6.5 KiB

phase, plan, type, wave, depends_on, files_modified, autonomous, must_haves
phase plan type wave depends_on files_modified autonomous must_haves
01-foundation 01 execute 1
package.json
tsconfig.json
svelte.config.js
vite.config.ts
src/app.css
src/lib/server/db/schema.ts
src/lib/server/db/index.ts
drizzle.config.ts
true
truths artifacts key_links
npm run dev starts without errors
TypeScript compilation succeeds
Tailwind CSS classes are processed
Database schema defines unified entries table with type discriminator
path provides contains
package.json Project dependencies better-sqlite3
path provides contains
src/lib/server/db/schema.ts Drizzle schema with entries table entries
path provides exports
src/lib/server/db/index.ts Database connection and initialization
db
from to via pattern
src/lib/server/db/index.ts src/lib/server/db/schema.ts import schema import.*schema
Create the SvelteKit project with all core dependencies and establish the database schema using Drizzle ORM.

Purpose: Establishes the foundation for all subsequent development - project structure, tooling, and data model. Output: Working SvelteKit project with Drizzle schema defining the unified entries table.

<execution_context> @/home/tho/.claude/get-shit-done/workflows/execute-plan.md @/home/tho/.claude/get-shit-done/templates/summary.md </execution_context>

@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/research/STACK.md @.planning/research/ARCHITECTURE.md @.planning/phases/01-foundation/01-CONTEXT.md Task 1: Create SvelteKit project with dependencies package.json tsconfig.json svelte.config.js vite.config.ts src/app.html src/app.css src/routes/+page.svelte Create a new SvelteKit project using `npx sv create` with the following options: - Template: SvelteKit minimal - TypeScript: Yes - Tailwind CSS: Yes (v4 with @tailwindcss/vite) - ESLint + Prettier: Yes

After project creation, install additional dependencies:

npm install better-sqlite3 drizzle-orm nanoid zod
npm install -D drizzle-kit @types/better-sqlite3

Configure Tailwind in src/app.css:

@import 'tailwindcss';

Verify vite.config.ts includes Tailwind plugin (sv create should handle this).

Update src/routes/+page.svelte to include a simple Tailwind-styled element to verify CSS processing:

<h1 class="text-2xl font-bold text-blue-600">TaskPlanner</h1>
<p class="text-gray-600">Foundation setup complete.</p>
Run `npm run dev` - server should start on localhost:5173 without errors. Visit the page - should see styled "TaskPlanner" heading. Run `npm run check` - TypeScript should pass. SvelteKit dev server runs, Tailwind processes classes, all dependencies installed. Task 2: Configure Drizzle schema with entries table src/lib/server/db/schema.ts src/lib/server/db/index.ts drizzle.config.ts Create `src/lib/server/db/schema.ts` with the unified entries table:
import { sqliteTable, text, integer } from 'drizzle-orm/sqlite-core';

// Entry types: 'task' (actionable) or 'thought' (reference)
export const entries = sqliteTable('entries', {
  id: text('id').primaryKey(), // nanoid
  title: text('title'),
  content: text('content').notNull(),
  type: text('type', { enum: ['task', 'thought'] }).notNull().default('thought'),
  status: text('status', { enum: ['open', 'done', 'archived'] }).default('open'), // for tasks
  pinned: integer('pinned', { mode: 'boolean' }).default(false),
  dueDate: text('due_date'), // ISO date string, nullable
  createdAt: text('created_at').notNull().$defaultFn(() => new Date().toISOString()),
  updatedAt: text('updated_at').notNull().$defaultFn(() => new Date().toISOString()),
});

// Type inference for TypeScript
export type Entry = typeof entries.$inferSelect;
export type NewEntry = typeof entries.$inferInsert;

Create src/lib/server/db/index.ts for database connection:

import Database from 'better-sqlite3';
import { drizzle } from 'drizzle-orm/better-sqlite3';
import * as schema from './schema';
import { existsSync, mkdirSync } from 'fs';
import { dirname } from 'path';

const DB_PATH = process.env.DATABASE_PATH || './data/taskplaner.db';

// Ensure data directory exists
const dbDir = dirname(DB_PATH);
if (!existsSync(dbDir)) {
  mkdirSync(dbDir, { recursive: true });
}

const sqlite = new Database(DB_PATH);

// Enable WAL mode for better concurrent read performance
sqlite.pragma('journal_mode = WAL');

export const db = drizzle(sqlite, { schema });

export { schema };

Create drizzle.config.ts for migrations:

import { defineConfig } from 'drizzle-kit';

export default defineConfig({
  schema: './src/lib/server/db/schema.ts',
  out: './drizzle',
  dialect: 'sqlite',
  dbCredentials: {
    url: process.env.DATABASE_PATH || './data/taskplaner.db',
  },
});

Add npm scripts to package.json:

{
  "scripts": {
    "db:generate": "drizzle-kit generate",
    "db:migrate": "drizzle-kit migrate",
    "db:push": "drizzle-kit push",
    "db:studio": "drizzle-kit studio"
  }
}
Run `npm run db:push` - should create database file at `./data/taskplaner.db` with entries table. Run `sqlite3 ./data/taskplaner.db ".schema"` - should show entries table with all columns. Import db in a test: create a simple test file that imports and logs `db` without errors. Drizzle schema defines entries table with id, title, content, type, status, pinned, dueDate, createdAt, updatedAt. Database file created with schema applied. WAL mode enabled. 1. `npm run dev` starts without errors 2. `npm run check` passes TypeScript validation 3. `./data/taskplaner.db` exists after `npm run db:push` 4. Database has entries table with correct schema 5. Tailwind classes render correctly on the test page

<success_criteria>

  • SvelteKit project created with TypeScript and Tailwind 4
  • All dependencies installed (better-sqlite3, drizzle-orm, nanoid, zod)
  • Drizzle schema defines unified entries table with type discriminator
  • Database initializes with WAL mode
  • Dev server starts and serves styled page </success_criteria>
After completion, create `.planning/phases/01-foundation/01-01-SUMMARY.md`