Skip to content

Commit e9fa25a

Browse files
authored
HIDRA Update (#38)
* refactor(env,auth): update JWKS endpoints * chore: format based on default Biome styles * feature: add Tiltfile * refactor(plugins): set `plugin.ts` extension * refactor(plugins): set `plugin.ts` extensions * fix(plugins): fix barrel * chore: add TODO * chore: remove unused code * chore: add TODO * chore: add TODO * refactor(use-auth): handle opaque access token by fetching from OIDC userinfo * chore: set type import * build(deps): upgrade dependencies * chore: format * refactor: extract auth issuer env vars * refactor: change configs file extension * fix: fix file extensions * chore(graphile): update exec schema * fix: fix file extensions * chore(env): update TODOs * chore(env): remove `AUTH_JWKS_URL` * chore(use-auth): update TODOs * build(deps): upgrade Graphile dependencies * build(scripts): generate and migrate DB before starting * feature: add Dockerfile, .dockerignore * feature(docker): add build step * build(deps): rollback Graphile dependencies * build(scripts): remove DB generation from start script * chore: remove Docker
1 parent d9843d1 commit e9fa25a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+330
-235
lines changed

.env.development

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
AUTH_JWKS_URL="https://hidra.omni.dev/realms/test/protocol/openid-connect/certs"
1+
# TODO change once base path changes (https://linear.app/omnidev/issue/OMNI-254/move-apiauth-paths-to-base-path-or-subpath-eg-auth)
2+
AUTH_BASE_URL="https://localhost:8000/api/auth"

.env.production

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
AUTH_JWKS_URL="https://hidra.omni.dev/realms/omni/protocol/openid-connect/certs"
1+
# TODO change once base path changes (https://linear.app/omnidev/issue/OMNI-254/move-apiauth-paths-to-base-path-or-subpath-eg-auth)
2+
AUTH_BASE_URL="https://identity.omni.dev/api/auth"

Tiltfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# load environment variables
2+
load("ext://dotenv", "dotenv")
3+
4+
dotenv(fn=".env.local")
5+
6+
project_name = "backfeed-api"
7+
8+
local_resource(
9+
"install-deps-%s" % project_name,
10+
cmd="bun i",
11+
deps=["package.json"],
12+
labels=[project_name],
13+
)

biome.json renamed to biome.jsonc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,5 @@
2929
"noNonNullAssertion": "off"
3030
}
3131
}
32-
},
33-
"javascript": {
34-
"formatter": {
35-
"quoteStyle": "double",
36-
"arrowParentheses": "always",
37-
"semicolons": "always",
38-
"trailingCommas": "es5"
39-
}
4032
}
4133
}

bun.lock

Lines changed: 115 additions & 49 deletions
Large diffs are not rendered by default.

drizzle.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from "drizzle-kit";
22

3-
import { DATABASE_URL } from "./src/lib/config/env";
3+
import { DATABASE_URL } from "./src/lib/config/env.config";
44

