Skip to content

Commit

Permalink
Transition to monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed Nov 17, 2024
1 parent 05319ce commit 3652754
Show file tree
Hide file tree
Showing 177 changed files with 5,253 additions and 314 deletions.
Binary file modified bun.lockb
Binary file not shown.
8 changes: 0 additions & 8 deletions core/permission/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion infra/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { webhook } from './stripe'

export const api = new sst.aws.Function('Api', {
url: true,
handler: 'functions/api/index.handler',
handler: 'packages/functions/api/index.handler',
link: [secret.DATABASE_URL, secret.STRIPE_SECRET_KEY, webhook, email],
permissions: [
{
Expand Down
2 changes: 1 addition & 1 deletion infra/stripe.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PRICING_PLANS } from '#core/constants.ts'
import { PRICING_PLANS } from '@company/core/src/constants'
import { domain } from './dns'

// -------------------------- FREE PLAN ------------------------------------
Expand Down
7 changes: 4 additions & 3 deletions infra/www.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { domain } from './dns.ts'
import { email } from './email.ts'
import { secret } from './secret.ts'
import { domain } from './dns'
import { email } from './email'
import { secret } from './secret'

export const www = new sst.aws.Remix('Remix', {
path: './packages/www',
domain: {
name: domain,
dns: sst.cloudflare.dns(),
Expand Down
89 changes: 11 additions & 78 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,92 +1,25 @@
{
"name": "the-startup-stack",
"private": true,
"description": "A Lightweight, Feature-Rich, and Production-Ready Remix Stack for your next SaaS application.",
"repository": "murderlon/the-startup-stack",
"author": "Merlijn Vos <[email protected]> (https://github.com/murderlon)",
"version": "0.0.0",
"sideEffects": false,
"type": "module",
"imports": {
"#*": "./*"
},
"scripts": {
"build": "remix vite:build",
"db:migrate": "sst shell cross-env DB_MIGRATING=true drizzle-kit generate",
"db:push": "sst shell bunx drizzle-kit push",
"db:seed": "sst shell cross-env DB_SEEDING=true bun run ./core/drizzle/seed.ts",
"dev": "remix vite:dev",
"dev": "sst dev",
"db:migrate": "bun run --filter @company/core db:migrate",
"db:push": "bun run --filter @company/core db:push",
"db:seed": "bun run --filter @company/core db:seed",
"typecheck": "bun --filter=* typecheck",
"format": "biome format --write .",
"format:check": "biome format --error-on-warnings .",
"lint": "biome lint --write .",
"start": "sst shell remix vite:start",
"test": "vitest",
"typecheck": "tsc"
"lint": "biome lint --write ."
},
"workspaces": ["packages/*"],
"dependencies": {
"@aws-sdk/client-sesv2": "^3.687.0",
"@conform-to/react": "1.1.4",
"@conform-to/zod": "1.1.3",
"@epic-web/client-hints": "^1.3.2",
"@neondatabase/serverless": "^0.9.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@react-email/components": "^0.0.7",
"@react-email/render": "^0.0.15",
"@remix-run/node": "^2.9.2",
"@remix-run/react": "^2.9.1",
"@remix-run/router": "^1.16.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cookie": "^0.6.0",
"cross-env": "^7.0.3",
"crypto-js": "^4.2.0",
"drizzle-orm": "^0.36.2",
"hono": "^4.6.3",
"i18next": "^23.11.3",
"i18next-browser-languagedetector": "^8.0.0",
"intl-parse-accept-language": "^1.0.0",
"isbot": "^3.8.0",
"lucide-react": "^0.383.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-email": "^2.1.4",
"react-i18next": "^14.1.1",
"remix-auth": "^3.6.0",
"remix-auth-github": "^1.7.0",
"remix-auth-totp": "^3.3.0",
"remix-i18next": "^6.1.0",
"remix-utils": "^7.6.0",
"sonner": "^1.4.41",
"sst": "^3.3.4",
"stripe": "^15.5.0",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
"ulid": "^2.3.0",
"ws": "^8.18.0",
"zod": "^3.23.6"
"sst": "^3.3.4"
},
"devDependencies": {
"@biomejs/biome": "^1.9.0",
"@remix-run/dev": "^2.9.2",
"@types/aws-lambda": "^8.10.145",
"@types/cookie": "^0.6.0",
"@types/react": "^18.3.2",
"@types/react-dom": "^18.3.0",
"autoprefixer": "^10.4.19",
"drizzle-kit": "^0.28.1",
"postcss": "^8.4.38",
"remix-development-tools": "^4.1.6",
"remix-flat-routes": "^0.6.5",
"tailwindcss": "^3.4.3",
"typescript": "^5.4.5",
"vite": "^5.2.11",
"vite-tsconfig-paths": "^4.3.2",
"vitest": "^1.6.0"
"typescript": "5.5.4"
},
"trustedDependencies": ["@biomejs/biome"],
"engines": {
"node": ">=18.0.0"
}
"trustedDependencies": ["@biomejs/biome"]
}
2 changes: 1 addition & 1 deletion drizzle.config.ts → packages/core/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Resource } from 'sst'

export default defineConfig({
out: './core/migrations',
schema: './core/**/*sql.ts',
schema: './core/**/*sql',
dialect: 'postgresql',
dbCredentials: {
url: Resource.DATABASE_URL.value,
Expand Down
29 changes: 29 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "@company/core",
"type": "module",
"private": true,
"sideEffects": false,
"exports": {
"./*": "./*.ts"
},
"scripts": {
"db:migrate": "sst shell cross-env DB_MIGRATING=true drizzle-kit generate",
"db:push": "sst shell bunx drizzle-kit push",
"db:seed": "sst shell cross-env DB_SEEDING=true bun run ./src/drizzle/seed.ts",
"typecheck": "tsc"
},
"dependencies": {
"@aws-sdk/client-sesv2": "^3.687.0",
"@neondatabase/serverless": "^0.9.5",
"stripe": "^15.5.0",
"sst": "^3.3.4",
"drizzle-orm": "^0.36.2",
"ulid": "^2.3.0",
"ws": "^8.18.0"
},
"devDependencies": {
"drizzle-kit": "^0.28.1",
"cross-env": "^7.0.3",
"typescript": "^5.4.5"
}
}
2 changes: 1 addition & 1 deletion core/constants.ts → packages/core/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { price } from '#core/price/sql.ts'
import type { price } from './price/sql'
import type { InferSelectModel } from 'drizzle-orm'

/**
Expand Down
12 changes: 6 additions & 6 deletions core/drizzle/index.ts → packages/core/src/drizzle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
permissionRelations,
permissionToRole,
permissionToRoleRelations,
} from '../permission/sql.ts'
import { plan, planRelations } from '../plan/sql.ts'
import { price, priceRelations } from '../price/sql.ts'
import { role, roleRelations, roleToUser, roleToUserRelations } from '../role/sql.ts'
import { subscription, subscriptionRelations } from '../subscription/sql.ts'
import { user, userRelations, userImage, userImageRelations } from '../user/sql.ts'
} from '../permission/sql'
import { plan, planRelations } from '../plan/sql'
import { price, priceRelations } from '../price/sql'
import { role, roleRelations, roleToUser, roleToUserRelations } from '../role/sql'
import { subscription, subscriptionRelations } from '../subscription/sql'
import { user, userRelations, userImage, userImageRelations } from '../user/sql'

export const schema = {
user,
Expand Down
10 changes: 5 additions & 5 deletions core/drizzle/seed.ts → packages/core/src/drizzle/seed.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { db, schema } from '#core/drizzle'
import permissionSeed from '../permission/seed.ts'
import roleSeed from '../role/seed.ts'
import userSeed from '../user/seed.ts'
import planSeed from '../plan/seed.ts'
import { db, schema } from '@company/core/src/drizzle/index'
import permissionSeed from '../permission/seed'
import roleSeed from '../role/seed'
import userSeed from '../user/seed'
import planSeed from '../plan/seed'

for (const table of [
schema.permissionToRole,
Expand Down
File renamed without changes.
12 changes: 11 additions & 1 deletion core/email/index.ts → packages/core/src/email/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { Resource } from 'sst'
import { SESv2Client, SendEmailCommand } from '@aws-sdk/client-sesv2'
import { Resource } from 'sst'

import { sendAuthEmail } from './templates/auth'
import {
sendSubscriptionErrorEmail,
sendSubscriptionSuccessEmail,
} from './templates/subscription'

export type SendEmailOptions = {
to: string | string[]
Expand All @@ -11,6 +17,10 @@ export type SendEmailOptions = {
export namespace Email {
export const client = new SESv2Client()

export const sendSubscriptionSuccess = sendSubscriptionSuccessEmail
export const sendSubscriptionError = sendSubscriptionErrorEmail
export const sendAuth = sendAuthEmail

export const send = async (options: SendEmailOptions) => {
const from = `test@${Resource.Email.sender}`
const { subject, to, html } = options
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 3652754

Please sign in to comment.