Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
a6886d8
Add `createInstance` mutation
2chanhaeng Jul 23, 2026
397a023
Add `createInstance` tests
2chanhaeng Jul 23, 2026
1438a46
Add mise dependencies watchwoman
dodok8 Jul 22, 2026
28fdcc1
Add solid-relay dependencies
dodok8 Jul 22, 2026
99d12e5
Add solid-relay dependencies
dodok8 Jul 22, 2026
55dee48
Add graphql schema to .gitignore
dodok8 Jul 23, 2026
7cb40c4
Add index.db to .gitginore
dodok8 Jul 23, 2026
9e00631
Update check files to ignore __gnerated__
dodok8 Jul 23, 2026
bf52377
Remove watchwoman
dodok8 Jul 23, 2026
7c3ac30
Add Realy Config
dodok8 Jul 23, 2026
c8437fd
Add allowed unpopular packages pglite-cli
dodok8 Jul 23, 2026
9ea647d
Update vite.config to bypass watchman
dodok8 Jul 23, 2026
b3fafdf
Set lateset to fixed version
dodok8 Jul 23, 2026
6b8a453
Turn off node/no-top-level-await rule
dodok8 Jul 23, 2026
e53b41d
Update .gitignore to ignore generated ts file
dodok8 Jul 23, 2026
2ac1d80
Set graphql sever URI Configurable
dodok8 Jul 25, 2026
8ca0676
Seperate build:server command
dodok8 Jul 26, 2026
0de347a
Delete HomeViewerQuery.graphql.ts
dodok8 Jul 26, 2026
45f2f41
Ignore __generated__/
dodok8 Jul 26, 2026
72d36d5
Enable --noWatchman Option
dodok8 Jul 26, 2026
6b50e06
Disable oxc/no-async-await
dodok8 Jul 23, 2026
d4ff2cc
Create sign-in.tsx
dodok8 Jul 23, 2026
c8b461e
FIXME: Add allowlist
dodok8 Jul 23, 2026
d03b5ea
Turn off eslint/max-lines-per-function rule
dodok8 Jul 23, 2026
86ffbbc
Solve CORS Problem
dodok8 Jul 25, 2026
ed8e86c
Add Sign-in Page
dodok8 Jul 23, 2026
224ecd2
Add confirm/slug page
dodok8 Jul 23, 2026
953fb85
Add drfed.css
dodok8 Jul 25, 2026
b1803c3
Update Design of Sign-In Page
dodok8 Jul 25, 2026
3c95d7f
Enable Temporal in @drfed/web
sij411 Jul 25, 2026
fc0e7b2
Add session
sij411 Jul 26, 2026
6a9f11c
Authenticate Relay requests with session Cookie
sij411 Jul 26, 2026
06df164
Change placeholder texts to DrFed
dodok8 Jul 28, 2026
2a8a5af
Remove unnecessary duplicate pnpm-lock.yaml
dahlia Jul 28, 2026
cc34cc9
Use official TypeScript 7 compiler
dahlia Jul 28, 2026
8e20842
Turn off promise/avoid-new
dodok8 Jul 30, 2026
f1e68f6
Update mutation to server action
dodok8 Jul 30, 2026
e8a7f20
Update fetch logic to server action
dodok8 Jul 31, 2026
31aad73
Split style sheet per page
dodok8 Jul 31, 2026
494d037
Fix typo in filename RelayEnvironment
dodok8 Aug 1, 2026
a89930d
Add package Faker.js
dodok8 Aug 1, 2026
9382266
Make workspace/create/instance
dodok8 Aug 1, 2026
60236bf
Update Design of Create Instance Page
dodok8 Aug 1, 2026
413d6e3
Remove duplicated License header
dodok8 Aug 1, 2026
a6a53b5
Update dependencies
dodok8 Aug 4, 2026
3a43aee
Change port number in allowlist
dodok8 Aug 4, 2026
8bff275
Turn off oxc/no-rest-spread-properties
dodok8 Aug 4, 2026
c52cd08
Disable cjsIntrop exclude SSR
dodok8 Aug 4, 2026
e68f21f
Apply @solidjs/start@^2.0.0
dodok8 Aug 5, 2026
e8f9ad6
Apply proxy setting for graphql
dodok8 Aug 4, 2026
6eb77fc
Add empty actor create page
sij411 Aug 13, 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
3 changes: 3 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
branches: ["**"]
tags: ["*.*.*"]

env:
AUBE_ALLOWED_UNPOPULAR_PACKAGES: pglite-cli

jobs:
check:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
.DS_Store
*.graphql
*.graphql.ts
__generated__/

.pgdata/

