Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions apps/auth-proxy/sst-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ declare module "sst" {
"type": "sst.aws.Vpc"
}
"Web": {
"4dabf18193072939515e22adb298388d": string
"packageVersion": string
"urn": string
"type": "sst.aws.Nextjs"
"url": string
}
"homefront-next-prod": {
"name": string
"type": "sst.aws.Bucket"
}
"join-homefront": {
"name": string
"type": "sst.aws.Bucket"
}
}
}
9 changes: 6 additions & 3 deletions apps/expo/sst-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ declare module "sst" {
"type": "sst.aws.Vpc"
}
"Web": {
"4dabf18193072939515e22adb298388d": string
"packageVersion": string
"urn": string
"type": "sst.aws.Nextjs"
"url": string
}
"homefront-next-prod": {
"name": string
"type": "sst.aws.Bucket"
}
"join-homefront": {
"name": string
"type": "sst.aws.Bucket"
}
}
}
18 changes: 12 additions & 6 deletions apps/nextjs/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ const nextConfig = {
port: "",
search: "",
},
{
protocol: "https",
hostname: "d3t9degcpc8bgc.cloudfront.net",
},
],
},

Expand Down Expand Up @@ -75,6 +79,7 @@ const nextConfig = {
"@rn-primitives/tooltip",
"@rn-primitives/types",
"expo",
"expo-blur",
"expo-clipboard",
"expo-file-system",
"expo-image",
Expand Down Expand Up @@ -148,12 +153,13 @@ const nextConfig = {
type: "webassembly/async",
});

config.externals = config.externals || [];
if (Array.isArray(config.externals)) {
config.externals.push("@node-rs/argon2");
} else {
config.externals = ["@node-rs/argon2"];
}
config.externals = [
...(Array.isArray(config.externals) ? config.externals : []),
"@node-rs/argon2",
"re2",
"keyv",
"metascraper-youtube",
];

// Explicitly mark WASM as external
// config.externals = [
Expand Down
7 changes: 7 additions & 0 deletions apps/nextjs/src/app/(app)/resources/[id]/edit/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"use client";

import { EditResourceScreen } from "@homefront/app/features/resources/EditResourceScreen";

export default function EditResourcePage() {
return <EditResourceScreen />;
}
5 changes: 5 additions & 0 deletions apps/nextjs/src/app/(app)/resources/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ResourceScreen } from "@homefront/app/features/resources/ResourceScreen";

export default function ResourcePage() {
return <ResourceScreen />;
}
5 changes: 5 additions & 0 deletions apps/nextjs/src/app/(app)/resources/downvoted/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { FilteredResourcesScreen } from "@homefront/app/features/resources/FilteredResourcesScreen";

export default function SavedResourcesPage() {
return <FilteredResourcesScreen filter="downvoted" />;
}
7 changes: 7 additions & 0 deletions apps/nextjs/src/app/(app)/resources/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { ResourcesScreen } from "@homefront/app/features/resources/ResourcesScreen";

export const dynamic = "force-dynamic";

export default function ResourcesPage() {
return <ResourcesScreen />;
}
5 changes: 5 additions & 0 deletions apps/nextjs/src/app/(app)/resources/saved/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { FilteredResourcesScreen } from "@homefront/app/features/resources/FilteredResourcesScreen";

export default function SavedResourcesPage() {
return <FilteredResourcesScreen filter="saved" />;
}
5 changes: 5 additions & 0 deletions apps/nextjs/src/app/(app)/resources/upvoted/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { FilteredResourcesScreen } from "@homefront/app/features/resources/FilteredResourcesScreen";

export default function SavedResourcesPage() {
return <FilteredResourcesScreen filter="upvoted" />;
}
7 changes: 7 additions & 0 deletions apps/nextjs/src/app/(app)/submit/resource/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { SubmitResourceScreen } from "@homefront/app/features/resources/SubmitResourceScreen";

export const dynamic = "force-dynamic";

