Phase 1.1: Monorepo Setup & Design System - Turborepo + pnpm workspaces monorepo structure - Shared packages: @yetanother/types, @yetanother/utils, @yetanother/hooks, @yetanother/ui, @yetanother/db - Radix UI primitives with custom shadcn/ui-style components (Button, Dialog, Toast, Tooltip, Tabs, Label) - Tailwind CSS v4 with design tokens (light theme) - TypeScript strict mode with composite project references Phase 1.2: Authentication & User Management - Fastify server setup with JWT auth (register, login, me endpoints) - @fastify/jwt with cookie support - User and workspace models with Prisma ORM Phase 1.3: Database Schema & Migrations - Full Prisma schema: User, Workspace, Node, NodeLink, Tag, Folder, Reminder, Embedding, Activity, Attachment, WorkspaceMember, SyncCheckpoint - pgvector extension for embeddings (vector(1536)) - Seed script for dev data - Comprehensive indexes (GIN, BRIN, B-tree) Phase 1.4: API Foundation & Middleware - Fastify REST API with versioned routes (/api/v1) - Zod request validation on all endpoints - CORS, Helmet security headers, rate limiting - Structured logging with pino-pretty - Swagger/OpenAPI docs at /docs - WebSocket support (collaboration ready) - CRUD routes: nodes, workspaces, search, auth Tooling: - ESLint 9 flat config with TypeScript parser - Prettier with consistent formatting rules - Turbo v2 task orchestration - GitHub Actions CI workflow - Husky + lint-staged pre-commit hooks
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const user = await prisma.user.upsert({
|
|
where: { email: 'dev@yetanothersuite.dev' },
|
|
update: {},
|
|
create: {
|
|
email: 'dev@yetanothersuite.dev',
|
|
displayName: 'Dev User',
|
|
preferences: {
|
|
theme: 'system',
|
|
timezone: 'UTC',
|
|
notificationSettings: { push: true, email: true, inApp: true },
|
|
defaultViews: { tasks: 'list', calendar: 'week', notes: 'list' },
|
|
},
|
|
},
|
|
});
|
|
|
|
const workspace = await prisma.workspace.upsert({
|
|
where: { slug_ownerId: { slug: 'personal', ownerId: user.id } },
|
|
update: {},
|
|
create: {
|
|
name: 'Personal',
|
|
slug: 'personal',
|
|
description: 'My personal workspace',
|
|
ownerId: user.id,
|
|
settings: {
|
|
defaultView: 'list',
|
|
aiEnabled: true,
|
|
retentionPolicy: 'forever',
|
|
},
|
|
},
|
|
});
|
|
|
|
console.log({ user: user.id, workspace: workspace.id });
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|