Next.js 13
Start your next

project in a minutes not weeks.

What's included:

✔️ Next.js 13 – starter package with project structure, configuration, and SSR.

✔️ SEO-friendly React + Typescript full-stack site with minimalistic design.

✔️ Firebase Authentication workflows with public and protected pages.

✔️ ChatGPT integration.

✔️ Serverless API with Cloud functions.

✔️ Firebase Firestore database integration.

✔️ Firebase Storage access with custom claims.

✔️ TailwindCSS.

✔️ cloud deployment ready.

✔️ payments integration.

✔️ Google Analytics.

✔️ Setup instructions and this site codebase.

✔️ For personal and commercial project or simply for learning.

Sign in
to purchase the package.

🚀 Getting Started

  1. Download and extract .zip file to the project directory.

  2. Ensure Node.js is installed.

  3. Run npm install.

  4. Run npm run dev, open http://localhost:3000 in your browser.

💬 ChatGPT

  1. Copy and paste your OPENAI_API_KEY and OPENAI_ORGANIZATION variables to .env file.

  2. Sign in to access the protected page and try ChatGPT integration.

🔥 Firebase setup

Authentication providers:

  1. Go to Firebase console and create a project.

  2. Authentication -> Sign-in methods: enable Email/Password and Google sign-in providers.

  3. Authentication -> Settings -> Add domain: add localhost to allowed domains.

  4. Authentication -> Templates -> Password reset -> Customize action URL: add http://localhost:3000.

Firestore database setup:

  1. Create database with production mode.

Firebase application setup:

  1. Project settings -> General: create a new web-application.

  2. Project settings -> Service account -> Generate new private key.

  3. In the project folder, you can see env.example file, rename it to .env.

  4. Copy and paste your SDK configuration and Service account variables to .env file.

Notice: variables prefixed as NEXT_PUBLIC are public and automatically exposed to the browser, otherwise variables are private and used for the server-side. Private variables secured by Next.js framework. Make sure you added the .env file to .gitignore.

☁️ Cloud functions

Vercel provides a serverless functions that allows to run code on-demand in response to incoming HTTP requests without having to manage infrastructure. Read more about Edge functions.

Any file inside ./pages/api/ folder is mapped to /api/* and will be treated as an API endpoint instead of a page. Those functions are server-side only and won't increase your client-side bundle size.

Check out ./pages/api/edge.ts

/* This example shows how to use the request.geo
   object to determine a user's location. */

export const config = {
  runtime: 'edge',

const edge = async (req: NextRequest) => {
  const { nextUrl: url, geo } = req;
  const country = geo?.country || 'US';
  const city = geo?.city || 'San Francisco';
  const region = geo?.region || 'CA';
  const countryInfo = countries.find((x) => x.cca2 === country);
  const flag = countryInfo?.flag;

  return NextResponse.json({ url, country, region, city, flag });

export default edge;

💳 Stripe

Stripe with Firebase:

This extension syncs customers’ subscription status with your Cloud Firestore and adds custom claims using Firebase Authentication for convenient access control in your application.

Stripe extension setup:

  1. Create an account at the

  2. Switch to test mode.

  3. Create a test product and price at the Stripe dashboard.

  4. Create Restricted key with write access to Customers, PaymentIntents and Products.

  5. Add your Stripe Restricted API key as variable NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY, and your Stripe Secret key as STRIPE_SECRET_KEY to the .env file.

  6. Add your test product's price id as NEXT_PUBLIC_STRIPE_PRICE to the .env file.

  7. Go to Firebase console.

  8. Extension -> Explore extensions marketplace: install Run Payments with Stripe extension.

  9. Extension -> Run Payments with Stripe -> Extension configuration: Setup Webhooks, API keys, Events and Security rules following How this extension works guide.

  10. Use 4242 4242 4242 4242 as credit card number any expiration date and cvc code.

📦 Firebase Storage

  1. Whenever user made a subscription, custom claims added to Authentication token to allow access to Storage files.

  2. Check out ./firebase/serverUserSessionUtils.ts

if (isSubscriber) {
  await getAuth().setCustomUserClaims(authData.uid, { subscriber: true });
  1. Storage -> Rules: add security rule to grant access to Storage with custom claim subscriber.
rules_version = '2';
service {
  match /b/{bucket}/o {
    match /{allPaths=**} {
      allow write: if false;
      allow read: if request.auth.token.subscriber == true;
  1. Storage files access controlled by custom claims attribute.

🚚 Deploy

Vercel cloud platform:

Vercel is a cloud platform that makes it easy to deploy and host web projects, including static sites and serverless functions.

Vercel CLI setup:

  1. Run npm install -g vercel.

  2. Run vercel login and to follow the command line instructions.

  3. Deploy to Vercel's cloud vercel --prod.

  4. Go to to manage your deployment and domains.


Copyright © 2023