Skip to content

Commit 0bd2127

Browse files
committed
Initial commit for gh-pages
0 parents  commit 0bd2127

Some content is hidden

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

42 files changed

+6781
-0
lines changed

.env.example

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This is an example of your .env file format, which pnpm db:setup will create.
2+
# Note: this must be .env, not .env.local, without further configuration changes.
3+
POSTGRES_URL=postgresql://***
4+
STRIPE_SECRET_KEY=sk_test_***
5+
STRIPE_WEBHOOK_SECRET=whsec_***
6+
BASE_URL=http://localhost:3000
7+
AUTH_SECRET=***

.github/workflows/nextjs.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Sample workflow for building and deploying a Next.js site to GitHub Pages
2+
#
3+
# To get started with Next.js see: https://nextjs.org/docs/getting-started
4+
#
5+
name: CollabLLM Page
6+
7+
on:
8+
# Runs on pushes targeting the default branch
9+
push:
10+
branches: ["main", "gh-pages"]
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16+
permissions:
17+
contents: read
18+
pages: write
19+
id-token: write
20+
21+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23+
concurrency:
24+
group: "pages"
25+
cancel-in-progress: false
26+
27+
defaults:
28+
run:
29+
shell: bash
30+
31+
jobs:
32+
# Build job
33+
build:
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
- name: Detect package manager
39+
id: detect-package-manager
40+
run: |
41+
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
42+
echo "manager=yarn" >> $GITHUB_OUTPUT
43+
echo "command=install" >> $GITHUB_OUTPUT
44+
echo "runner=yarn" >> $GITHUB_OUTPUT
45+
exit 0
46+
elif [ -f "${{ github.workspace }}/package.json" ]; then
47+
echo "manager=npm" >> $GITHUB_OUTPUT
48+
echo "command=ci" >> $GITHUB_OUTPUT
49+
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
50+
exit 0
51+
else
52+
echo "Unable to determine package manager"
53+
exit 1
54+
fi
55+
- name: Setup Node
56+
uses: actions/setup-node@v4
57+
with:
58+
node-version: "20"
59+
# cache: ${{ steps.detect-package-manager.outputs.manager }}
60+
# cache-dependency-path: website/package-lock.json
61+
- name: Setup Pages
62+
uses: actions/configure-pages@v5
63+
with:
64+
# Automatically inject basePath in your Next.js configuration file and disable
65+
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
66+
#
67+
# You may remove this line if you want to manage the configuration yourself.
68+
static_site_generator: next
69+
- name: Restore cache
70+
uses: actions/cache@v4
71+
with:
72+
path: |
73+
.next/cache
74+
# Generate a new cache whenever packages or source files change.
75+
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
76+
# If source files changed but packages didn't, rebuild from a prior cache.
77+
restore-keys: |
78+
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-
79+
- name: Setup pnpm
80+
uses: pnpm/action-setup@v4
81+
with:
82+
version: 10
83+
- name: Install dependencies
84+
run: pnpm install
85+
- name: Build with Next.js
86+
run: pnpm build
87+
- name: Upload artifact
88+
uses: actions/upload-pages-artifact@v3
89+
with:
90+
path: ./out
91+
92+
# Deployment job
93+
deploy:
94+
environment:
95+
name: github-pages
96+
url: ${{ steps.deployment.outputs.page_url }}
97+
runs-on: ubuntu-latest
98+
needs: build
99+
steps:
100+
- name: Deploy to GitHub Pages
101+
id: deployment
102+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
__pycache__
2+
outputs
3+
4+
# dependencies
5+
/node_modules
6+
/.pnp
7+
.pnp.js
8+
.yarn/install-state.gz
9+
10+
# testing
11+
/coverage
12+
13+
# next.js
14+
/.next/
15+
/out/
16+
17+
# production
18+
/build
19+
20+
# misc
21+
.DS_Store
22+
*.pem
23+
24+
# debug
25+
npm-debug.log*
26+
yarn-debug.log*
27+
yarn-error.log*
28+
29+
# local env files
30+
.env
31+
32+
# vercel
33+
.vercel
34+
35+
# typescript
36+
*.tsbuildinfo
37+
next-env.d.ts
38+
.vscode
39+
40+
# Docker
41+
postgres_data/
42+
.env*.local

.nojekyll