55
export default defineConfig({
66
out: "./src/lib/drizzle/migrations",

graphile.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { PostGraphileConnectionFilterPreset } from "postgraphile-plugin-connecti
44
import { makePgService } from "postgraphile/adaptors/pg";
55
import { PostGraphileAmberPreset } from "postgraphile/presets/amber";
66

7-
import { DATABASE_URL, isProdEnv } from "./src/lib/config/env";
7+
import { DATABASE_URL, isProdEnv } from "./src/lib/config/env.config";
88
import {
99
CommentRBACPlugin,
1010
DownvoteRBACPlugin,

package.json

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"scripts": {
66
"dev": "GRAPHILE_ENV=development NODE_ENV=development bun run --hot src/server.ts",
77
"build": "bun build --target node --outdir build src/server.ts",
8-
"start": "GRAPHILE_ENV=production NODE_ENV=production bun run build/server.js",
8+
"start": "GRAPHILE_ENV=production NODE_ENV=production bun db:migrate && GRAPHILE_ENV=production NODE_ENV=production bun run build/server.js",
99
"lint": "biome lint src",
1010
"format": "biome format --write src",
1111
"db:check": "bun --env-file .env.local drizzle-kit check",
@@ -22,33 +22,36 @@
2222
},
2323
"devDependencies": {
2424
"@biomejs/biome": "^1.9.4",
25-
"@faker-js/faker": "^9.1.0",
26-
"@types/bun": "^1.1.12",
27-
"@types/node": "^22.8.6",
28-
"@types/pg": "^8.11.10",
29-
"drizzle-kit": "^0.30.1",
30-
"husky": "^9.1.6",
31-
"replace-in-file": "^8.2.0",
32-
"typescript": "^5.6.3"
25+
"@faker-js/faker": "^9.6.0",
26+
"@types/bun": "^1.2.8",
27+
"@types/node": "^22.13.14",
28+
"@types/pg": "^8.11.11",
29+
"drizzle-kit": "^0.30.6",
30+
"husky": "^9.1.7",
31+
"replace-in-file": "^8.3.0",
32+
"typescript": "^5.8.2"
3333
},
3434
"dependencies": {
35-
"@envelop/generic-auth": "^8.0.1",
35+
"@envelop/generic-auth": "^9.1.3",
3636
"@envelop/parser-cache": "^8.1.3",
3737
"@envelop/validation-cache": "^8.1.3",
3838
"@escape.tech/graphql-armor": "^3.1.2",
3939
"@graphile/pg-aggregates": "0.2.0-beta.7",
4040
"@graphile/simplify-inflection": "8.0.0-beta.5",
4141
"dayjs": "^1.11.13",
42-
"drizzle-orm": "^0.38.2",
43-
"drizzle-seed": "^0.3.0",
42+
"drizzle-orm": "^0.41.0",
43+
"drizzle-seed": "^0.3.1",
4444
"graphile-export": "0.0.2-beta.24",
45-
"graphql": "^16.9.0",
46-
"graphql-yoga": "^5.8.0",
47-
"hono": "^4.6.8",
48-
"jose": "^5.9.6",
49-
"pg": "^8.13.1",
45+
"graphql": "^16.10.0",
46+
"graphql-yoga": "^5.13.2",
47+
"hono": "^4.7.5",
48+
"jose": "^6.0.10",
49+
"pg": "^8.14.1",
5050
"postgraphile": "5.0.0-beta.37",
5151
"postgraphile-plugin-connection-filter": "3.0.0-beta.7"
5252
},
53-
"trustedDependencies": ["@biomejs/biome", "esbuild"]
53+
"trustedDependencies": [
54+
"@biomejs/biome",
55+
"esbuild"
56+
]
5457
}

src/generated/graphql/schema.executable.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ const spec_downvote = {
148148
}),
149149
description: undefined,
150150
extensions: {
151-
oid: "62509",
151+
oid: "64252",
152152
isTableLike: true,
153153
pg: {
154154
serviceName: "main",
@@ -228,7 +228,7 @@ const spec_invitation = {
228228
}),
229229
description: undefined,
230230
extensions: {
231-
oid: "62609",
231+
oid: "64351",
232232
isTableLike: true,
233233
pg: {
234234
serviceName: "main",
@@ -308,7 +308,7 @@ const spec_upvote = {
308308
}),
309309
description: undefined,
310310
extensions: {
311-
oid: "62422",
311+
oid: "64165",
312312
isTableLike: true,
313313
pg: {
314314
serviceName: "main",
@@ -400,7 +400,7 @@ const spec_comment = {
400400
}),
401401
description: undefined,
402402
extensions: {
403-
oid: "62489",
403+
oid: "64232",
404404
isTableLike: true,
405405
pg: {
406406
serviceName: "main",
@@ -469,7 +469,7 @@ const spec_organization = {
469469
description: undefined,
470470
codec: TYPES.text,
471471
notNull: true,
472-
hasDefault: true,
472+
hasDefault: false,
473473
extensions: {
474474
tags: {},
475475
canSelect: true,
@@ -480,7 +480,7 @@ const spec_organization = {
480480
}),
481481
description: undefined,
482482
extensions: {
483-
oid: "62384",
483+
oid: "64127",
484484
isTableLike: true,
485485
pg: {
486486
serviceName: "main",
@@ -596,7 +596,7 @@ const spec_project = {
596596
}),
597597
description: undefined,
598598
extensions: {
599-
oid: "62408",
599+
oid: "64151",
600600
isTableLike: true,
601601
pg: {
602602
serviceName: "main",
@@ -724,7 +724,7 @@ const spec_post = {
724724
}),
725725
description: undefined,
726726
extensions: {
727-
oid: "62398",
727+
oid: "64141",
728728
isTableLike: true,
729729
pg: {
730730
serviceName: "main",
@@ -742,7 +742,7 @@ const roleCodec = enumCodec({
742742
values: ["owner", "admin", "member"],
743743
description: undefined,
744744
extensions: {
745-
oid: "62528",
745+
oid: "64271",
746746
pg: {
747747
serviceName: "main",
748748
schemaName: "public",
@@ -819,7 +819,7 @@ const spec_member = {
819819
}),
820820
description: undefined,
821821
extensions: {
822-
oid: "62444",
822+
oid: "64187",
823823
isTableLike: true,
824824
pg: {
825825
serviceName: "main",
@@ -935,7 +935,7 @@ const spec_postStatus = {
935935
}),
936936
description: undefined,
937937
extensions: {
938-
oid: "62583",
938+
oid: "64325",
939939
isTableLike: true,
940940
pg: {
941941
serviceName: "main",
@@ -1051,7 +1051,7 @@ const spec_user = {
10511051
}),
10521052
description: undefined,
10531053
extensions: {
1054-
oid: "62432",
1054+
oid: "64175",
10551055
isTableLike: true,
10561056
pg: {
10571057
serviceName: "main",
@@ -10739,7 +10739,7 @@ input OrganizationInput {
1073910739
name: String!
1074010740
createdAt: Datetime
1074110741
updatedAt: Datetime
10742-
slug: String
10742+
slug: String!
1074310743
}
1074410744

1074510745
"""The output of our create \`Project\` mutation."""

src/lib/config/app.config.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* Application configuration.
3+
*/
4+
const app = {
5+
name: "Backfeed",
6+
url: "https://backfeed.omni.dev",
7+
};
8+
9+
export default app;

0 commit comments

Comments
 (0)