From 3038e4875c78a72e630fb43dfabf9635ab172512 Mon Sep 17 00:00:00 2001 From: fullsizemalt <106900403+fullsizemalt@users.noreply.github.com> Date: Wed, 17 Dec 2025 00:30:52 -0800 Subject: [PATCH] fix(deploy): Flatten apps/web to root for deployment --- Dockerfile | 37 ++-- apps/web/Dockerfile | 50 ----- apps/web/README.md | 92 --------- apps/web/drizzle.config.ts | 11 -- apps/web/eslint.config.mjs | 18 -- apps/web/next.config.ts | 7 - apps/web/package.json | 48 ----- apps/web/postcss.config.mjs | 7 - apps/web/public/file.svg | 1 - apps/web/public/globe.svg | 1 - apps/web/public/next.svg | 1 - apps/web/public/vercel.svg | 1 - apps/web/public/window.svg | 1 - apps/web/sqlite.db | Bin 86016 -> 0 bytes .../src/app/api/auth/[...nextauth]/route.ts | 2 - apps/web/src/app/api/v1/pastes/[id]/route.ts | 69 ------- apps/web/src/app/api/v1/pastes/route.ts | 114 ------------ .../app/api/v1/sessions/[id]/pastes/route.ts | 15 -- apps/web/src/app/api/v1/sessions/route.ts | 46 ----- apps/web/src/app/favicon.ico | Bin 25931 -> 0 bytes apps/web/src/app/globals.css | 100 ---------- apps/web/src/app/layout.tsx | 39 ---- apps/web/src/app/new/page.tsx | 49 ----- apps/web/src/app/page.tsx | 147 --------------- apps/web/src/app/paste/[id]/page.tsx | 76 -------- apps/web/src/app/sessions/[id]/page.tsx | 64 ------- apps/web/src/app/sessions/page.tsx | 57 ------ apps/web/src/app/tag/[id]/page.tsx | 75 -------- apps/web/src/auth.ts | 17 -- apps/web/src/components/auth-components.tsx | 30 --- apps/web/src/components/code-viewer.tsx | 39 ---- apps/web/src/components/navbar.tsx | 35 ---- apps/web/src/components/paste-form.tsx | 141 -------------- apps/web/src/components/theme-provider.tsx | 9 - apps/web/src/components/theme-toggle.tsx | 21 --- apps/web/src/components/ui/badge.tsx | 35 ---- apps/web/src/components/ui/button.tsx | 43 ----- apps/web/src/components/user-button.tsx | 31 ---- apps/web/src/db/index.ts | 9 - apps/web/src/db/migrate.ts | 14 -- apps/web/src/db/schema.ts | 120 ------------ apps/web/src/lib/utils.ts | 6 - apps/web/tsconfig.json | 34 ---- docker-compose.yml | 2 +- drizzle.config.ts | 6 +- next.config.ts | 4 +- package.json | 22 ++- src/app/api/v1/pastes/[id]/route.ts | 13 +- src/app/api/v1/pastes/route.ts | 16 +- src/app/api/v1/sessions/[id]/pastes/route.ts | 3 +- src/app/api/v1/sessions/route.ts | 4 +- {apps/web/src => src}/app/dashboard/page.tsx | 0 src/app/new/page.tsx | 45 ++++- src/app/page.tsx | 174 +++++++++++++----- src/app/paste/[id]/page.tsx | 5 +- src/app/sessions/[id]/page.tsx | 5 +- src/app/sessions/page.tsx | 3 +- .../app/settings/api-keys/page.tsx | 0 src/app/tag/[id]/page.tsx | 4 +- src/components/navbar.tsx | 8 +- {apps/web/src => src}/components/ui/input.tsx | 0 .../web/src => src}/components/ui/popover.tsx | 0 .../web/src => src}/components/ui/select.tsx | 0 src/db/schema.ts | 47 ++--- 64 files changed, 261 insertions(+), 1812 deletions(-) delete mode 100644 apps/web/Dockerfile delete mode 100644 apps/web/README.md delete mode 100644 apps/web/drizzle.config.ts delete mode 100644 apps/web/eslint.config.mjs delete mode 100644 apps/web/next.config.ts delete mode 100644 apps/web/package.json delete mode 100644 apps/web/postcss.config.mjs delete mode 100644 apps/web/public/file.svg delete mode 100644 apps/web/public/globe.svg delete mode 100644 apps/web/public/next.svg delete mode 100644 apps/web/public/vercel.svg delete mode 100644 apps/web/public/window.svg delete mode 100644 apps/web/sqlite.db delete mode 100644 apps/web/src/app/api/auth/[...nextauth]/route.ts delete mode 100644 apps/web/src/app/api/v1/pastes/[id]/route.ts delete mode 100644 apps/web/src/app/api/v1/pastes/route.ts delete mode 100644 apps/web/src/app/api/v1/sessions/[id]/pastes/route.ts delete mode 100644 apps/web/src/app/api/v1/sessions/route.ts delete mode 100644 apps/web/src/app/favicon.ico delete mode 100644 apps/web/src/app/globals.css delete mode 100644 apps/web/src/app/layout.tsx delete mode 100644 apps/web/src/app/new/page.tsx delete mode 100644 apps/web/src/app/page.tsx delete mode 100644 apps/web/src/app/paste/[id]/page.tsx delete mode 100644 apps/web/src/app/sessions/[id]/page.tsx delete mode 100644 apps/web/src/app/sessions/page.tsx delete mode 100644 apps/web/src/app/tag/[id]/page.tsx delete mode 100644 apps/web/src/auth.ts delete mode 100644 apps/web/src/components/auth-components.tsx delete mode 100644 apps/web/src/components/code-viewer.tsx delete mode 100644 apps/web/src/components/navbar.tsx delete mode 100644 apps/web/src/components/paste-form.tsx delete mode 100644 apps/web/src/components/theme-provider.tsx delete mode 100644 apps/web/src/components/theme-toggle.tsx delete mode 100644 apps/web/src/components/ui/badge.tsx delete mode 100644 apps/web/src/components/ui/button.tsx delete mode 100644 apps/web/src/components/user-button.tsx delete mode 100644 apps/web/src/db/index.ts delete mode 100644 apps/web/src/db/migrate.ts delete mode 100644 apps/web/src/db/schema.ts delete mode 100644 apps/web/src/lib/utils.ts delete mode 100644 apps/web/tsconfig.json rename {apps/web/src => src}/app/dashboard/page.tsx (100%) rename {apps/web/src => src}/app/settings/api-keys/page.tsx (100%) rename {apps/web/src => src}/components/ui/input.tsx (100%) rename {apps/web/src => src}/components/ui/popover.tsx (100%) rename {apps/web/src => src}/components/ui/select.tsx (100%) diff --git a/Dockerfile b/Dockerfile index 80254f6..63912b9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ -FROM node:22-alpine AS base +FROM oven/bun:latest AS base # Install dependencies only when needed FROM base AS deps WORKDIR /app -COPY package.json package-lock.json* ./ -RUN npm install +COPY package.json ./ +RUN bun install # Rebuild the source code only when needed FROM base AS builder @@ -12,47 +12,34 @@ WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . -# Generate migration SQL files -# RUN npx drizzle-kit generate <-- DISABLED: We are providing generated migrations with custom edits - # Build Next.js ENV NEXT_TELEMETRY_DISABLED=1 -RUN npm run build +RUN bun run build -# Production image, copy all the files and run next +# # Production image, copy all the files and run next FROM base AS runner WORKDIR /app ENV NODE_ENV=production ENV NEXT_TELEMETRY_DISABLED=1 -RUN addgroup --system --gid 1001 nodejs -RUN adduser --system --uid 1001 nextjs - # Copy public folder COPY --from=builder /app/public ./public # Set permission for prerender cache RUN mkdir .next -RUN chown nextjs:nodejs .next # Automatically leverage output traces to reduce image size -COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ -COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static +COPY --from=builder /app/.next/standalone ./ +COPY --from=builder /app/.next/static ./.next/static # Copy migrations and migration script -# Ensure we copy from the source (which now includes them via COPY . . in builder) -COPY --from=builder --chown=nextjs:nodejs /app/drizzle ./drizzle -COPY --from=builder --chown=nextjs:nodejs /app/src/db/migrate.ts ./src/db/migrate.ts +COPY --from=builder /app/drizzle ./drizzle +COPY --from=builder /app/src/db/migrate.ts ./src/db/migrate.ts +COPY --from=builder /app/src ./src -# Runtime dependencies -RUN npm install -g tsx -RUN npm install drizzle-orm pg dotenv +RUN bun install drizzle-orm pg dotenv -# Copy the source so tsx can run migrate.ts -COPY --from=builder --chown=nextjs:nodejs /app/src ./src - -USER nextjs EXPOSE 3000 @@ -60,4 +47,4 @@ ENV PORT=3000 ENV HOSTNAME="0.0.0.0" # Custom entrypoint to run migrations then start app -CMD ["sh", "-c", "npx tsx src/db/migrate.ts && node server.js"] +CMD ["sh", "-c", "bun --bun run src/db/migrate.ts && bun --bun run server.js"] \ No newline at end of file diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile deleted file mode 100644 index 63912b9..0000000 --- a/apps/web/Dockerfile +++ /dev/null @@ -1,50 +0,0 @@ -FROM oven/bun:latest AS base - -# Install dependencies only when needed -FROM base AS deps -WORKDIR /app -COPY package.json ./ -RUN bun install - -# Rebuild the source code only when needed -FROM base AS builder -WORKDIR /app -COPY --from=deps /app/node_modules ./node_modules -COPY . . - -# Build Next.js -ENV NEXT_TELEMETRY_DISABLED=1 -RUN bun run build - -# # Production image, copy all the files and run next -FROM base AS runner -WORKDIR /app - -ENV NODE_ENV=production -ENV NEXT_TELEMETRY_DISABLED=1 - -# Copy public folder -COPY --from=builder /app/public ./public - -# Set permission for prerender cache -RUN mkdir .next - -# Automatically leverage output traces to reduce image size -COPY --from=builder /app/.next/standalone ./ -COPY --from=builder /app/.next/static ./.next/static - -# Copy migrations and migration script -COPY --from=builder /app/drizzle ./drizzle -COPY --from=builder /app/src/db/migrate.ts ./src/db/migrate.ts -COPY --from=builder /app/src ./src - -RUN bun install drizzle-orm pg dotenv - - -EXPOSE 3000 - -ENV PORT=3000 -ENV HOSTNAME="0.0.0.0" - -# Custom entrypoint to run migrations then start app -CMD ["sh", "-c", "bun --bun run src/db/migrate.ts && bun --bun run server.js"] \ No newline at end of file diff --git a/apps/web/README.md b/apps/web/README.md deleted file mode 100644 index e3485a3..0000000 --- a/apps/web/README.md +++ /dev/null @@ -1,92 +0,0 @@ -# Kites - Agentic Pastebin - -Kites is a clean, agent-native pastebin service designed for LLMs and humans. It features a simple API, structured data model (Sessions, Tags), and a polished UI. - -## Features - -- **Agent-First API**: Simple REST endpoints for creating and retrieving pastes. -- **Sessions**: Group pastes by "run" or logical session. -- **Tags**: Organize pastes with tags. -- **Syntax Highlighting**: Automatic highlighting for various languages. -- **Theming**: Light and Dark mode support. -- **Self-Hostable**: Built with Next.js and SQLite for easy deployment. - -## Tech Stack - -- **Framework**: Next.js 15 (App Router) -- **Database**: SQLite -- **ORM**: Drizzle ORM -- **Styling**: Tailwind CSS v4 -- **Validation**: Zod - -## Getting Started - -### Prerequisites - -- Node.js 18+ -- npm - -### Installation - -1. Clone the repository: - ```bash - git clone https://github.com/fullsizemalt/kites.git - cd kites - ``` - -2. Install dependencies: - ```bash - npm install - ``` - -3. Initialize the database: - ```bash - npx drizzle-kit push - ``` - -4. Run the development server: - ```bash - npm run dev - ``` - - Open [http://localhost:3000](http://localhost:3000) with your browser. - -## API Usage - -### Create a Paste - -```bash -curl -X POST http://localhost:3000/api/v1/pastes \ - -H "Content-Type: application/json" \ - -d '{ - "content": "console.log(\"Hello Kites!\");", - "title": "My First Paste", - "syntax": "javascript", - "tags": ["demo", "js"] - }' -``` - -### Get a Paste (Raw) - -```bash -curl http://localhost:3000/api/v1/pastes/?raw=1 -``` - -### Create a Session - -```bash -curl -X POST http://localhost:3000/api/v1/sessions \ - -H "Content-Type: application/json" \ - -d '{ - "title": "Agent Run 101", - "agentName": "GPT-4" - }' -``` - -## Agent Example - -See `examples/agent_usage.py` for a Python script that demonstrates how an agent can interact with Kites. - -```bash -python3 examples/agent_usage.py -``` diff --git a/apps/web/drizzle.config.ts b/apps/web/drizzle.config.ts deleted file mode 100644 index 54feee1..0000000 --- a/apps/web/drizzle.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { Config } from 'drizzle-kit'; -import 'dotenv/config'; - -export default { - schema: './src/db/schema.ts', - out: './drizzle', - dialect: 'postgresql', - dbCredentials: { - url: process.env.DATABASE_URL!, - }, -} satisfies Config; \ No newline at end of file diff --git a/apps/web/eslint.config.mjs b/apps/web/eslint.config.mjs deleted file mode 100644 index 05e726d..0000000 --- a/apps/web/eslint.config.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import { defineConfig, globalIgnores } from "eslint/config"; -import nextVitals from "eslint-config-next/core-web-vitals"; -import nextTs from "eslint-config-next/typescript"; - -const eslintConfig = defineConfig([ - ...nextVitals, - ...nextTs, - // Override default ignores of eslint-config-next. - globalIgnores([ - // Default ignores of eslint-config-next: - ".next/**", - "out/**", - "build/**", - "next-env.d.ts", - ]), -]); - -export default eslintConfig; diff --git a/apps/web/next.config.ts b/apps/web/next.config.ts deleted file mode 100644 index de2d453..0000000 --- a/apps/web/next.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { NextConfig } from "next"; - -const nextConfig: NextConfig = { - output: "standalone", -}; - -export default nextConfig; \ No newline at end of file diff --git a/apps/web/package.json b/apps/web/package.json deleted file mode 100644 index 6d4f3cd..0000000 --- a/apps/web/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "web", - "version": "0.1.0", - "private": true, - "scripts": { - "dev": "bun --bun next dev", - "build": "bun --bun next build", - "start": "bun --bun next start", - "lint": "bun --bun next lint", - "db:push": "bun --bun drizzle-kit push:pg", - "db:migrate": "bun --bun drizzle-kit migrate", - "db:generate": "bun --bun drizzle-kit generate" - }, - "dependencies": { - "@auth/drizzle-adapter": "^1.11.1", - "@types/react-syntax-highlighter": "^15.5.13", - "pg": "^8.13.1", - "class-variance-authority": "^0.7.1", - "clsx": "^2.1.1", - "date-fns": "^4.1.0", - "dotenv": "^16.4.5", - "drizzle-orm": "^0.44.7", - "lucide-react": "^0.554.0", - "nanoid": "^5.1.6", - "next": "16.0.3", - "next-auth": "^5.0.0-beta.30", - "next-themes": "^0.4.6", - "@radix-ui/react-select": "^2.1.0", - "@radix-ui/react-popover": "^1.1.0", - "react": "19.2.0", - "react-dom": "19.2.0", - "react-syntax-highlighter": "^16.1.0", - "tailwind-merge": "^3.4.0", - "zod": "^4.1.12" - }, - "devDependencies": { - "@tailwindcss/postcss": "^4", - "@types/pg": "^8.11.0", - "@types/node": "^20", - "@types/react": "^19", - "@types/react-dom": "^19", - "drizzle-kit": "^0.31.7", - "eslint": "^9", - "eslint-config-next": "16.0.3", - "tailwindcss": "^4", - "typescript": "^5" - } -} diff --git a/apps/web/postcss.config.mjs b/apps/web/postcss.config.mjs deleted file mode 100644 index 61e3684..0000000 --- a/apps/web/postcss.config.mjs +++ /dev/null @@ -1,7 +0,0 @@ -const config = { - plugins: { - "@tailwindcss/postcss": {}, - }, -}; - -export default config; diff --git a/apps/web/public/file.svg b/apps/web/public/file.svg deleted file mode 100644 index 004145c..0000000 --- a/apps/web/public/file.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/public/globe.svg b/apps/web/public/globe.svg deleted file mode 100644 index 567f17b..0000000 --- a/apps/web/public/globe.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/public/next.svg b/apps/web/public/next.svg deleted file mode 100644 index 5174b28..0000000 --- a/apps/web/public/next.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/public/vercel.svg b/apps/web/public/vercel.svg deleted file mode 100644 index 7705396..0000000 --- a/apps/web/public/vercel.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/public/window.svg b/apps/web/public/window.svg deleted file mode 100644 index b2b2a44..0000000 --- a/apps/web/public/window.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/apps/web/sqlite.db b/apps/web/sqlite.db deleted file mode 100644 index 68d725c94901ffb06bb770a5bf384abffe4d1c12..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 86016 zcmeI&O-~y~7{GCx7aJT1B!R9Fsb)PJmwttQhTeMbt)HUD&g`zu4%lf)+so>YPoKZDUL4xRWxf?KChW~bF($KAzHqyNpx$b zFHU@OXSZVRRJXS7$q#*1@rZJ9(s8@OtC?=g7YCvnzi6*q+Afs$&1c2^yYbrZnNf9C z&MGWrjOtoC<+d8)#CzA2!^?Jhemgj}ue8)&zf!c^U%izzmY36~D*;E(6J7PVtp}}& z260Al#M&2ccCFz-zX=k(eN=jZjvu5t@grzdt zFchnwy%`Ag-vvVI67^Wng;deCg*3Q&yV;JCM>#ZvSMRzVm6xHP)L8hCMi9%odS2`| z=d#A?YWi#~XtF0fPgWDX%sItxCR#BGK9k1>*M9#WDpD_xn zz_iyKKxSY~buDkAFCzeAjQr=A3$4&ZaGYL~2H#*#7%YbiT}` zCxz-(#muWbUh6a+x0P4a-ussCoP>3#<73xzU%PUKeIM03ys*=I-E`~0MRM+a+wQ7V z7<5r>kbUv8XoT2~Y-2R@tFNech2x7xym;8WjcQpAkcwR?Z5Llu3fp_?f?lU_tqb%{ zy=bhSFlto(vwro2Z?<~PX3qL-He-CTGHwKhJ#4Rsuetsw*{rdfPxm*10jS!c?w#@; zEbSyha3^(|rOjyi)=rp-@WcYS#aRO3h{XKZ;eoap7!<)ZDS&6*|8 z({u8_x+6TyWQ^_nxO~+5%U;(Gv#0sVU=IIwHcWy8nVWVriaohBi5*Q{N(1e~kDI%~ zFVNRe3Pqb!B;vmq_k-#_cGM4VyN{+a#;!FMS<{fp+VS++!*sAjIWL9GVZJ-z%fuzv zurw4MJ9J``dOU{*BPyDYU@J|;p05I_I{1Q0*~0R#|0009Kp|0f3!KmY**5I_I{1Q0*~0R#|8z5x6G$?sz# zL;wK<5I_I{1Q0*~0R#|0fc<}R009ILKmY**5I_I{1Q0*~f#eJD`#<@8OoRv^fB*sr zAbVgEAb }) { - const { id } = await params; - const { searchParams } = new URL(req.url); - const raw = searchParams.get('raw') === '1'; - - const paste = (await db.select().from(pastes).where(eq(pastes.id, id)).limit(1))[0]; - - if (!paste) { - return NextResponse.json({ error: 'Not found' }, { status: 404 }); - } - - if (raw) { - return new NextResponse(paste.content, { - headers: { - 'Content-Type': paste.contentType || 'text/plain', - }, - }); - } - - return NextResponse.json(paste); -} - -const updatePasteSchema = z.object({ - title: z.string().optional(), - content: z.string().optional(), - visibility: z.enum(['public', 'unlisted', 'private']).optional(), - syntax: z.string().optional(), -}); - -export async function PATCH(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { - try { - const { id } = await params; - const body = await req.json(); - const validated = updatePasteSchema.parse(body); - - const updated = await db.update(pastes) - .set({ - ...validated, - updatedAt: new Date(), - }) - .where(eq(pastes.id, id)) - .returning(); - - const updatedFirst = updated[0]; - - if (!updatedFirst) { - return NextResponse.json({ error: 'Not found' }, { status: 404 }); - } - - return NextResponse.json(updatedFirst); - } catch (error) { - if (error instanceof ZodError) { - return NextResponse.json({ error: (error as any).errors }, { status: 400 }); - } - return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 }); - } -} - -export async function DELETE(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { - const { id } = await params; - await db.delete(pastes).where(eq(pastes.id, id)); - return new NextResponse(null, { status: 204 }); -} diff --git a/apps/web/src/app/api/v1/pastes/route.ts b/apps/web/src/app/api/v1/pastes/route.ts deleted file mode 100644 index 6ad2df8..0000000 --- a/apps/web/src/app/api/v1/pastes/route.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server'; -import { db } from '@/db'; -import { pastes, tags, pastesToTags } from '@/db/schema'; -import { nanoid } from 'nanoid'; -import { z, ZodError } from 'zod'; -import { eq, desc, like, and } from 'drizzle-orm'; -import { auth } from '@/auth'; - -const createPasteSchema = z.object({ - content: z.string().min(1), - title: z.string().optional(), - tags: z.array(z.string()).optional(), - sessionId: z.string().optional(), - visibility: z.enum(['public', 'unlisted', 'private']).optional().default('public'), - expiresIn: z.number().optional(), // seconds - contentType: z.string().optional(), - syntax: z.string().optional(), -}); - -export async function POST(req: NextRequest) { - try { - const body = await req.json(); - const session = await auth(); - - // API Key Auth for Desktop Client - const apiKey = req.headers.get('x-api-key'); - const isApiAuth = apiKey && apiKey === process.env.KITES_API_KEY; - - if (!session && !isApiAuth) { - return NextResponse.json({ error: 'Unauthorized' }, { status: 401 }); - } - - const validated = createPasteSchema.parse(body); - - const id = nanoid(10); - - // Calculate expiration - let expiresAt = null; - if (validated.expiresIn) { - // Simple expiration logic (seconds) - expiresAt = new Date(Date.now() + validated.expiresIn * 1000); - } - - await db.insert(pastes).values({ - id, - content: validated.content, - title: validated.title, - sessionId: validated.sessionId, - visibility: validated.visibility, - expiresAt, - contentType: validated.contentType, - syntax: validated.syntax, - authorId: session?.user?.id, - }); - - if (validated.tags && validated.tags.length > 0) { - for (const tagName of validated.tags) { - // Simple tag handling: create if not exists, then link - // In a real app, might want to optimize this - let tagId = nanoid(8); - - // Check if tag exists - const existingTag = (await db.select().from(tags).where(eq(tags.name, tagName)).limit(1))[0]; - - if (existingTag) { - tagId = existingTag.id; - } else { - await db.insert(tags).values({ id: tagId, name: tagName }); - } - - await db.insert(pastesToTags).values({ - pasteId: id, - tagId: tagId, - }); - } - } - - const created = (await db.select().from(pastes).where(eq(pastes.id, id)).limit(1))[0]; - - return NextResponse.json(created, { status: 201 }); - } catch (error) { - if (error instanceof ZodError) { - return NextResponse.json({ error: (error as any).errors }, { status: 400 }); - } - console.error(error); - return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 }); - } -} - -export async function GET(req: NextRequest) { - const { searchParams } = new URL(req.url); - const limit = parseInt(searchParams.get('limit') || '20'); - const offset = parseInt(searchParams.get('offset') || '0'); - const sessionId = searchParams.get('session_id'); - const authorId = searchParams.get('author_id'); - const q = searchParams.get('q'); - - // Basic filtering - let conditions = []; - if (sessionId) conditions.push(eq(pastes.sessionId, sessionId)); - if (authorId) conditions.push(eq(pastes.authorId, authorId)); - if (q) conditions.push(like(pastes.title, `%${q}%`)); // Simple title search - - // TODO: Tag filtering requires join - - const results = await db.select() - .from(pastes) - .where(and(...conditions)) - .orderBy(desc(pastes.createdAt)) - .limit(limit) - .offset(offset); - - return NextResponse.json(results); -} diff --git a/apps/web/src/app/api/v1/sessions/[id]/pastes/route.ts b/apps/web/src/app/api/v1/sessions/[id]/pastes/route.ts deleted file mode 100644 index 946cde8..0000000 --- a/apps/web/src/app/api/v1/sessions/[id]/pastes/route.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server'; -import { db } from '@/db'; -import { pastes } from '@/db/schema'; -import { eq, desc } from 'drizzle-orm'; - -export async function GET(req: NextRequest, { params }: { params: Promise<{ id: string }> }) { - const { id: sessionId } = await params; - - const results = await db.select() - .from(pastes) - .where(eq(pastes.sessionId, sessionId)) - .orderBy(desc(pastes.createdAt)); - - return NextResponse.json(results); -} diff --git a/apps/web/src/app/api/v1/sessions/route.ts b/apps/web/src/app/api/v1/sessions/route.ts deleted file mode 100644 index 8633ffa..0000000 --- a/apps/web/src/app/api/v1/sessions/route.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { NextRequest, NextResponse } from 'next/server'; -import { db } from '@/db'; -import { agentSessions } from '@/db/schema'; -import { nanoid } from 'nanoid'; -import { z, ZodError } from 'zod'; -import { eq } from 'drizzle-orm'; -import { auth } from '@/auth'; - -const createSessionSchema = z.object({ - title: z.string().optional(), - agentName: z.string().optional(), -}); - -export async function POST(req: NextRequest) { - try { - const body = await req.json(); - const session = await auth(); - const validated = createSessionSchema.parse(body); - - const id = nanoid(12); - - await db.insert(agentSessions).values({ - id, - title: validated.title, - agentName: validated.agentName, - userId: session?.user?.id, - }); - - const created = (await db.select().from(agentSessions).where(eq(agentSessions.id, id)).limit(1))[0]; // Re-fetch to get default fields if any - - // Since we inserted, we can just return what we have + id if we trust it, but fetching is safer for timestamps - // Actually better-sqlite3 insert doesn't return the row by default unless using returning() which is supported in Drizzle now - // Let's use returning() in the insert above if possible, but I used .values(). - // Drizzle with SQLite supports .returning() - - // Let's refactor to use returning() for cleaner code in next iteration or just re-fetch. - // Re-fetching is fine. - - return NextResponse.json(created || { id, ...validated }, { status: 201 }); - } catch (error) { - if (error instanceof ZodError) { - return NextResponse.json({ error: (error as any).errors }, { status: 400 }); - } - return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 }); - } -} diff --git a/apps/web/src/app/favicon.ico b/apps/web/src/app/favicon.ico deleted file mode 100644 index 718d6fea4835ec2d246af9800eddb7ffb276240c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 25931 zcmeHv30#a{`}aL_*G&7qml|y<+KVaDM2m#dVr!KsA!#An?kSQM(q<_dDNCpjEux83 zLb9Z^XxbDl(w>%i@8hT6>)&Gu{h#Oeyszu?xtw#Zb1mO{pgX9699l+Qppw7jXaYf~-84xW z)w4x8?=youko|}Vr~(D$UXIbiXABHh`p1?nn8Po~fxRJv}|0e(BPs|G`(TT%kKVJAdg5*Z|x0leQq0 zkdUBvb#>9F()jo|T~kx@OM8$9wzs~t2l;K=woNssA3l6|sx2r3+kdfVW@e^8e*E}v zA1y5{bRi+3Z`uD3{F7LgFJDdvm;nJilkzDku>BwXH(8ItVCXk*-lS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EZef LrJugUA?W`A8`#=m diff --git a/apps/web/src/app/globals.css b/apps/web/src/app/globals.css deleted file mode 100644 index 04aceeb..0000000 --- a/apps/web/src/app/globals.css +++ /dev/null @@ -1,100 +0,0 @@ -@import "tailwindcss"; - -@layer base { - :root { - --background: 0 0% 100%; - --foreground: 222.2 84% 4.9%; - - --card: 0 0% 100%; - --card-foreground: 222.2 84% 4.9%; - - --popover: 0 0% 100%; - --popover-foreground: 222.2 84% 4.9%; - - --primary: 222.2 47.4% 11.2%; - --primary-foreground: 210 40% 98%; - - --secondary: 210 40% 96.1%; - --secondary-foreground: 222.2 47.4% 11.2%; - - --muted: 210 40% 96.1%; - --muted-foreground: 215.4 16.3% 46.9%; - - --accent: 210 40% 96.1%; - --accent-foreground: 222.2 47.4% 11.2%; - - --destructive: 0 84.2% 60.2%; - --destructive-foreground: 210 40% 98%; - - --border: 214.3 31.8% 91.4%; - --input: 214.3 31.8% 91.4%; - --ring: 222.2 84% 4.9%; - - --radius: 0.5rem; - } - - .dark { - --background: 222.2 84% 4.9%; - --foreground: 210 40% 98%; - - --card: 222.2 84% 4.9%; - --card-foreground: 210 40% 98%; - - --popover: 222.2 84% 4.9%; - --popover-foreground: 210 40% 98%; - - --primary: 210 40% 98%; - --primary-foreground: 222.2 47.4% 11.2%; - - --secondary: 217.2 32.6% 17.5%; - --secondary-foreground: 210 40% 98%; - - --muted: 217.2 32.6% 17.5%; - --muted-foreground: 215 20.2% 65.1%; - - --accent: 217.2 32.6% 17.5%; - --accent-foreground: 210 40% 98%; - - --destructive: 0 62.8% 30.6%; - --destructive-foreground: 210 40% 98%; - - --border: 217.2 32.6% 17.5%; - --input: 217.2 32.6% 17.5%; - --ring: 212.7 26.8% 83.9%; - } -} - -@theme { - --color-background: var(--background); - --color-foreground: var(--foreground); - --color-card: var(--card); - --color-card-foreground: var(--card-foreground); - --color-popover: var(--popover); - --color-popover-foreground: var(--popover-foreground); - --color-primary: var(--primary); - --color-primary-foreground: var(--primary-foreground); - --color-secondary: var(--secondary); - --color-secondary-foreground: var(--secondary-foreground); - --color-muted: var(--muted); - --color-muted-foreground: var(--muted-foreground); - --color-accent: var(--accent); - --color-accent-foreground: var(--accent-foreground); - --color-destructive: var(--destructive); - --color-destructive-foreground: var(--destructive-foreground); - --color-border: var(--border); - --color-input: var(--input); - --color-ring: var(--ring); - --radius-sm: calc(var(--radius) - 4px); - --radius-md: calc(var(--radius) - 2px); - --radius-lg: var(--radius); -} - -@layer base { - * { - @apply border-border; - } - - body { - @apply bg-background text-foreground; - } -} \ No newline at end of file diff --git a/apps/web/src/app/layout.tsx b/apps/web/src/app/layout.tsx deleted file mode 100644 index 8bebc91..0000000 --- a/apps/web/src/app/layout.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import type { Metadata } from "next"; -import { Inter } from "next/font/google"; -import "./globals.css"; -import { ThemeProvider } from "@/components/theme-provider"; -import { Navbar } from "@/components/navbar"; -import { cn } from "@/lib/utils"; - -const inter = Inter({ subsets: ["latin"] }); - -export const metadata: Metadata = { - title: "Kites - Agentic Pastebin", - description: "A clean, agent-native pastebin service.", -}; - -export default function RootLayout({ - children, -}: Readonly<{ - children: React.ReactNode; -}>) { - return ( - - - -
- -
- {children} -
-
-
- - - ); -} diff --git a/apps/web/src/app/new/page.tsx b/apps/web/src/app/new/page.tsx deleted file mode 100644 index d29e71b..0000000 --- a/apps/web/src/app/new/page.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { PasteForm } from "@/components/paste-form"; -import Link from "next/link"; -import { Copy, Terminal, Key } from "lucide-react"; -import { Button } from "@/components/ui/button"; - -export default function NewPastePage() { - return ( -
-

Create New Paste

-

- Kites helps you manage code snippets, agent outputs, and clipboard history. Create a paste below, or learn how to integrate with your tools. -

- - {/* Instruction Cards */} -
-
-
- -
-

For Humans

-

- Simply paste your content below. Choose a title, syntax, and visibility. Your paste will be available in your personal feed. -

- -
-
-
- -
-

For Agents & Clients

-

- Integrate your LLMs, scripts, or desktop clipboard managers using the Kites API. Generate an API key to securely push data. -

- -
-
- - {/* Paste Form */} -

Your Content Here

- -
- ); -} \ No newline at end of file diff --git a/apps/web/src/app/page.tsx b/apps/web/src/app/page.tsx deleted file mode 100644 index fe25c83..0000000 --- a/apps/web/src/app/page.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import Link from "next/link"; -import { db } from "@/db"; -import { pastes } from "@/db/schema"; -import { desc, eq } from "drizzle-orm"; -import { formatDistanceToNow } from "date-fns"; -import { Button } from "@/components/ui/button"; -import { Terminal, Cpu, Share2, Shield, Code, Sparkles } from "lucide-react"; -import { auth } from "@/auth"; -import { redirect } from "next/navigation"; // Import redirect - -export const dynamic = 'force-dynamic'; - -export default async function Home() { - const session = await auth(); - const userId = session?.user?.id; - - if (userId) { // Redirect if logged in - redirect("/dashboard"); - } - - const recentPastes = await db.select() - .from(pastes) - .orderBy(desc(pastes.createdAt)) - .limit(12); - - return ( -
- {/* Hero Section */} -
-
-
-
- - v1.0 Public Beta -
-

