Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
  •  
  •  
  •  
692 changes: 692 additions & 0 deletions .cursor/rules/general-frontend-rules.mdc

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions .cursor/rules/ide-and-eslint-priorities.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
alwaysApply: true
description: Focus on logical correctness first; ignore IDE ESLint/TypeScript errors limited to formatting, import order, or unresolved type dependencies until requested to fix.
---

### ESLint and TypeScript IDE errors handling

- **Ignore non-blocking IDE errors**: After making code changes, do not block on IDE ESLint/TypeScript errors related to:
- **Code formatting style** (prettier/eslint formatting rules)
- **Import order** (sorting/grouping of imports)
- **Unresolved TypeScript dependencies** (types missing from node_modules or ambient type packages that do not affect runtime when logic is clear)
- **Prioritize logic**: Propose and apply edits when the logic is sound, even if the IDE shows the above categories of errors.
- **Fix on request**: Only address these styling/import-order/type-dependency issues when specifically asked or when focusing on cleanup.
- **Still fix real breakages**: Do not ignore syntax errors, missing symbols, build/test failures, or type errors that impact program correctness or compilation.
- **Avoid noisy churn**: Do not auto-reformat or re-order imports unrelated to the change unless explicitly requested.
26 changes: 26 additions & 0 deletions .cursor/rules/server-client-connection.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
alwaysApply: true
description: Server-client DTO mapping conventions and Index service mapping reference
---

# Server - Client Connection

## Server ⇄ Client Type Mapping Guide

This rule documents how server-side request/response types are mapped into client-side DTOs, and provides a reference for the Index service. Server Zod schemas and types live in [backend/cms/src/service/index/index.types.ts](mdc:backend/cms/src/service/index/index.types.ts). Client DTOs live in [frontend/desk/src/state/repository/index.dto.ts](mdc:frontend/desk/src/state/repository/index.dto.ts).

### Naming Conventions

Terms in the left of arrow are used as server types, terms in the right side are for client dto.

- Req → Input
- Res → Output
- Get → Query
- Post → Create
- Patch → Update
- Delete → Output contains `success: boolean`

Additional notes:

- Zod schemas are exported as `export const ...Input = z.object(...)` and the inferred types as `export type ...Input = z.infer<typeof ...Input>`.
- Domain entities (e.g., `Index`, `Slug`) come from `shared/types` and should be reused in both server and client.
3 changes: 3 additions & 0 deletions .cursor/rules/typescript-convention.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
alwaysApply: true
---
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ web_modules/
.env.test.local
.env.production.local
.env.local
!.env.*.example
!.env.example

# parcel-bundler cache (https://parceljs.org/)
.cache
Expand Down Expand Up @@ -472,4 +474,4 @@ $RECYCLE.BIN/
.husky

# tsconfig
!tsconfig.base.json
!tsconfig.base.json
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v22.16.0
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ node_modules/**/*

# git
.git/**/*
**/.git/**/*
**/.git/**/*

# legacy
legacy/**/*
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"printWidth": 120,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
Expand Down
11 changes: 10 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
{}
{
"editor.formatOnPaste": true,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"eslint.useFlatConfig": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "always"
},
"typescript.tsdk": "node_modules/typescript/lib"
}
2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ enableGlobalCache: false
nodeLinker: node-modules

npmPublishAccess: public

nmHoistingLimits: workspaces
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# the-codec

Codex 복수 int id

Index 단수 int id

Verse 트리구조 UUID
10 changes: 10 additions & 0 deletions backend/cms/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# General
PORT=


