Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
9e72cf9
Refactor database structure and update services: replace Prisma with …
Rykuno Dec 30, 2025
63e2671
Refactor storage and authentication services: replace Keyv Redis with…
Rykuno Dec 30, 2025
11f1aee
Update environment configuration and enhance application structure: r…
Rykuno Dec 31, 2025
5cf4962
Update dependencies and refactor authentication services: add @keyv/r…
Rykuno Dec 31, 2025
00791b0
simplified better auth
Rykuno Dec 31, 2025
2afc512
Refactor database integration: replace DatabaseTransactionClient with…
Rykuno Dec 31, 2025
ab0c3e3
update node version
Rykuno Dec 31, 2025
ab302da
Update @types/node version in pnpm-lock.yaml from 24.10.1 to 24.7.2 f…
Rykuno Dec 31, 2025
21ec206
Update image alt text in CardExample component for improved accessibi…
Rykuno Dec 31, 2025
884b355
Update turbo package version from 2.6.1 to 2.7.2 in package.json and …
Rykuno Dec 31, 2025
a143714
Update dependencies in package.json and pnpm-lock.yaml: upgrade @aws-…
Rykuno Dec 31, 2025
a26fda9
Remove OpenAPI definitions and add database migration for user, sessi…
Rykuno Dec 31, 2025
18d90de
Refactor database schema and services: rename database schema files, …
Rykuno Dec 31, 2025
ebf0ed6
Add agent guidelines and update dependencies: Introduce AGENTS.md for…
Rykuno Dec 31, 2025
5f231d6
Implement login functionality and enhance authentication flow: Add Lo…
Rykuno Jan 2, 2026
067315b
Update OTP form: Remove hyperlink from 'Resend' text for improved cla…
Rykuno Jan 2, 2026
413fec4
Refactor better-auth provider: Remove unused import for Provider to s…
Rykuno Jan 2, 2026
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
6 changes: 3 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [24.4.1]
node-version: [25.2.1]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand All @@ -25,7 +25,7 @@ jobs:
- name: ⎔ Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.13.1
version: 10.27.0

- name: Setup Node.js
uses: actions/setup-node@v4
Expand All @@ -41,6 +41,6 @@ jobs:

- name: Lint
run: pnpm lint

- name: Build project
run: pnpm build
1 change: 1 addition & 0 deletions .pnpm-store/v10/projects/9e1b7cceca46cdd071268608ba856edf
85 changes: 85 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Agent Guidelines

## Project Structure

- **Backend**: `apps/api/` - NestJS with Drizzle ORM
- **Frontend**: `apps/web/` - TanStack Start
- **Shared**: `packages/typescript-config/` - Shared TypeScript configs

## Frontend

### Routing (TanStack Start)

- Use Tanstack Start best practices

### Data Fetching (TanStack Query)

- Query keys: `['resource', id, 'sub-resource']`
- Use `invalidateQueries()` without parameters

### Forms (TanStack Forms)

- Use `useForm()`, ShadCN Field components (`Field`, `FieldLabel`, `FieldError`), `form.useField()` for fields

### UI Components (ShadCN + BaseUI)

- Components: `apps/web/src/components/ui/` - ShadCN
- Prefer BaseUI primitives over raw html (`@base-ui/react`)
- Utils: `apps/web/src/lib/utils.ts` - `cn()` helper
- Tailwind CSS with ShadCN design tokens

### Type Safety

- E2E types: `apps/api/generated/openapi.d.ts` (auto-generated)

### Creating Routes/Components

- Routes: `apps/web/src/routes/{path}.tsx` with `createFileRoute()`
- Components: `apps/web/src/components/` using ShadCN UI + `cn()`

## Backend

### Database

- Schema: `apps/api/src/databases/drizzle.schema.ts`
- Tables: `apps/api/src/databases/tables/*.table.ts`
- Utils: `apps/api/src/databases/drizzle.utils.ts`
- Provider: `apps/api/src/databases/drizzle.provider.ts`

### Authentication

- Provider: `apps/api/src/auth/better-auth.provider.ts`
- Guard: `apps/api/src/auth/guards/auth.guard.ts`
- Decorators: `@Auth()`, `@ActiveUser()`, `@ActiveSession()`

### Transactions

- Use `@Transactional()` decorator
- Inject `TransactionHost<DrizzleTransactionClient>`
- Don't manually wrap with `tx.transaction()`

### Services

- Providers for external clients (Better Auth, Drizzle)
- Services handle business logic
- Export providers with `Inject*()` helpers

### Error Handling

- Use NestJS exceptions (`NotFoundException`, `UnauthorizedException`, etc.)

### Type Safety

- E2E types: `apps/api/generated/openapi.d.ts` (auto-generated)
- Use `Serialize` decorator for DTO transformation

### Creating Tables

1. Create `apps/api/src/databases/tables/{name}.table.ts`
2. Export from `drizzle.schema.ts`
3. Add relations in `drizzle.relations.ts`

## Important Notes

- Don't nest transactions - use `@Transactional()` decorator
- Avoid `as any` - use proper types or `as` with specific types
27 changes: 15 additions & 12 deletions apps/api/.env.example
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
# app
PORT=8000
BASE_URL=http://localhost:8000
NODE_ENV=development
APP_NAME=SojuStack
APP_PORT=8000
APP_URL=http://localhost:8000
APP_WEB_URL=http://localhost:3000

# better-auth
# auth
AUTH_SECRET=CHANGE_THIS_FOR_PROD

# databases
POSTGRES_URL=postgres://postgres:postgres@localhost:5432/postgres
REDIS_URL=redis://localhost:6379
# database
DATABASE_URL=postgres://postgres:postgres@localhost:5432/postgres

# cache
CACHE_URL=redis://localhost:6379

# email
EMAIL_DOMAIN=example.com
MAIL_DOMAIN=example.com

# storage
STORAGE_HOST=localhost
STORAGE_PORT=9000
STORAGE_ACCESS_KEY=user
STORAGE_SECRET_KEY=password
STORAGE_URL=http://localhost:9000
STORAGE_REGION=us-east-1
STORAGE_ACCESS_KEY=admin
STORAGE_SECRET_KEY=admin
2 changes: 2 additions & 0 deletions apps/api/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ pids

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
.nestjs_repl_history
generated
1 change: 1 addition & 0 deletions apps/api/.nestjs_repl_history
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
$(AppService).getHello()
Copy link

Choose a reason for hiding this comment

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

REPL history file accidentally committed to repository

The .nestjs_repl_history file is a local development artifact containing REPL command history. While it was added to .gitignore, the file itself was also committed to the repository. This file should be removed from tracking since it's user-specific development data and not intended to be shared.

Fix in Cursor Fix in Web

12 changes: 12 additions & 0 deletions apps/api/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// @ts-nocheck
import 'dotenv/config';
import { defineConfig } from 'drizzle-kit';

export default defineConfig({
dialect: 'postgresql',
schema: './src/databases/drizzle.schema.ts',
out: './src/databases/migrations',
dbCredentials: {
url: process.env['DATABASE_URL']!,
},
});
Loading