Whitespace-only changes.

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Vercel
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Next.js SaaS Starter
2+
3+
```
4+
conda install nodejs -y
5+
curl -fsSL https://get.pnpm.io/install.sh | sh -
6+
```
7+
8+
This is a starter template for building a SaaS application using **Next.js** with support for authentication, Stripe integration for payments, and a dashboard for logged-in users.
9+
10+
**Demo: [https://next-saas-start.vercel.app/](https://next-saas-start.vercel.app/)**
11+
12+
## Features
13+
14+
- Marketing landing page (`/`) with animated Terminal element
15+
- Pricing page (`/pricing`) which connects to Stripe Checkout
16+
- Dashboard pages with CRUD operations on users/teams
17+
- Basic RBAC with Owner and Member roles
18+
- Subscription management with Stripe Customer Portal
19+
- Email/password authentication with JWTs stored to cookies
20+
- Global middleware to protect logged-in routes
21+
- Local middleware to protect Server Actions or validate Zod schemas
22+
- Activity logging system for any user events
23+
24+
## Tech Stack
25+
26+
- **Framework**: [Next.js](https://nextjs.org/)
27+
- **Database**: [Postgres](https://www.postgresql.org/)
28+
- **ORM**: [Drizzle](https://orm.drizzle.team/)
29+
- **Payments**: [Stripe](https://stripe.com/)
30+
- **UI Library**: [shadcn/ui](https://ui.shadcn.com/)
31+
32+
## Getting Started
33+
34+
```bash
35+
git clone https://github.com/Wuyxin/collabllm.git
36+
cd saas-starter
37+
pnpm install
38+
```
39+
40+
## Running Locally
41+
42+
[Install](https://docs.stripe.com/stripe-cli) and log in to your Stripe account:
43+
44+
```bash
45+
stripe login
46+
```
47+
48+
Use the included setup script to create your `.env` file:
49+
50+
```bash
51+
pnpm db:setup
52+
```
53+
54+
Run the database migrations and seed the database with a default user and team:
55+
56+
```bash
57+
pnpm db:migrate
58+
pnpm db:seed
59+
```
60+
61+
This will create the following user and team:
62+
63+
- User: `test@test.com`
64+
- Password: `admin123`
65+
66+
You can also create new users through the `/sign-up` route.
67+
68+
Finally, run the Next.js development server:
69+
70+
```bash
71+
pnpm dev
72+
```
73+
74+
Open [http://localhost:3000](http://localhost:3000) in your browser to see the app in action.
75+
76+
You can listen for Stripe webhooks locally through their CLI to handle subscription change events:
77+
78+
```bash
79+
stripe listen --forward-to localhost:3000/api/stripe/webhook
80+
```
81+
82+
## Testing Payments
83+
84+
To test Stripe payments, use the following test card details:
85+
86+
- Card Number: `4242 4242 4242 4242`
87+
- Expiration: Any future date
88+
- CVC: Any 3-digit number
89+
90+
## Going to Production
91+
92+
When you're ready to deploy your SaaS application to production, follow these steps:
93+
94+
### Set up a production Stripe webhook
95+
96+
1. Go to the Stripe Dashboard and create a new webhook for your production environment.
97+
2. Set the endpoint URL to your production API route (e.g., `https://yourdomain.com/api/stripe/webhook`).
98+
3. Select the events you want to listen for (e.g., `checkout.session.completed`, `customer.subscription.updated`).
99+
100+
### Deploy to Vercel
101+
102+
1. Push your code to a GitHub repository.
103+
2. Connect your repository to [Vercel](https://vercel.com/) and deploy it.
104+
3. Follow the Vercel deployment process, which will guide you through setting up your project.
105+
106+
### Add environment variables
107+
108+
In your Vercel project settings (or during deployment), add all the necessary environment variables. Make sure to update the values for the production environment, including:
109+
110+
1. `BASE_URL`: Set this to your production domain.
111+
2. `STRIPE_SECRET_KEY`: Use your Stripe secret key for the production environment.
112+
3. `STRIPE_WEBHOOK_SECRET`: Use the webhook secret from the production webhook you created in step 1.
113+
4. `POSTGRES_URL`: Set this to your production database URL.
114+
5. `AUTH_SECRET`: Set this to a random string. `openssl rand -base64 32` will generate one.
115+
116+
## Other Templates
117+
118+
While this template is intentionally minimal and to be used as a learning resource, there are other paid versions in the community which are more full-featured:
119+
120+
- https://achromatic.dev
121+
- https://shipfa.st
122+
- https://makerkit.dev
123+
- https://zerotoshipped.com
124+
- https://turbostarter.dev
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
2+
3+
export default function ActivityPageSkeleton() {
4+
return (
5+
<section className="flex-1 p-4 lg:p-8">
6+
<h1 className="text-lg lg:text-2xl font-medium text-gray-900 mb-6">
7+
Activity Log
8+
</h1>
9+
<Card>
10+
<CardHeader>
11+
<CardTitle>Recent Activity</CardTitle>
12+
</CardHeader>
13+
<CardContent className="min-h-[88px]" />
14+
</Card>
15+
</section>
16+
);
17+
}

0 commit comments

Comments
 (0)