- The Shared Brain for
Humans & AI Agents -

-

- Stop copy-pasting into the void. Kites is an agent-native clipboard that gives your LLMs a persistent memory and you a unified history. -

-
- - - - {userId ? ( // Conditional button for logged-in users - - - - ) : ( - - - - )} -
-
-
- - {/* Abstract "Network" Background */} -
-
- - {/* Feature Grid */} -
-
-
-
-
- -
-

Agent-Native API

-

- Give your agents a POST /pastes endpoint. Let them save context, code blocks, and logs directly to your view. -

-
-
-
- -
-

Unified History

-

- Your desktop clipboard, your agent's output, and your mobile saves—all in one structured, searchable timeline. -

-
-
-
- -
-

Privacy First

-

- Self-hostable. Private by default. You control the retention policy and visibility of every snippet. -

-
-
-
-
- - {/* Live Feed (Recent Pastes) */} -
-
-
-
-

{userId ? "My Recent Pastes" : "Live Context Feed"}

-

{userId ? "Your latest snippets and agent interactions." : "Recent items from our community."}

-
-
- -
- {recentPastes.length === 0 ? ( -
-
👻
- No context yet. Create your first paste! -
- ) : ( - recentPastes.map((paste) => ( - -
-
- {paste.syntax ? : } - {paste.syntax || 'Text'} -
- {formatDistanceToNow(paste.createdAt!, { addSuffix: true })} -
- -

- {paste.title || "Untitled Snippet"} -

- -
-
- {paste.content} -
-
-
- - )) - )} -
-
-
-
- ); -} \ No newline at end of file diff --git a/apps/web/src/app/paste/[id]/page.tsx b/apps/web/src/app/paste/[id]/page.tsx deleted file mode 100644 index f8d512c..0000000 --- a/apps/web/src/app/paste/[id]/page.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { db } from "@/db"; -import { pastes, tags, pastesToTags } from "@/db/schema"; -import { eq } from "drizzle-orm"; -import { notFound } from "next/navigation"; -import { formatDistanceToNow } from "date-fns"; -import { CodeViewer } from "@/components/code-viewer"; -import Link from "next/link"; -import { Badge } from "@/components/ui/badge"; // We don't have this yet, I'll inline styles or create it - -// Inline simple Badge component for now to avoid creating too many files -function SimpleBadge({ children, className }: { children: React.ReactNode, className?: string }) { - return ( - - {children} - - ); -} - -export default async function PastePage({ params }: { params: Promise<{ id: string }> }) { - const { id } = await params; - const paste = (await db.select().from(pastes).where(eq(pastes.id, id)).limit(1))[0]; - - if (!paste) { - notFound(); - } - - const pasteTags = await db.select({ - id: tags.id, - name: tags.name, - }) - .from(tags) - .innerJoin(pastesToTags, eq(tags.id, pastesToTags.tagId)) - .where(eq(pastesToTags.pasteId, id)); - - return ( -
-
-
-