node_modules/
packages/*/dist/

index.db
3 changes: 2 additions & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"**/dist/*.{cjs,d.cts,d.mts,d.ts,js,mjs}",
".agents/skills/",
".claude/skills/",
"plans/"
"plans/",
"**/__generated__/**"
]
}
8 changes: 7 additions & 1 deletion .oxlintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,13 @@
"always",
{ "ignoreConsecutiveComments": true }
],
"eslint/curly": ["error", "multi-line"],
"node/no-top-level-await": "off",
"oxc/no-optional-chaining": "off",
"oxc/no-async-await": "off",
"eslint/eqeqeq": ["off", "smart"],
"eslint/func-style": ["off"],
"eslint/max-lines-per-function": "off",
"eslint/id-length": ["warn", { "exceptionPatterns": ["^_", "^[Tertv]$"] }],
"eslint/init-declarations": "off",
"eslint/max-params": ["warn", { "max": 4 }],
Expand All @@ -34,7 +39,7 @@
"eslint/prefer-destructuring": ["warn", { "object": true, "array": false }],
"eslint/no-continue": "off",
"eslint/no-eq-null": "off",
"eslint/no-magic-numbers": "warn",
"eslint/no-magic-numbers": "off",
"eslint/no-ternary": "off",
"eslint/no-nested-ternary": "off",
"eslint/no-undefined": "off",
Expand All @@ -45,6 +50,7 @@
"error",
{ "allowSeparatedGroups": true, "ignoreDeclarationSort": true }
],
"oxc/no-rest-spread-properties": "off",
"import/consistent-type-specifier-style": "off",
"import/exports-last": "off",
"import/group-exports": "off",
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ mise run dev

`mise run check` runs all checks currently configured in *mise.toml*:

- TypeScript type checking with `tsgo --noEmit`.
- TypeScript type checking with `tsc --noEmit`.
- TypeScript/JavaScript formatting with `oxfmt --check`.
- Markdown formatting with `hongdown --check`.
- *mise.toml* formatting with `mise fmt --check`.
Expand Down
42 changes: 28 additions & 14 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ min_version = "2026.6.10"

[tools]
"aqua:dahlia/hongdown" = "0.4.3"
"github:nushell/nushell" = "latest"
"github:nushell/nushell" = "0.114.1"
node = "26"
"npm:@typescript/native-preview" = "7.0.0-dev.20260620.1"
"npm:oxlint" = "latest"
"npm:oxlint-tsgolint" = "latest"
"npm:pglite-cli" = "latest"
"npm:oxlint" = "1.75.0"
"npm:oxlint-tsgolint" = "7.0.2001"
"npm:pglite-cli" = "0.0.1"
oxfmt = "0.55.0"
pnpm = "11"

Expand All @@ -17,18 +16,34 @@ auto = true
[hooks]
postinstall = ["mise deps", "mise generate git-pre-commit --task check --write"]

[tasks.build]
description = "Build the project"
depends = ["build:web"]
silent = "stdout"

[tasks."build:server"]
description = "Build the project except web"
run = "pnpm --parallel -F @drfed/graphql -F @drfed/models -F @drfed/drfed build"
silent = "stdout"

[tasks."build:web"]
description = "Build SolidStart frontend server"
depends = [
{ task = "generate:graphql-schema", args = [
"--output-file",
"packages/web/schema.graphql",
] },
]
dir = "./packages/web"
run = "pnpm run build"
run = "pnpm exec relay-compiler --noWatchman && pnpm run build"

[tasks.check]
description = "Check all"
depends = ["check:*"]

[tasks."check:types"]
description = "Check TypeScript types"
run = "pnpm --recursive exec tsgo --noEmit"
run = "pnpm --recursive exec tsc --noEmit"

[tasks."check:lint"]
description = "Check linting"
Expand Down Expand Up @@ -77,11 +92,6 @@ run = """
node scripts/add-license/main.mts
"""

[tasks.build]
description = "Build the project"
run = "pnpm run --parallel --recursive build"
silent = "stdout"

[tasks.test]
description = "Run tests"
depends = ["build"]
Expand Down Expand Up @@ -130,7 +140,7 @@ description = "Generate GraphQL schema"
usage = """
flag "-o --output-file <file>" help="The output file for the generated GraphQL schema. - for stdout. Defaults to -"
"""
depends = ["build"]
depends = ["build:server"]
run = """
#!/usr/bin/env nu
let output_file = (if "usage_output_file" in $env { $env.usage_output_file } else { "-" })
Expand All @@ -154,7 +164,11 @@ run = "node scripts/dev.mts"
raw_args = true
description = "Run SolidStart frontend server"
dir = "./packages/web"
run = "pnpm run dev"
run = """
#!/usr/bin/env nu
mise run generate:graphql-schema --output-file ./packages/web/schema.graphql
pnpm run dev
"""

[tasks."drfed-server"]
description = "Invoke drfed-server command"
Expand Down
3 changes: 2 additions & 1 deletion packages/drfed/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
},
"tsdown": {
"dts": {
"sourcemap": true
"sourcemap": true,
"tsconfig": "../../tsconfig.drfed.json"
},
"sourcemap": true
},
Expand Down
15 changes: 15 additions & 0 deletions packages/drfed/src/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ export default async function seedData(db: Database): Promise<void> {
});
}

const sessionId = "00000000-0000-4000-8000-000000000000";
const accountId = "00000000-0000-4000-8000-000000000001";
const memberId = "00000000-0000-4000-8000-000000000002";
const pendingMemberId = "00000000-0000-4000-8000-000000000003";
const created = new Date("2026-06-24T00:00:00.000Z");
const tokenHash = "dev-token-hash";

async function seedAccounts(db: Database): Promise<void> {
await db
Expand All @@ -51,4 +53,17 @@ async function seedAccounts(db: Database): Promise<void> {
},
])
.onConflictDoNothing();
await db
.insert(schema.sessions)
.values([
{
id: sessionId,
accountId,
tokenHash,
},
])
.onConflictDoUpdate({
target: schema.sessions.id,
set: { tokenHash },
});
}
7 changes: 5 additions & 2 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
"src/schema.ts"
],
"dts": {
"sourcemap": true
"sourcemap": true,
"tsconfig": "../../tsconfig.graphql.json"
},
"sourcemap": true
},
Expand All @@ -100,11 +101,13 @@
"@pothos/plugin-drizzle": "^0.17.4",
"@pothos/plugin-errors": "^4.9.1",
"@pothos/plugin-relay": "^4.7.0",
"@pothos/plugin-scope-auth": "^4.1.7",
"@upyo/core": "catalog:",
"@upyo/mock": "catalog:",
"drizzle-orm": "catalog:",
"graphql": "catalog:",
"graphql-scalars": "^1.25.0",
"graphql-yoga": "^5.21.2"
"graphql-yoga": "^5.21.2",
"uuid": "catalog:"
}
}
4 changes: 4 additions & 0 deletions packages/graphql/src/auth/hash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export const hashSecret = async (raw: string): Promise<string> =>

const textEncoder = new TextEncoder();

// FIXME: We should use `SubtleCrypto.verify()` instead of comparing the HMACs
// ourselves. https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify#hmac
export async function equalSecretHashes(
leftHash: string,
rightHash: string,
Expand All @@ -47,6 +49,8 @@ export async function equalSecretHashes(

return difference === 0;
}
// FIXME: We should store the key in a secure place and not generate it
// every time the server starts.
const compareKey = await crypto.subtle.generateKey(
{ name: "HMAC", hash: "SHA-256" },
false,
Expand Down
16 changes: 15 additions & 1 deletion packages/graphql/src/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import SchemaBuilder, { type ObjectRef } from "@pothos/core";
import DrizzlePlugin from "@pothos/plugin-drizzle";
import ErrorsPlugin from "@pothos/plugin-errors";
import RelayPlugin from "@pothos/plugin-relay";
import ScopeAuthPlugin from "@pothos/plugin-scope-auth";
import type { Transport } from "@upyo/core";
import { getTableConfig } from "drizzle-orm/pg-core";
import { DateTimeResolver, UUIDResolver } from "graphql-scalars";
Expand Down Expand Up @@ -95,6 +96,10 @@ export interface SchemaTypes {
};
DefaultFieldNullability: false;
DrizzleRelations: typeof relations;
AuthScopes: {
authenticated: boolean;
admin: boolean;
};
}

export type DrFedSchemaTypes =
Expand All @@ -118,8 +123,17 @@ export const builder = new SchemaBuilder<SchemaTypes>({
getTableConfig,
relations,
},
plugins: [DrizzlePlugin, RelayPlugin, ErrorsPlugin],
plugins: [DrizzlePlugin, RelayPlugin, ErrorsPlugin, ScopeAuthPlugin],
errors: { defaultTypes: [] },
scopeAuth: {
authorizeOnSubscribe: true,
authScopes(context) {
return {
authenticated: Boolean(context.session),
admin: Boolean(context.account?.admin),
};
},
},
});

builder.addScalarType("DateTime", DateTimeResolver);
Expand Down
13 changes: 12 additions & 1 deletion packages/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ export function createYogaServer(
): YogaServerInstance<ServerContext, UserContext> {
const options = fillOptions(_options);
return createYoga({
cors: {
origin: [...options.origins],
credentials: true,
},
async context(ctx) {
const anonymous = { db, request: ctx.request, ...options };
const accessToken = getAccessToken(ctx.request.headers);
Expand Down Expand Up @@ -92,7 +96,14 @@ function mockTransport() {
const fillOptions = (opt: YogaServerOptions): Required<YogaServerOptions> => ({
mailer: opt?.mailer ?? mockTransport(),
emailFrom: opt?.emailFrom ?? "[email protected]",
origins: opt?.origins ?? new Set(["https://drfed.org"]),
// FIXME: Properly parametrize the following allowlist:
origins:
opt?.origins ??
new Set([
"https://drfed.org",
"http://localhost:3000",
"http://0.0.0.0:3000",
]),
});

const getAccessToken = (headers: Headers) =>
Expand Down
Loading