├── public ├── robots.txt ├── favicon.ico └── mockup.png ├── .npmrc ├── components ├── home │ ├── Testimonials.vue │ ├── HowItWorks.vue │ ├── Line.vue │ ├── Hero.vue │ ├── Features.vue │ ├── Video.vue │ └── WaitlistForm.vue └── app │ ├── Footer.vue │ ├── Navbar.vue │ └── NavbarWhatsNew.vue ├── server ├── tsconfig.json ├── database │ ├── migrations │ │ ├── 0001_illegal_lenny_balinger.sql │ │ ├── 0000_silent_hitman.sql │ │ └── meta │ │ │ ├── _journal.json │ │ │ ├── 0000_snapshot.json │ │ │ └── 0001_snapshot.json │ └── schema.ts ├── utils │ └── drizzle.ts ├── api │ ├── count.get.ts │ ├── anon-list.get.ts │ └── join-waitlist.post.ts └── plugins │ └── migrations.ts ├── assets ├── logos │ ├── vuemail-logo-dark.png │ ├── github-mark-white.svg │ ├── nuxt-logo-white.svg │ ├── resend-logo-white.svg │ ├── tailwindcss-logo-white.svg │ └── nuxt-hub-logo-white.svg └── css │ └── main.css ├── tsconfig.json ├── drizzle.config.ts ├── .gitignore ├── tailwind.config.js ├── app.config.ts ├── pages ├── leaderboard.vue └── index.vue ├── nuxt.config.ts ├── package.json ├── .github └── workflows │ └── nuxthub.yml ├── app.vue └── README.md /public/robots.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | shamefully-hoist=true 2 | -------------------------------------------------------------------------------- /components/home/Testimonials.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /components/home/HowItWorks.vue: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../.nuxt/tsconfig.server.json" 3 | } 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masterkram/Nuxt-Waitlist/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/mockup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masterkram/Nuxt-Waitlist/HEAD/public/mockup.png -------------------------------------------------------------------------------- /server/database/migrations/0001_illegal_lenny_balinger.sql: -------------------------------------------------------------------------------- 1 | CREATE UNIQUE INDEX `email_idx` ON `waitlist` (`email`); -------------------------------------------------------------------------------- /assets/logos/vuemail-logo-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/masterkram/Nuxt-Waitlist/HEAD/assets/logos/vuemail-logo-dark.png -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // https://nuxt.com/docs/guide/concepts/typescript 3 | "extends": "./.nuxt/tsconfig.json", 4 | } 5 | -------------------------------------------------------------------------------- /drizzle.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'drizzle-kit' 2 | 3 | export default defineConfig({ 4 | dialect: 'sqlite', 5 | schema: './server/database/schema.ts', 6 | out: './server/database/migrations' 7 | }) 8 | -------------------------------------------------------------------------------- /server/database/migrations/0000_silent_hitman.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `waitlist` ( 2 | `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, 3 | `email` text NOT NULL, 4 | `created_at` integer NOT NULL 5 | ); 6 | --> statement-breakpoint 7 | CREATE UNIQUE INDEX `waitlist_email_unique` ON `waitlist` (`email`); -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Nuxt dev/build outputs 2 | .output 3 | .data 4 | .nuxt 5 | .nitro 6 | .cache 7 | dist 8 | 9 | # Node dependencies 10 | node_modules 11 | 12 | # Logs 13 | logs 14 | *.log 15 | 16 | # Misc 17 | .DS_Store 18 | .fleet 19 | .idea 20 | 21 | # Local env files 22 | .env 23 | .env.* 24 | !.env.example 25 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | import colors from 'tailwindcss/colors' 2 | 3 | export default { 4 | theme: { 5 | extend: { 6 | colors: { 7 | primary: colors.emerald 8 | }, 9 | fontFamily: { 10 | display: ['Gabarito'], 11 | body: ['Gabarito'], 12 | }, 13 | } 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /server/utils/drizzle.ts: -------------------------------------------------------------------------------- 1 | import { drizzle } from 'drizzle-orm/d1' 2 | export { sql, eq, and, or } from 'drizzle-orm' 3 | 4 | import * as schema from '../database/schema' 5 | 6 | export const tables = schema 7 | 8 | export function useDrizzle() { 9 | return drizzle(hubDatabase(), { schema }) 10 | } 11 | 12 | export type Waitlist = typeof schema.waitlist.$inferSelect 13 | -------------------------------------------------------------------------------- /app.config.ts: -------------------------------------------------------------------------------- 1 | export default defineAppConfig({ 2 | ui: { 3 | colors: { 4 | primary: "sky", 5 | neutral: "zinc", 6 | } 7 | }, 8 | waitlist: { 9 | showSignups: true, 10 | }, 11 | socials: [ 12 | { icon: "tabler:brand-twitter", link: ""}, 13 | { icon: "tabler:brand-github", link: ""}, 14 | { icon: "tabler:brand-youtube", link: ""} 15 | ], 16 | }); 17 | -------------------------------------------------------------------------------- /server/api/count.get.ts: -------------------------------------------------------------------------------- 1 | import { useDrizzle } from "~/server/utils/drizzle"; 2 | import { count, sql } from "drizzle-orm"; 3 | 4 | export default defineEventHandler(async (event) => { 5 | const entry = await useDrizzle() 6 | .select({ count: count() }) 7 | .from(tables.waitlist); 8 | 9 | if (entry.length === 1) { 10 | return entry[0]; 11 | } 12 | return null; 13 | }); 14 | -------------------------------------------------------------------------------- /server/database/schema.ts: -------------------------------------------------------------------------------- 1 | import {sqliteTable, text, integer, uniqueIndex} from 'drizzle-orm/sqlite-core' 2 | 3 | export const waitlist = sqliteTable('waitlist', { 4 | id: integer('id').primaryKey({autoIncrement: true}), 5 | email: text('email').notNull().unique(), 6 | createdAt: integer('created_at', {mode: 'timestamp'}).notNull(), 7 | }, (table) => ({ 8 | emailIdx: uniqueIndex('email_idx').on(table.email) 9 | })) 10 | -------------------------------------------------------------------------------- /server/database/migrations/meta/_journal.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "7", 3 | "dialect": "sqlite", 4 | "entries": [ 5 | { 6 | "idx": 0, 7 | "version": "6", 8 | "when": 1726066158194, 9 | "tag": "0000_silent_hitman", 10 | "breakpoints": true 11 | }, 12 | { 13 | "idx": 1, 14 | "version": "6", 15 | "when": 1727187012751, 16 | "tag": "0001_illegal_lenny_balinger", 17 | "breakpoints": true 18 | } 19 | ] 20 | } -------------------------------------------------------------------------------- /pages/leaderboard.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 20 | -------------------------------------------------------------------------------- /server/api/anon-list.get.ts: -------------------------------------------------------------------------------- 1 | import { useDrizzle } from "~/server/utils/drizzle"; 2 | import { waitlist } from "../database/schema"; 3 | 4 | function anonymize(item: { email: string }) { 5 | const regex = /(?<=.)[^@](?=[^@]*?@)|(?:(?<=@.)|(?!^)\\G(?=[^@]*$)).(?=.*\\.)/gm; 6 | const substitution = `*`; 7 | return item.email.replace(regex, substitution); 8 | } 9 | 10 | export default defineEventHandler(async (event) => { 11 | const entry = ( 12 | await useDrizzle().select({ email: waitlist.email }).from(tables.waitlist) 13 | ).map(anonymize); 14 | 15 | return entry; 16 | }); 17 | -------------------------------------------------------------------------------- /server/plugins/migrations.ts: -------------------------------------------------------------------------------- 1 | import { consola } from 'consola' 2 | import { migrate } from 'drizzle-orm/d1/migrator' 3 | import {useDrizzle} from "~/server/utils/drizzle"; 4 | 5 | export default defineNitroPlugin(async () => { 6 | if (!import.meta.dev) return 7 | 8 | onHubReady(async () => { 9 | await migrate(useDrizzle(), { migrationsFolder: 'server/database/migrations' }) 10 | .then(() => { 11 | consola.success('Database migrations done') 12 | }) 13 | .catch((err) => { 14 | consola.error('Database migrations failed', err) 15 | }) 16 | }) 17 | }) 18 | -------------------------------------------------------------------------------- /assets/css/main.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | @import "@nuxt/ui"; 3 | 4 | html { 5 | font-family: "Gabarito"; 6 | } 7 | 8 | @theme { 9 | --font-sans: 'Gabarito'; 10 | --color-primary-50: var(--ui-color-primary-50); 11 | --color-primary-100: var(--ui-color-primary-100); 12 | --color-primary-200: var(--ui-color-primary-200); 13 | --color-primary-300: var(--ui-color-primary-300); 14 | --color-primary-400: var(--ui-color-primary-400); 15 | --color-primary-500: var(--ui-color-primary-500); 16 | --color-primary-600: var(--ui-color-primary-600); 17 | --color-primary-700: var(--ui-color-primary-700); 18 | --color-primary-800: var(--ui-color-primary-800); 19 | --color-primary-900: var(--ui-color-primary-900); 20 | --color-primary-950: var(--ui-color-primary-950); 21 | } 22 | -------------------------------------------------------------------------------- /components/app/Footer.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 22 | -------------------------------------------------------------------------------- /components/home/Line.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 22 | -------------------------------------------------------------------------------- /pages/index.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 28 | -------------------------------------------------------------------------------- /components/home/Hero.vue: -------------------------------------------------------------------------------- 1 | 18 | -------------------------------------------------------------------------------- /assets/logos/github-mark-white.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /nuxt.config.ts: -------------------------------------------------------------------------------- 1 | // https://nuxt.com/docs/api/configuration/nuxt-config 2 | export default defineNuxtConfig({ 3 | compatibilityDate: "2024-04-03", 4 | devtools: { enabled: true }, 5 | css: ['~/assets/css/main.css'], 6 | modules: [ 7 | "@nuxt/ui", 8 | "@nuxthub/core", 9 | "nuxt-security", 10 | "@nuxt/fonts", 11 | "@nuxt/image", 12 | "@stefanobartoletti/nuxt-social-share", 13 | ], 14 | socialShare: { 15 | baseUrl: 'https://www.yoursite.com' 16 | }, 17 | security: { 18 | headers: { 19 | contentSecurityPolicy: { 20 | "img-src": ["'self'", "data:", "https:"], 21 | }, 22 | }, 23 | }, 24 | ui: { 25 | }, 26 | colorMode: { 27 | preference: "light", 28 | }, 29 | routeRules: { 30 | "/api/join-waitlist": { 31 | security: { 32 | rateLimiter: { 33 | tokensPerInterval: 25, 34 | }, 35 | }, 36 | }, 37 | }, 38 | 39 | hub: { 40 | database: true, 41 | }, 42 | }); -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nuxt-app", 3 | "private": true, 4 | "type": "module", 5 | "scripts": { 6 | "build": "nuxt build", 7 | "dev": "nuxt dev", 8 | "generate": "nuxt generate", 9 | "preview": "nuxt preview", 10 | "postinstall": "nuxt prepare", 11 | "db:generate": "drizzle-kit generate" 12 | }, 13 | "dependencies": { 14 | "@nuxt/image": "^1.8.0", 15 | "@nuxt/ui": "3.0.0-alpha.10", 16 | "@nuxthub/core": "^0.7.12", 17 | "@stefanobartoletti/nuxt-social-share": "1.2.1", 18 | "@vueuse/core": "^12.4.0", 19 | "drizzle-orm": "^0.33.0", 20 | "h3-zod": "^0.5.3", 21 | "mini-svg-data-uri": "^1.4.4", 22 | "nuxt": "^3.13.0", 23 | "nuxt-security": "^2.0.0", 24 | "vue": "latest", 25 | "vue-router": "latest", 26 | "zod": "^3.23.8" 27 | }, 28 | "devDependencies": { 29 | "@iconify-json/tabler": "^1.2.14", 30 | "drizzle-kit": "^0.24.2", 31 | "wrangler": "^3.76.0" 32 | }, 33 | "packageManager": "pnpm@9.12.2" 34 | } 35 | -------------------------------------------------------------------------------- /.github/workflows/nuxthub.yml: -------------------------------------------------------------------------------- 1 | name: Deploy to NuxtHub 2 | on: push 3 | 4 | jobs: 5 | deploy: 6 | name: "Deploy to NuxtHub" 7 | runs-on: ubuntu-latest 8 | environment: 9 | name: ${{ github.ref == 'refs/heads/main' && 'production' || 'preview' }} 10 | url: ${{ steps.deploy.outputs.deployment-url }} 11 | permissions: 12 | contents: read 13 | id-token: write 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | 18 | - name: Install pnpm 19 | uses: pnpm/action-setup@v4 20 | with: 21 | version: 9 22 | 23 | - name: Install Node.js 24 | uses: actions/setup-node@v4 25 | with: 26 | node-version: 22 27 | cache: 'pnpm' 28 | 29 | - name: Install dependencies 30 | run: pnpm install 31 | 32 | - name: Build application 33 | run: pnpm build 34 | 35 | - name: Deploy to NuxtHub 36 | uses: nuxt-hub/action@v1 37 | id: deploy 38 | with: 39 | project-key: nuxt-waitlist-ps62 40 | -------------------------------------------------------------------------------- /server/api/join-waitlist.post.ts: -------------------------------------------------------------------------------- 1 | import {useDrizzle} from "~/server/utils/drizzle"; 2 | import {consola} from "consola"; 3 | import {useValidatedBody, z} from "h3-zod"; 4 | 5 | export default defineEventHandler(async event => { 6 | consola.info("User trying to signup for waitlist...") 7 | 8 | const {email} = await useValidatedBody(event, z.object( 9 | { 10 | email: z.string().email().refine(async (email) => { 11 | const alreadyExists = await useDrizzle().query.waitlist.findFirst({ 12 | where: (waitlist, {eq}) => (eq(waitlist.email, email)), 13 | }) 14 | 15 | return !alreadyExists 16 | }, 'Email is already in use') 17 | } 18 | )) 19 | 20 | consola.info("User joining waitlist...") 21 | 22 | 23 | const entry = await useDrizzle().insert(tables.waitlist).values({ 24 | email, 25 | createdAt: new Date(), 26 | }).returning().get() 27 | 28 | 29 | consola.info(`User ${entry.email} is now on waitlist...`) 30 | 31 | return entry 32 | }) 33 | -------------------------------------------------------------------------------- /components/home/Features.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 23 | -------------------------------------------------------------------------------- /components/home/Video.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | -------------------------------------------------------------------------------- /app.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 30 | 31 | 37 | -------------------------------------------------------------------------------- /server/database/migrations/meta/0000_snapshot.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "6", 3 | "dialect": "sqlite", 4 | "id": "cf043203-7d1d-4ea0-ba20-ee1be749df9b", 5 | "prevId": "00000000-0000-0000-0000-000000000000", 6 | "tables": { 7 | "waitlist": { 8 | "name": "waitlist", 9 | "columns": { 10 | "id": { 11 | "name": "id", 12 | "type": "integer", 13 | "primaryKey": true, 14 | "notNull": true, 15 | "autoincrement": true 16 | }, 17 | "email": { 18 | "name": "email", 19 | "type": "text", 20 | "primaryKey": false, 21 | "notNull": true, 22 | "autoincrement": false 23 | }, 24 | "created_at": { 25 | "name": "created_at", 26 | "type": "integer", 27 | "primaryKey": false, 28 | "notNull": true, 29 | "autoincrement": false 30 | } 31 | }, 32 | "indexes": { 33 | "waitlist_email_unique": { 34 | "name": "waitlist_email_unique", 35 | "columns": [ 36 | "email" 37 | ], 38 | "isUnique": true 39 | } 40 | }, 41 | "foreignKeys": {}, 42 | "compositePrimaryKeys": {}, 43 | "uniqueConstraints": {} 44 | } 45 | }, 46 | "enums": {}, 47 | "_meta": { 48 | "schemas": {}, 49 | "tables": {}, 50 | "columns": {} 51 | }, 52 | "internal": { 53 | "indexes": {} 54 | } 55 | } -------------------------------------------------------------------------------- /components/app/Navbar.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 28 | 29 | 38 | -------------------------------------------------------------------------------- /server/database/migrations/meta/0001_snapshot.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "6", 3 | "dialect": "sqlite", 4 | "id": "cb616729-fbff-4573-ad26-2bad022df348", 5 | "prevId": "cf043203-7d1d-4ea0-ba20-ee1be749df9b", 6 | "tables": { 7 | "waitlist": { 8 | "name": "waitlist", 9 | "columns": { 10 | "id": { 11 | "name": "id", 12 | "type": "integer", 13 | "primaryKey": true, 14 | "notNull": true, 15 | "autoincrement": true 16 | }, 17 | "email": { 18 | "name": "email", 19 | "type": "text", 20 | "primaryKey": false, 21 | "notNull": true, 22 | "autoincrement": false 23 | }, 24 | "created_at": { 25 | "name": "created_at", 26 | "type": "integer", 27 | "primaryKey": false, 28 | "notNull": true, 29 | "autoincrement": false 30 | } 31 | }, 32 | "indexes": { 33 | "waitlist_email_unique": { 34 | "name": "waitlist_email_unique", 35 | "columns": [ 36 | "email" 37 | ], 38 | "isUnique": true 39 | }, 40 | "email_idx": { 41 | "name": "email_idx", 42 | "columns": [ 43 | "email" 44 | ], 45 | "isUnique": true 46 | } 47 | }, 48 | "foreignKeys": {}, 49 | "compositePrimaryKeys": {}, 50 | "uniqueConstraints": {} 51 | } 52 | }, 53 | "enums": {}, 54 | "_meta": { 55 | "schemas": {}, 56 | "tables": {}, 57 | "columns": {} 58 | }, 59 | "internal": { 60 | "indexes": {} 61 | } 62 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NuxtWaitlist - Simple Waitlist Template 2 | 3 | ![259shots_so](https://github.com/user-attachments/assets/147822de-6884-4e3f-a4fc-ca81cf100cc2) 4 | 5 | This is a full stack nuxt waitlist template. It allows you to collect emails of people who are potentially interested in buying your product. 6 | 7 | ## Tech Stack 8 | - [Typescript](https://www.typescriptlang.org/) - Language 9 | - [Nuxt.js](https://www.nuxt.com/) - Framework 10 | - [Drizzle](https://orm.drizzle.team/) - ORM 11 | - [Tailwind](https://tailwindcss.com/) - CSS 12 | - [NuxtHub](https://hub.nuxt.com) - Hosting 13 | 14 | ## Prerequisites 15 | - [NuxtHub](https://hub.nuxt.com/) Account 16 | - Cloudflare account 17 | 18 | ## Setup 19 | 20 | ```bash 21 | # clone repository 22 | git clone git@github.com:masterkram/Nuxt-Waitlist.git [YOUR_APP_NAME] 23 | cd [YOUR_APP_NAME] 24 | 25 | # npm 26 | npm install 27 | ``` 28 | 29 | ## Development Server 30 | 31 | Start the development server on `http://localhost:3000`: 32 | 33 | ```bash 34 | # npm 35 | npm run dev 36 | ``` 37 | 38 | ## Customization 39 | 40 | 1. edit `app.config.ts` 41 | 2. edit h1 and hero description in `pages/index.vue` 42 | 43 | ## Deploy 44 | 45 | Deploy the application to NuxtHub 46 | 47 | ```bash 48 | npx nuxthub deploy 49 | 50 | # Choose 51 | # Deploy to NuxtHub?: Yes 52 | # Select a project: Create a new project 53 | # Project name: [YOUR_APP_NAME] 54 | # Select a region for the storage: [YOUR_REGION] 55 | # Production branch: main 56 | ``` 57 | 58 | > Run the migrations 59 | 60 | ```bash 61 | npx nuxt dev --production 62 | ``` 63 | 64 | Check out the [deployment documentation](https://hub.nuxt.com/docs/getting-started/deploy) for more information. 65 | 66 | -------------------------------------------------------------------------------- /components/app/NavbarWhatsNew.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 25 | 26 | -------------------------------------------------------------------------------- /assets/logos/nuxt-logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /assets/logos/resend-logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /assets/logos/tailwindcss-logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /assets/logos/nuxt-hub-logo-white.svg: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /components/home/WaitlistForm.vue: -------------------------------------------------------------------------------- 1 | 92 | 93 | 160 | 161 | 172 | --------------------------------------------------------------------------------