export default function SubmitResourcePage() {
return <SubmitResourceScreen />;
}
2 changes: 2 additions & 0 deletions apps/nextjs/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@ export const env = createEnv({
client: {
// NEXT_PUBLIC_CLIENTVAR: z.string(),
NEXT_PUBLIC_BASE_URL: z.string().url(),
NEXT_PUBLIC_CDN_DOMAIN: z.string().url(),
},
/**
* Destructure all variables from `process.env` to make sure they aren't tree-shaken away.
*/
experimental__runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
NEXT_PUBLIC_BASE_URL: process.env.NEXT_PUBLIC_BASE_URL,
NEXT_PUBLIC_CDN_DOMAIN: process.env.NEXT_PUBLIC_CDN_DOMAIN,
// NEXT_PUBLIC_CLIENTVAR: process.env.NEXT_PUBLIC_CLIENTVAR,
},
skipValidation:
Expand Down
9 changes: 6 additions & 3 deletions apps/nextjs/sst-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ declare module "sst" {
"type": "sst.aws.Vpc"
}
"Web": {
"4dabf18193072939515e22adb298388d": string
"packageVersion": string
"urn": string
"type": "sst.aws.Nextjs"
"url": string
}
"homefront-next-prod": {
"name": string
"type": "sst.aws.Bucket"
}
"join-homefront": {
"name": string
"type": "sst.aws.Bucket"
}
}
}
23 changes: 23 additions & 0 deletions infra/cron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/// <reference path="./.sst/platform/config.d.ts" />

import { databaseUrl } from "./secrets";

export const resourceScoresCron = new sst.aws.Cron("ResourceScores", {
schedule: "rate(5 minutes)",
function: {
handler: "packages/lambdas/src/resources-scores.handler",
environment: {
DATABASE_URL: databaseUrl.value,
},
},
});

