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
46 changes: 46 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Deploys & Previews
on:
push:
jobs:
deploy-www:
runs-on: ubuntu-latest
permissions:
pull-requests: write
issues: write
repository-projects: write
contents: write
steps:
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: './www/package-lock.json'
- name: Install dependencies
run: |
cd www
npm ci
# - name: Run Prettier check
# run: |
# cd www
# npm run format:check
# - name: Run ESLint
# run: |
# cd www
# npm run lint
# - name: Run Lighthouse CI
# run: |
# cd www
# npm run lighthouse
- name: Deploy to Vercel
uses: amondnet/vercel-action@v20
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
vercel-project-id: prj_5wJWsrSkl9yTZ3rY1DgEV7UpAtly
scope: ${{ secrets.VERCEL_ORG_ID }}
working-directory: ./www
github-comment: ${{ github.ref != 'refs/heads/production' }}
vercel-args: ${{ github.ref == 'refs/heads/production' && '--prod' || '' }}
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
venv/
.env
.DS_Store

models/*
!models/.gitkeep
__pycache__
benchmark/__pycache__
.DS_Store
1 change: 1 addition & 0 deletions www/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
STACKS_API_KEY=[ask_hugh]
43 changes: 43 additions & 0 deletions www/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/versions

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# env files (can opt-in for committing if needed)
.env*
!.env.example

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
.lighthouseci
10 changes: 10 additions & 0 deletions www/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
node_modules/
.next/
out/
build/
dist/
*.log
.env*
.DS_Store
coverage/
.nyc_output/
11 changes: 11 additions & 0 deletions www/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"bracketSpacing": true,
"arrowParens": "avoid",
"endOfLine": "lf"
}
1 change: 1 addition & 0 deletions www/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.19.6
36 changes: 36 additions & 0 deletions www/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
92 changes: 92 additions & 0 deletions www/app/api/subscribe/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { NextRequest, NextResponse } from 'next/server';

// Example in-memory store for demonstration
// In production, you'd use a real database or email service like Mailchimp, ConvertKit, etc.
const subscribedEmails = new Set<string>([
'already@subscribed.com', // Example of already subscribed email for testing
]);

interface SubscribeResponse {
success: boolean;
message: string;
status: 'subscribed' | 'already_subscribed' | 'error';
}

export async function POST(request: NextRequest): Promise<NextResponse<SubscribeResponse>> {
try {
const body = await request.json();
const { email } = body;

// Validate email
if (!email || typeof email !== 'string') {
return NextResponse.json(
{
success: false,
message: 'Email address is required.',
status: 'error',
},
{ status: 400 }
);
}

// Basic email validation
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(email)) {
return NextResponse.json(
{
success: false,
message: 'Please enter a valid email address.',
status: 'error',
},
{ status: 400 }
);
}

const normalizedEmail = email.toLowerCase().trim();

const response = await fetch('https://stacks.garden3d.net/api/contacts', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Api-Key': process.env.STACKS_API_KEY!,
},
body: JSON.stringify({
email: normalizedEmail,
sources: ['g3d:family_intelligence']
}),
});

if (response.ok) {
return NextResponse.json(
{
success: true,
message: 'Thank you for subscribing! We\'ll keep you updated.',
status: 'subscribed',
},
{ status: 201 }
);
} else {
console.error('Subscription error:', response.statusText);
return NextResponse.json(
{
success: false,
message: 'Something went wrong. Please try again later.',
status: 'error',
},
{ status: 500 }
);
}

} catch (error) {
console.error('Subscription error:', error);

return NextResponse.json(
{
success: false,
message: 'Something went wrong. Please try again later.',
status: 'error',
},
{ status: 500 }
);
}
}
Binary file added www/app/favicon.ico
Binary file not shown.
Loading
Loading