# DB
POSTGRES_PORT=
POSTGRES_DB=
POSTGRES_USER=
POSTGRES_PASSWORD=
POSTGRES_DB_URL=postgres://<user>:<password>@localhost:<port>/<database>
28 changes: 28 additions & 0 deletions backend/cms/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# dev
.yarn/
!.yarn/releases
.vscode/*
!.vscode/launch.json
!.vscode/*.code-snippets
.idea/workspace.xml
.idea/usage.statistics.xml
.idea/shelf

# deps
node_modules/

# env
.env
.env.production

# logs
logs/
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# misc
.DS_Store
25 changes: 25 additions & 0 deletions backend/cms/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# CMS

## Development

```bash
# Run database in docker
# Run only once when database is not running
yarn db:run

# dev server
yarn cms dev
```

## DB

```bash
# Auto-generate migration file
yarn cms db:generate --name={migration_name}

# Generate custom migration file (write SQL statements as you want)
yarn cms db:generate --custom --name={custom_migration_name}

# Apply new migration files
yarn cms db:migrate
```
11 changes: 11 additions & 0 deletions backend/cms/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
services:
postgres:
image: postgres:17
container_name: postgres_cms
restart: always
ports:
- ${POSTGRES_PORT}:5432
environment:
POSTGRES_DB: ${POSTGRES_DB}
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
13 changes: 13 additions & 0 deletions backend/cms/drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from "drizzle-kit";

import { env } from "./src/env";

export default defineConfig({
out: "./drizzle",
schema: "./src/db/db.schema.ts",
dialect: "postgresql",
casing: "snake_case",
dbCredentials: {
url: env.POSTGRES_DB_URL,
},
});
56 changes: 56 additions & 0 deletions backend/cms/drizzle/0000_add_user_and_index.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
CREATE TABLE "index_bodies" (
"id" serial PRIMARY KEY NOT NULL,
"index_id" integer NOT NULL,
"body" text DEFAULT '' NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"deleted_at" timestamp
);
--> statement-breakpoint
CREATE TABLE "index_slugs" (
"id" serial PRIMARY KEY NOT NULL,
"index_id" integer NOT NULL,
"slug" varchar(200) NOT NULL,
"type" varchar(50) NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"deleted_at" timestamp,
CONSTRAINT "index_slugs_slug_unique" UNIQUE("slug")
);
--> statement-breakpoint
CREATE TABLE "indexes" (
"id" serial PRIMARY KEY NOT NULL,
"name" varchar(200) NOT NULL,
"description" varchar(2000),
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"deleted_at" timestamp,
"published_at" timestamp,
"unpublished_at" timestamp
);
--> statement-breakpoint
CREATE TABLE "users" (
"id" serial PRIMARY KEY NOT NULL,
"name" varchar(200) NOT NULL,
"created_at" timestamp DEFAULT now() NOT NULL,
"updated_at" timestamp DEFAULT now() NOT NULL,
"deleted_at" timestamp
);
--> statement-breakpoint
ALTER TABLE "index_bodies" ADD CONSTRAINT "index_bodies_index_id_indexes_id_fk" FOREIGN KEY ("index_id") REFERENCES "public"."indexes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
ALTER TABLE "index_slugs" ADD CONSTRAINT "index_slugs_index_id_indexes_id_fk" FOREIGN KEY ("index_id") REFERENCES "public"."indexes"("id") ON DELETE no action ON UPDATE no action;--> statement-breakpoint
CREATE INDEX "index_bodies_index_id_index" ON "index_bodies" USING btree ("index_id");--> statement-breakpoint
CREATE INDEX "index_bodies_created_at_index" ON "index_bodies" USING btree ("created_at");--> statement-breakpoint
CREATE INDEX "index_bodies_updated_at_index" ON "index_bodies" USING btree ("updated_at");--> statement-breakpoint
CREATE INDEX "index_slugs_index_id_index" ON "index_slugs" USING btree ("index_id");--> statement-breakpoint
CREATE INDEX "index_slugs_slug_index" ON "index_slugs" USING btree ("slug");--> statement-breakpoint
CREATE INDEX "index_slugs_created_at_index" ON "index_slugs" USING btree ("created_at");--> statement-breakpoint
CREATE INDEX "index_slugs_updated_at_index" ON "index_slugs" USING btree ("updated_at");--> statement-breakpoint
CREATE INDEX "indexes_name_index" ON "indexes" USING btree ("name");--> statement-breakpoint
CREATE INDEX "indexes_created_at_index" ON "indexes" USING btree ("created_at");--> statement-breakpoint
CREATE INDEX "indexes_updated_at_index" ON "indexes" USING btree ("updated_at");--> statement-breakpoint
CREATE INDEX "indexes_published_at_index" ON "indexes" USING btree ("published_at");--> statement-breakpoint
CREATE INDEX "indexes_unpublished_at_index" ON "indexes" USING btree ("unpublished_at");--> statement-breakpoint
CREATE INDEX "users_name_index" ON "users" USING btree ("name");--> statement-breakpoint
CREATE INDEX "users_created_at_index" ON "users" USING btree ("created_at");--> statement-breakpoint
CREATE INDEX "users_updated_at_index" ON "users" USING btree ("updated_at");
Loading