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
  •  
  •  
  •  
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/**/*
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
38 changes: 38 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# AGENTS.md

Guidelines for Codex (the agent) working in this repository.

## 1. General Engineering Guidelines

- Before implementing:
- State assumptions explicitly. If uncertain, ask.
- If multiple interpretations exist, present them instead of silently picking one.
- If a simpler approach exists, say so and push back when warranted.
- If a decision involves tradeoffs, state them clearly up front
- If something is unclear, stop. Name what is confusing, and ask.
- Simplicity first: Avoid over-engineering. Choose the most maintainable minimal approach first.

## 2. React / Typescript-Specific Guidelines

- React
- Component name always use pascal casing.

## 3. Project Conventions

### 3.1 Naming Conventions

- Prefer singular directory names by default in frontend projects. For example, use `component` instead of `components`, and `context` instead of `contexts`.
- Avoid using dash or underscore in file name.
- Page / layout files
- `.tsx` files that located in `ui` directory and filename ends with `.page.tsx` or `.layout.tsx` are page or layout file.
- Page and layout files use camel case for name. Like `myPage.page.tsx`.
- If a page/layout has local styles, `.scss` file that imported in each page or layout file shares same file name. Like `myPage.page.module.scss`.
- React component files
- `.tsx` files that located in `component` directory, or located in `ui` directory and is not `Page / layout file`, are React component files.
- `.tsx` file is usually placed in directory that has the same name with the component defined inside. For the simple logic-only components like context providers, it's allowed to be unwrapped in normal directory. But always keep consistency between components placed in same directory.
- `.tsx` file has the same name with component defined inside.
- If a component has local styles, place the SCSS module file in the same directory and use the same base name as the component (e.g. `MyComponent/MyComponent.module.scss`).
- Good example:
- `MyComponent`
- `MyComponent.tsx`
- `MyComponent.module.scss`
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