export const resourceVotesCron = new sst.aws.Cron("ResourceVotes", {
schedule: "rate(5 minutes)",
function: {
handler: "packages/lambdas/src/resources-votes.handler",
environment: {
DATABASE_URL: databaseUrl.value,
},
},
});
17 changes: 10 additions & 7 deletions infra/nextjs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NextjsArgs } from "../.sst/platform/src/components/aws";
import { resourceScoresCron, resourceVotesCron } from "./cron";
import { redis } from "./redis";
import {
authChallengeEncryptionKey,
Expand All @@ -18,7 +19,7 @@ import {
stripeSecretKey,
stripeWebhookSecret,
} from "./secrets";
import { bucket } from "./storage";
import { bucket, cdn, cdnBucket } from "./storage";
import { vpc } from "./vpc";

const PINECONE_INDEX = "multilingual-e5-large";
Expand Down Expand Up @@ -95,8 +96,14 @@ export const nextjs = new sst.aws.Nextjs("Web", {
},
link: [
bucket,
cdnBucket,
cdn,
redis,

// Crons
resourceScoresCron,
resourceVotesCron,

// Secrets
authMiniSessionEncryptionKey,
authChallengeEncryptionKey,
Expand Down Expand Up @@ -138,13 +145,9 @@ export const nextjs = new sst.aws.Nextjs("Web", {
STRIPE_HASH_KEY: stripeHashKey.value,
STRIPE_SECRET_KEY: stripeSecretKey.value,
STRIPE_WEBHOOK_SECRET: stripeWebhookSecret.value,
NEXT_PUBLIC_CDN_DOMAIN: "https://d3t9degcpc8bgc.cloudfront.net",
},
vpc,
});

sst.Linkable.wrap(sst.aws.Nextjs, (nextjs) => ({
properties: {
...nextjs,
url: nextjs.url,
},
}));
console.log(cdn.url);
2 changes: 2 additions & 0 deletions infra/redis.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference path="./.sst/platform/config.d.ts" />

import { vpc } from "./vpc";

export const redis = new sst.aws.Redis("Redis", {
Expand Down
2 changes: 2 additions & 0 deletions infra/secrets.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// <reference path="./.sst/platform/config.d.ts" />

const authChallengeEncryptionKey = new sst.Secret("AuthChallengeEncryptionKey");
const authHomefrontClientId = new sst.Secret("AuthHomefrontClientId");
const authHomefrontClientSecret = new sst.Secret("AuthHomefrontClientSecret");
Expand Down
9 changes: 6 additions & 3 deletions infra/sst-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ declare module "sst" {
"type": "sst.aws.Vpc"
}
"Web": {
"4dabf18193072939515e22adb298388d": string
"packageVersion": string
"urn": string
"type": "sst.aws.Nextjs"
"url": string
}
"homefront-next-prod": {
"name": string
"type": "sst.aws.Bucket"
}
"join-homefront": {
"name": string
"type": "sst.aws.Bucket"
}
}
}
31 changes: 31 additions & 0 deletions infra/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,34 @@
export const bucket = new sst.aws.Bucket("homefront-next-prod", {
access: "public",
});

export const cdnBucket = new sst.aws.Bucket("join-homefront", {
access: "public",
transform: {
bucket(args, opts) {
args.bucket = $app.stage === "production" ? "join-homefront" : undefined;
opts.import = $app.stage === "production" ? "join-homefront" : undefined;
},
},
});

export const cdn = new sst.aws.Cdn("CDN", {
origins: [
{
originId: cdnBucket.arn,
domainName: cdnBucket.domain,
},
],
defaultCacheBehavior: {
targetOriginId: cdnBucket.arn,
allowedMethods: ["GET", "HEAD", "OPTIONS"],
cachedMethods: ["GET", "HEAD", "OPTIONS"],
forwardedValues: {
queryString: false,
cookies: {
forward: "none",
},
},
viewerProtocolPolicy: "redirect-to-https",
},
});
7 changes: 6 additions & 1 deletion infra/vpc.ts
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
export const vpc = new sst.aws.Vpc("Vpc", { nat: "managed" });
/// <reference path="./.sst/platform/config.d.ts" />

export const vpc = new sst.aws.Vpc("Vpc", {
nat: "ec2",
az: $app.stage === "production" ? 2 : 1,
});
9 changes: 6 additions & 3 deletions packages/ai/sst-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,16 @@ declare module "sst" {
"type": "sst.aws.Vpc"
}
"Web": {
"4dabf18193072939515e22adb298388d": string
"packageVersion": string
"urn": string
"type": "sst.aws.Nextjs"
"url": string
}
"homefront-next-prod": {
"name": string
"type": "sst.aws.Bucket"
}
"join-homefront": {
"name": string
"type": "sst.aws.Bucket"
}
}
}
3 changes: 3 additions & 0 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@
"dependencies": {
"@homefront/ai": "workspace:*",
"@homefront/auth": "workspace:*",
"@homefront/aws": "workspace:*",
"@homefront/dayjs": "workspace:*",
"@homefront/db": "workspace:*",
"@homefront/scraper": "workspace:*",
"@homefront/stripe": "workspace:*",
"@homefront/validators": "workspace:*",
"@trpc/server": "catalog:",
"h3-js": "^4.1.0",
"lexorank": "^1.0.5",
"nanoid": "^5.0.9",
"normalize-url": "catalog:",
"superjson": "catalog:",
"zod": "catalog:"
},
Expand Down
4 changes: 4 additions & 0 deletions packages/api/src/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import { invitesRouter } from "./router/invites";
import { mappingRouter } from "./router/mapping";
import { occupationsRouter } from "./router/occupations";
import { relationshipsRouter } from "./router/relationships";
import { reportsRouter } from "./router/reports";
import { resourcesRouter } from "./router/resources";
import { rolesRouter } from "./router/roles";
import { skillsRouter } from "./router/skills";
import { userLocationsRouter } from "./router/userLocations";
Expand All @@ -23,6 +25,8 @@ export const appRouter = createTRPCRouter({
mapping: mappingRouter,
occupations: occupationsRouter,
relationships: relationshipsRouter,
reports: reportsRouter,
resources: resourcesRouter,
roles: rolesRouter,
skills: skillsRouter,
userLocations: userLocationsRouter,
Expand Down
12 changes: 11 additions & 1 deletion packages/api/src/router/domainAreas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@ import type { TRPCRouterRecord } from "@trpc/server";
import { sql } from "kysely";
import { z } from "zod";

import { protectedProcedure } from "../trpc";
import { protectedProcedure, publicProcedure } from "../trpc";

export const domainAreasRouter = {
getDomainAreas: publicProcedure.query(async ({ ctx }) => {
const domainAreas = await ctx.db
.selectFrom("domainAreas")
.selectAll()
.orderBy("title")
.execute();

return domainAreas;
}),

getAllDomainAreas: protectedProcedure.query(async ({ ctx }) => {
const userId = ctx.session.user.id;

Expand Down
Loading