Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Murderlon committed Dec 23, 2024
1 parent 1351222 commit 22c98b8
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 23 deletions.
6 changes: 3 additions & 3 deletions infra/dns.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const domain =
{
production: 'merlijn.site',
dev: 'dev.merlijn.site',
}[$app.stage] || `${$app.stage}.merlijn.site`
production: 'stack.merlijn.site',
dev: 'stack.dev.merlijn.site',
}[$app.stage] || `stack.${$app.stage}.merlijn.site`
2 changes: 0 additions & 2 deletions infra/stripe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { domain } from './dns'
// -------------------------- FREE PLAN ------------------------------------

export const freeProduct = new stripe.Product(PRICING_PLANS.free.id, {
productId: PRICING_PLANS.free.id,
name: PRICING_PLANS.free.name,
description: PRICING_PLANS.free.description,
active: true,
Expand Down Expand Up @@ -84,7 +83,6 @@ export const freePriceEurYear = new stripe.Price(
// -------------------------- PRO PLAN ------------------------------------

export const proProduct = new stripe.Product(PRICING_PLANS.pro.id, {
productId: PRICING_PLANS.pro.id,
name: PRICING_PLANS.pro.name,
description: PRICING_PLANS.pro.description,
active: true,
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/drizzle/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import permissionSeed from '../permission/seed'
import roleSeed from '../role/seed'
import userSeed from '../user/seed'
import planSeed from '../plan/seed'
import { getTableName } from 'drizzle-orm'

for (const table of [
schema.permissionToRole,
Expand All @@ -19,6 +20,7 @@ for (const table of [
// sql.raw(`TRUNCATE TABLE ${getTableName(table)} RESTART IDENTITY CASCADE`),
// )
await db.delete(table)
console.log(`Deleted table ${getTableName(table)}`)
}

await permissionSeed()
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/plan/seed.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { PRICING_PLANS } from '@company/core/src/constants'
import { Stripe } from '@company/core/src/stripe'
import { db, schema } from '../drizzle'

export default async function seed() {
const prices = await Stripe.client.prices.list()
const products = await Stripe.client.products.list()

for (const { id, name, description } of Object.values(PRICING_PLANS)) {
for (const { id, name, description } of products.data.filter((p) => p.active)) {
await db.transaction(async (tx) => {
const [plan] = await tx
.insert(schema.plan)
Expand Down
36 changes: 27 additions & 9 deletions packages/www/app/routes/_home+/_index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import fs from 'node:fs/promises'
import type { MetaFunction, LoaderFunctionArgs } from '@remix-run/node'
import { Link, useLoaderData } from '@remix-run/react'
import Markdown from 'react-markdown'
Expand All @@ -16,11 +15,10 @@ export const meta: MetaFunction = () => {

export async function loader({ request }: LoaderFunctionArgs) {
const sessionUser = await authenticator.isAuthenticated(request)
const readme = await fs.readFile(
new URL('../../../../../readme.md', import.meta.url),
'utf8',
const readme = await fetch(
'https://github.com/Murderlon/the-startup-stack/raw/refs/heads/main/readme.md',
)
return { user: sessionUser, readme }
return { user: sessionUser, readme: await readme.text() }
}

export default function Index() {
Expand All @@ -34,10 +32,30 @@ export default function Index() {
<Link to="/" prefetch="intent" className="flex h-10 items-center gap-1">
<Logo />
</Link>
<div className="flex items-center gap-4">
<Link to={LOGIN_PATH} className={buttonVariants({ size: 'sm' })}>
{user ? 'Dashboard' : 'Get Started'}
</Link>
<div className="flex gap-4">
<div className="relative flex items-center justify-center">
<a
href="https://github.com/murderlon/the-startup-stack"
target="_blank"
rel="noreferrer"
className="h-10 select-none items-center gap-2 rounded-full bg-green-500/5 px-2 py-1 pr-2.5 text-base font-medium tracking-tight text-green-600 ring-1 ring-inset ring-green-600/20 backdrop-blur-sm transition-all duration-300 hover:brightness-110 dark:bg-yellow-800/40 dark:text-yellow-100 dark:ring-yellow-200/50 flex"
>
<svg
xmlns="http://www.w3.org/2000/svg"
className="h-6 w-6 text-green-600 dark:text-yellow-100"
viewBox="0 0 24 24"
fill="currentColor"
>
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z" />
</svg>
Star on GitHub
</a>
</div>
<div className="flex items-center gap-4">
<Link to={LOGIN_PATH} className={buttonVariants({ size: 'sm' })}>
{user ? 'Dashboard' : 'Get Started'}
</Link>
</div>
</div>
</div>

Expand Down
16 changes: 9 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Get independence from expensive SaaS without loosing its developer experience,
the infra primitives to adapt to any future requirement, and the tools to build
delightful, secure user experiences.

Check it live 👉 https://stack.merlijn.site

## Contents

- [Features](#features)
Expand Down Expand Up @@ -238,7 +240,7 @@ Just kicking the tires? You can skip this setting up a domain for now.
2. Add your connection string:

```sh
bunx sst secret add DATABASE_URL your-connection-string
bunx sst secret set DATABASE_URL your-connection-string
```

Run the following commands in this order:
Expand Down Expand Up @@ -273,8 +275,8 @@ We put it in `.env` because this secret is needed at build time too.
Both values are also needed at runtime:

```sh
bunx sst secret add STRIPE_PUBLIC_KEY your-key
bunx sst secret add STRIPE_SECRET_KEY your-secret
bunx sst secret set STRIPE_PUBLIC_KEY your-key
bunx sst secret set STRIPE_SECRET_KEY your-secret
```

### Secrets
Expand All @@ -283,18 +285,18 @@ Lastly, there are some other secrets we need to configure:

```sh
# Secures cookies and session data.
bunx sst secret add SESSION_SECRET openssl rand -base64 32
bunx sst secret set SESSION_SECRET "$(openssl rand -base64 32)"
# Encrypts one-time passwords (OTP)
bunx sst secret add ENCRYPTION_SECRET openssl rand -base64 32
bunx sst secret set ENCRYPTION_SECRET "$(openssl rand -base64 32)"
# Secures honeypot values in forms.
bunx sst secret add HONEYPOT_ENCRYPTION_SEED openssl rand -base64 32
bunx sst secret set HONEYPOT_ENCRYPTION_SEED "$(openssl rand -base64 32)"
```

## Use

### Commands

> ![NOTE]
> [!NOTE]
> The first time you spin up SST provisioning all the infra can take a couple minutes.
Spin up your local development environment
Expand Down

0 comments on commit 22c98b8

Please sign in to comment.