{paste.title || "Untitled Paste"}

-
- {formatDistanceToNow(paste.createdAt!, { addSuffix: true })} - - {paste.syntax || "text"} - - {paste.visibility} -
-
-
- - Raw - - {/* Copy button could go here */} -
-
- - {pasteTags.length > 0 && ( -
- {pasteTags.map((tag) => ( - - #{tag.name} - - ))} -
- )} - -
- -
-
- ); -} diff --git a/apps/web/src/app/sessions/[id]/page.tsx b/apps/web/src/app/sessions/[id]/page.tsx deleted file mode 100644 index 09fc7a6..0000000 --- a/apps/web/src/app/sessions/[id]/page.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import Link from "next/link"; -import { db } from "@/db"; -import { agentSessions, pastes } from "@/db/schema"; -import { eq, desc } from "drizzle-orm"; -import { notFound } from "next/navigation"; -import { formatDistanceToNow } from "date-fns"; - -export default async function SessionPage({ params }: { params: Promise<{ id: string }> }) { - const { id } = await params; - const session = (await db.select().from(agentSessions).where(eq(agentSessions.id, id)).limit(1))[0]; - - if (!session) { - notFound(); - } - - const sessionPastes = await db.select() - .from(pastes) - .where(eq(pastes.sessionId, session.id)) - .orderBy(desc(pastes.createdAt)); - - return ( -
-
-

{session.title || "Session " + session.id}

-
- {formatDistanceToNow(session.createdAt!, { addSuffix: true })} - - {session.agentName || "Unknown Agent"} -
-
- -
- {sessionPastes.length === 0 ? ( -
- No pastes in this session. -
- ) : ( - sessionPastes.map((paste) => ( - -
-

- {paste.title || "Untitled Paste"} -

- - {paste.syntax || "text"} - -
-
- {paste.content} -
-
- {formatDistanceToNow(paste.createdAt!, { addSuffix: true })} -
- - )) - )} -
-
- ); -} diff --git a/apps/web/src/app/sessions/page.tsx b/apps/web/src/app/sessions/page.tsx deleted file mode 100644 index 94730d3..0000000 --- a/apps/web/src/app/sessions/page.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import Link from "next/link"; -import { db } from "@/db"; -import { agentSessions, pastes } from "@/db/schema"; -import { desc, eq, sql } from "drizzle-orm"; -import { formatDistanceToNow } from "date-fns"; - -export const dynamic = 'force-dynamic'; - -export default async function SessionsPage() { - // Fetch sessions with paste count - const allSessions = await db.select({ - id: agentSessions.id, - title: agentSessions.title, - agentName: agentSessions.agentName, - createdAt: agentSessions.createdAt, - pasteCount: sql`count(${pastes.id})`, - }) - .from(agentSessions) - .leftJoin(pastes, eq(agentSessions.id, pastes.sessionId)) - .groupBy(agentSessions.id) - .orderBy(desc(agentSessions.createdAt)); - - return ( -
-

Sessions

- -
- {allSessions.length === 0 ? ( -
- No sessions found. -
- ) : ( - allSessions.map((session) => ( - -
-

- {session.title || session.id} -

- - {session.agentName || "Unknown Agent"} - -
-
- {formatDistanceToNow(session.createdAt!, { addSuffix: true })} - {session.pasteCount} pastes -
- - )) - )} -
-
- ); -} diff --git a/apps/web/src/app/tag/[id]/page.tsx b/apps/web/src/app/tag/[id]/page.tsx deleted file mode 100644 index d904613..0000000 --- a/apps/web/src/app/tag/[id]/page.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import Link from "next/link"; -import { db } from "@/db"; -import { tags, pastes, pastesToTags } from "@/db/schema"; -import { eq, desc } from "drizzle-orm"; -import { notFound } from "next/navigation"; -import { formatDistanceToNow } from "date-fns"; -import { Badge } from "@/components/ui/badge"; - -export default async function TagPage({ params }: { params: Promise<{ id: string }> }) { - const { id } = await params; - const tag = (await db.select().from(tags).where(eq(tags.id, id)).limit(1))[0]; - - if (!tag) { - notFound(); - } - - const taggedPastes = await db.select({ - id: pastes.id, - title: pastes.title, - content: pastes.content, - syntax: pastes.syntax, - createdAt: pastes.createdAt, - visibility: pastes.visibility, - }) - .from(pastes) - .innerJoin(pastesToTags, eq(pastes.id, pastesToTags.pasteId)) - .where(eq(pastesToTags.tagId, tag.id)) - .orderBy(desc(pastes.createdAt)) - .limit(50); - - return ( -
-
-

Tag:

- #{tag.name} -
- -
- {taggedPastes.length === 0 ? ( -
- No pastes found with this tag. -
- ) : ( - taggedPastes.map((paste) => ( - -
-

- {paste.title || "Untitled Paste"} -

- - {paste.syntax || "text"} - -
-
- {paste.content} -
-
- {formatDistanceToNow(paste.createdAt!, { addSuffix: true })} - {paste.visibility !== 'public' && ( - - {paste.visibility} - - )} -
- - )) - )} -
-
- ); -} diff --git a/apps/web/src/auth.ts b/apps/web/src/auth.ts deleted file mode 100644 index e863cee..0000000 --- a/apps/web/src/auth.ts +++ /dev/null @@ -1,17 +0,0 @@ -import NextAuth from "next-auth" -import { DrizzleAdapter } from "@auth/drizzle-adapter" -import { db } from "@/db" -import { accounts, sessions, users, verificationTokens } from "@/db/schema" -import Google from "next-auth/providers/google" -import GitHub from "next-auth/providers/github" -import Apple from "next-auth/providers/apple" - -export const { handlers, auth, signIn, signOut } = NextAuth({ - adapter: DrizzleAdapter(db, { - usersTable: users, - accountsTable: accounts, - sessionsTable: sessions, - verificationTokensTable: verificationTokens, - }), - providers: [Google, GitHub, Apple], -}) diff --git a/apps/web/src/components/auth-components.tsx b/apps/web/src/components/auth-components.tsx deleted file mode 100644 index 0281b02..0000000 --- a/apps/web/src/components/auth-components.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { signIn, signOut } from "@/auth" -import { Button } from "./ui/button" - -export function SignIn() { - return ( -
{ - "use server" - await signIn() - }} - > - -
- ) -} - -export function SignOut() { - return ( -
{ - "use server" - await signOut() - }} - > - -
- ) -} diff --git a/apps/web/src/components/code-viewer.tsx b/apps/web/src/components/code-viewer.tsx deleted file mode 100644 index 91ac17b..0000000 --- a/apps/web/src/components/code-viewer.tsx +++ /dev/null @@ -1,39 +0,0 @@ -"use client" - -import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'; -import { vscDarkPlus, vs } from 'react-syntax-highlighter/dist/esm/styles/prism'; -import { useTheme } from 'next-themes'; -import { useEffect, useState } from 'react'; - -interface CodeViewerProps { - code: string; - language: string; -} - -export function CodeViewer({ code, language }: CodeViewerProps) { - const { theme } = useTheme(); - const [mounted, setMounted] = useState(false); - - useEffect(() => { - setMounted(true); - }, []); - - if (!mounted) { - return ( -
-                {code}
-            
- ); - } - - return ( - - {code} - - ); -} diff --git a/apps/web/src/components/navbar.tsx b/apps/web/src/components/navbar.tsx deleted file mode 100644 index f6697f2..0000000 --- a/apps/web/src/components/navbar.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import Link from "next/link" -import { ThemeToggle } from "./theme-toggle" -import UserButton from "./user-button" - -export function Navbar() { - return ( -
-
-
- - Kites - - -
-
- - -
-
-
- ) -} diff --git a/apps/web/src/components/paste-form.tsx b/apps/web/src/components/paste-form.tsx deleted file mode 100644 index ada27e6..0000000 --- a/apps/web/src/components/paste-form.tsx +++ /dev/null @@ -1,141 +0,0 @@ -"use client" - -import { useState } from "react" -import { useRouter } from "next/navigation" - -export function PasteForm() { - const router = useRouter() - const [loading, setLoading] = useState(false) - const [error, setError] = useState(null) - - async function onSubmit(event: React.FormEvent) { - event.preventDefault() - setLoading(true) - setError(null) - - const formData = new FormData(event.currentTarget) - const data = { - title: formData.get("title"), - content: formData.get("content"), - syntax: formData.get("syntax"), - visibility: formData.get("visibility"), - tags: formData.get("tags")?.toString().split(",").map(t => t.trim()).filter(Boolean), - } - - try { - const res = await fetch("/api/v1/pastes", { - method: "POST", - headers: { "Content-Type": "application/json" }, - body: JSON.stringify(data), - }) - - if (!res.ok) { - const json = await res.json() - throw new Error(JSON.stringify(json.error) || "Failed to create paste") - } - - const created = await res.json() - router.push(`/paste/${created.id}`) - router.refresh() - } catch (err) { - setError(err instanceof Error ? err.message : "Something went wrong") - } finally { - setLoading(false) - } - } - - return ( -
- {error && ( -
- {error} -
- )} - -
- - -
- -
-
- - -
- -
- - -
-
- -
- - -
- -
- -