Skip to content

feat: it's reboot, nextjs upgrade, refactor libs to packages, a complete reboot! #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 87 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
3c1fb16
chore: update node version
dahal May 19, 2025
b4d9e5a
feat: prisma => drizzle and next 15 upgrade attempt
dahal May 21, 2025
8142e2b
feat: fix typesafety issues and refactor prisma query with drizzle
dahal May 21, 2025
bb7412b
feat: reformat files
dahal May 21, 2025
fa2d25a
feat: contd. type, import and query refactor
dahal May 21, 2025
a6d890d
feat: export proper schema and their types, and reformat
dahal May 21, 2025
fd64b86
feat: add few missing packages, few more to come
dahal May 21, 2025
7873bf5
fix: fixing type and enum imports
dahal May 21, 2025
be9089e
chore: reformat
dahal May 21, 2025
160a1eb
feat: install missing packages
dahal May 23, 2025
3835eee
fix: enum imports
dahal May 23, 2025
e616d05
fix: typesafety issues
dahal May 23, 2025
f39d244
fix: more typesafety issues
dahal May 23, 2025
dcf5f10
feat: more typesafety issue fixes on components
dahal May 23, 2025
9218833
fix: isLoading vs isPending trpc state
dahal May 23, 2025
b1b0e13
fix: some interesting typesafety fixes
dahal May 23, 2025
a33cdb8
chore: referencing file with `@/component`
dahal May 23, 2025
bd5bf34
chore: remove unwanted imports
dahal May 23, 2025
2b5e1ee
fix: typecheck
dahal May 23, 2025
8ae2ebd
fix: typecheck
dahal May 23, 2025
8f1ec6a
chore: remove un-necessary import
dahal May 23, 2025
4c910ee
chore: some more typesafety issues
dahal May 23, 2025
339a6e6
feat: component cleanup - checking in
dahal May 23, 2025
0b95fe2
chore: more import and typesafety cleanups
dahal May 23, 2025
fb8e501
feat: fix some more typesafety issues and missing packages
dahal May 24, 2025
9730b27
feat: refactor and document `@captable/db` package
dahal May 24, 2025
3637e06
fix: database, schema, enum all things db import
dahal May 24, 2025
2903a97
feat: replace prisma with drizzle query
dahal May 24, 2025
52aaeca
feat: more prisma - drizzle conversion
dahal May 24, 2025
8171704
feat: more db prisma - drizzle migration, and cuid as primary default id
dahal May 24, 2025
974c48f
fix: drizzling and some high level fixes
dahal May 24, 2025
b563505
fix: some more prisma to drizzle migration
dahal May 24, 2025
d73a407
fix: finally replace prisma with drizzle
dahal May 24, 2025
3ad159d
chore: removing additional layer
dahal May 24, 2025
3543ffc
1
dahal May 24, 2025
50243d6
chore: fixing build errors
dahal May 24, 2025
f88beea
feat: just to many fixes to count, including email getting its own pa…
dahal May 25, 2025
460b64d
chore: reformat
dahal May 25, 2025
476df5c
fix: email stuffs
dahal May 25, 2025
fcf029d
feat: get the build to work -- close
dahal May 26, 2025
e3e5396
feat: create utils package, cleanup email package, and fix more build…
dahal May 26, 2025
20be72b
feat: create cursor/rules for all apps and packages
dahal May 26, 2025
c851c24
fix: email component imports
dahal May 27, 2025
65903b0
chore: looks like NODE_ENV=staging is not a thing
dahal May 27, 2025
a6abd98
chore: fix build warning
dahal May 27, 2025
4f981fd
feat: next.config.js => next.config.ts
dahal May 27, 2025
0d60e90
feat: build finally works 🎉
dahal May 27, 2025
e870d02
feat: finalize email package setup and refactor
dahal May 27, 2025
c6c1c7b
chore: reformat
dahal May 27, 2025
d6b79f2
fix: fixing trpc error
dahal May 27, 2025
37d03b9
fix: fixing some components to make them dark/light compatible
dahal May 27, 2025
744351a
fix: logger package
dahal May 27, 2025
e9035d4
chore: lock in bun 1.2.15
dahal May 29, 2025
3d2c6d8
feat: upgrade next to 15.3.2
dahal May 29, 2025
f8b6e88
feat: updating auth function so migrating to better-auth becomes easier
dahal May 29, 2025
a927971
feat: creating better auth tables
dahal May 29, 2025
dfba6ae
feat: another steps forward to replace next-auth with better-auth
dahal May 29, 2025
154fb1e
feat: next-auth to better-auth - a work in progress
dahal May 30, 2025
95e6052
feat: fixing some session exports
dahal May 30, 2025
305232f
fix: next-auth to better-auth migration, types and other stuffs
dahal May 30, 2025
95d197d
feat: remove all references and files for next-auth
dahal May 30, 2025
bd7c7e1
feat: missing pieces on auth package
dahal May 30, 2025
4ecb32a
feat: seperate client and server for clientSideSession and serverSide…
dahal May 31, 2025
3a235a4
fix: auth related imports
dahal May 31, 2025
cd96d4c
feat: add missing headers
dahal May 31, 2025
0964b76
chore: add missing headers
dahal May 31, 2025
eff0950
feat: fix build errors, and some email package re/org
dahal May 31, 2025
623a75b
fix: email package build errors
dahal May 31, 2025
d3af458
chore: turbo upgrade
dahal May 31, 2025
9ee4817
feat: re/org theme code and fix dark/light mode flickering
dahal May 31, 2025
62ccd1d
whole lot of changes including dark/lite mode support
dahal May 31, 2025
ead4b9b
feat: add missing package
dahal Jun 1, 2025
cd81f52
feat: refactor rbac to its own package (#554)
dahal Jun 1, 2025
9c41244
WIP - reinventing the wheel, with our own queue system
dahal Jun 2, 2025
ad21aaf
chore: reformat
dahal Jun 2, 2025
533ecd5
chore: rename serverless-queue to just queue
dahal Jun 2, 2025
235420a
feat: index table as per the queries we run on jobs
dahal Jun 2, 2025
efc1b31
feat: convert class to function, and update some function names
dahal Jun 2, 2025
b0e2704
chore: fixing some type errors
dahal Jun 2, 2025
492b75f
feat: dev job runner, also fix dx command
dahal Jun 2, 2025
fb68ab2
feat: cleanup jobs demo mode logger
dahal Jun 2, 2025
92f3a0e
feat: update documentations
dahal Jun 2, 2025
27e2d4e
Merge pull request #555 from captableinc/feat/queue
dahal Jun 2, 2025
745ee01
feat: re-organize queue package
dahal Jun 4, 2025
3b6f0e9
feat: supporting both long running process and serverless, and 100% t…
dahal Jun 4, 2025
aa05ee6
Merge pull request #557 from captableinc/feat/queue-refactor
dahal Jun 4, 2025
c5c341b
chore: update queue docs with some relevant information
dahal Jun 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
146 changes: 146 additions & 0 deletions .cursor/rules/apps/captable.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---
description:
globs:
alwaysApply: true
---
# Captable App Rules

## Tech Stack
Next.js 15 + App Router, NextAuth.js, Tailwind + Radix UI, tRPC, TanStack Query, Drizzle ORM

## Key Patterns

### Component Structure
```typescript
"use client" // Only when needed

import { useState } from "react"
import { Button } from "@/components/ui/button"
import { useToast } from "@/hooks/use-toast"

interface Props {
title: string
onAction: () => Promise<void>
}

export function Component({ title, onAction }: Props) {
const [isLoading, setIsLoading] = useState(false)
const { toast } = useToast()

const handleAction = async () => {
try {
setIsLoading(true)
await onAction()
toast({ title: "Success" })
} catch (error) {
toast({ title: "Error", variant: "destructive" })
} finally {
setIsLoading(false)
}
}

return (
<div className="space-y-4">
<h2 className="text-lg font-semibold">{title}</h2>
<Button onClick={handleAction} disabled={isLoading}>
{isLoading ? "Loading..." : "Action"}
</Button>
</div>
)
}
```

### API Routes
```typescript
import { NextRequest, NextResponse } from "next/server"
import { z } from "zod"
import { auth } from "@/lib/auth"
import { db } from "@captable/db"

const schema = z.object({
name: z.string().min(1),
email: z.string().email()
})

export async function POST(request: NextRequest) {
try {
const session = await auth()
if (!session) {
return NextResponse.json({ error: "Unauthorized" }, { status: 401 })
}

const body = await request.json()
const data = schema.parse(body)

const result = await db.insert(table).values({
...data,
userId: session.user.id
}).returning()

return NextResponse.json({ success: true, data: result[0] })
} catch (error) {
return NextResponse.json({ error: "Internal error" }, { status: 500 })
}
}
```

### Forms with react-hook-form
```typescript
import { useForm } from "react-hook-form"
import { zodResolver } from "@hookform/resolvers/zod"
import { z } from "zod"
import { Form, FormField, FormItem, FormLabel, FormControl, FormMessage } from "@/components/ui/form"

const schema = z.object({
name: z.string().min(1, "Required"),
email: z.string().email("Invalid email")
})

export function MyForm() {
const form = useForm({
resolver: zodResolver(schema),
defaultValues: { name: "", email: "" }
})

const onSubmit = (data) => {
// Handle submission
}

return (
<Form {...form}>
<form onSubmit={form.handleSubmit(onSubmit)}>
<FormField
control={form.control}
name="name"
render={({ field }) => (
<FormItem>
<FormLabel>Name</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage />
</FormItem>
)}
/>
</form>
</Form>
)
}
```

## File Organization
- `app/(authenticated)/` - Protected routes
- `app/(unauthenticated)/` - Public routes
- `components/ui/` - Base components
- `components/[feature]/` - Feature components
- `lib/` - Utilities
- `trpc/` - API layer

## Best Practices
- Use Server Components by default
- Add "use client" only when needed
- Validate inputs with Zod
- Use proper TypeScript interfaces
- Follow Tailwind utility-first approach
- Implement proper error handling
- Use `cn()` for conditional classes
98 changes: 98 additions & 0 deletions .cursor/rules/packages/config.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
---
description:
globs:
alwaysApply: true
---
# Config Package Rules

## Tech Stack
Shared TypeScript, Biome, and tool configurations

## TypeScript Configurations

### Base Config
```json
// base.json
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"declaration": true,
"sourceMap": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true
}
}
```

### Next.js Config
```json
// nextjs.json
{
"extends": "./base.json",
"compilerOptions": {
"lib": ["DOM", "DOM.Iterable", "ES2017"],
"jsx": "preserve",
"allowJs": true,
"noEmit": true,
"incremental": true,
"plugins": [{ "name": "next" }]
},
"include": ["**/*.ts", "**/*.tsx", ".next/types/**/*.ts"]
}
```

## Biome Configuration
```json
// biome.json
{
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 80,
"quoteStyle": "double"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"useImportType": "error",
"useConst": "error"
},
"correctness": {
"noUnusedVariables": "warn"
}
}
},
"organizeImports": {
"enabled": true
}
}
```

## Usage
```typescript
// In package tsconfig.json
{
"extends": "@captable/config/nextjs.json",
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["*"]
}
}
}
```

## Best Practices
- Extend base configurations rather than duplicating
- Use consistent formatting rules across packages
- Enable strict TypeScript settings
- Configure proper import organization
- Use environment-specific overrides when needed
17 changes: 17 additions & 0 deletions .cursor/rules/packages/db.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
description:
globs:
alwaysApply: true
---
# Database Package Rules

## Tech Stack
Drizzle ORM + PostgreSQL, Drizzle Zod, Faker.js for seeding

## Best Practices
- Use CUID for primary keys
- Always include createdAt and updatedAt
- Define relations for type-safe joins
- Use Drizzle Zod for validation
- Use transactions for multi-table operations
- Export proper TypeScript types
Loading