Next.jsReact启动器

nextjs-firebase-mui-starter — Next.js 启动器模板

作者 MartinXPN

基于 Next.js、Firebase 与 MUI 的启动器模板,预置认证、服务端渲染、分析及邮件发送等基础代码,用于快速搭建全栈 Web 项目。

看看你的网站会是什么样

浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。

3 个预览视图
桌面端首页1 / 3
桌面端截图首屏预览

由服务器浏览器实际访问页面后截取。

全部页面与视图 3

截图用于了解视觉与布局,交互效果请以实际项目为准。

采集于 2026-10-03查看来源

值得关注的模板亮点

从已有项目资料中,快速了解它的特点。

01

预置 Next.js 服务端渲染与 app router 结构

02

集成 Firebase 认证、Firestore 与 Functions 的基础代码

03

使用 MUI 组件与图标构建界面

04

包含分析埋点与发送邮件的示例代码

05

README 提供表单、数据建模与 AI 代理使用的实践说明

模板详细介绍

该模板来自 MartinXPN 的公开仓库,定位为 Next.js + Firebase + MUI 项目的启动器。仓库包含启动一个全栈项目所需的基础代码,覆盖认证、服务端渲染、MUI 组件、分析以及发送邮件等能力。技术选型上,前端以 React 与 Next.js 的 app router 为核心,UI 层采用 MUI 组件与图标,后端与数据层使用 Firebase,包括 Authentication、Firestore、Storage 与 Functions。README 还讨论了表单方案(Zod 与 React Hook Form)、Firestore 数据建模与安全规则,以及 AI 代理与 MCP 服务器的使用建议。

使用限制方面,模板代码采用 MIT 许可,可免费使用、修改、商用与分发,但分发时需保留版权与许可声明。Firebase 相关动态功能需要自行配置,并需核对 Firebase 的额度与收费;演示图片、字体、图标等第三方素材需按各自许可单独核对。域名、托管、数据库、支付或 AI 等外部服务可能另外收费。README 中关于 AI 代理、技能与 MCP 服务器的内容属于方法论建议,并非模板内置功能。

Next.jsReact启动器

适合你的项目吗?

适用场景

  • 需要快速启动一个带认证与数据库的全栈 Web 项目
  • 希望以 Next.js 服务端渲染方式构建对搜索引擎友好的页面
  • 使用 MUI 作为 UI 组件库并需要现成的基础布局
  • 在 Firebase 上搭建后端并需要认证、存储与云函数示例

适合人群

  • 熟悉 React 与 Next.js 的开发者
  • 计划使用 Firebase 作为后端服务的团队
  • 希望以 MUI 组件快速搭建界面的项目
  • 需要参考全栈启动器代码结构的学习者

上手与定制指南

结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。

  1. 1

    需自行创建 Firebase 项目并配置认证、Firestore 与 Functions 等对应服务

  2. 2

    启用 Firebase 动态功能前应核对额度与计费方式

  3. 3

    模板代码为 MIT 许可,分发时需保留版权与许可声明

  4. 4

    演示图片、字体、图标等第三方素材需按各自许可单独核对

查看仓库使用说明

授权与来源资料

使用条件与限制

免费使用 · 保留许可声明

本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。

使用时需要遵守

  • 允许免费使用、修改、商用和分发该版本代码。
  • 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
  • 代码按现状提供;担保与责任限制以原许可证及适用法律为准。

额外费用与待核对事项

  • 运行项目必须自行准备 .env 或 .env.local 并填写 Firebase、PostHog、Resend 等环境变量,否则无法启动。
  • 运行测试或部署 Firebase Functions 时,还需在 functions/ 目录放置 .env 文件。
  • 执行测试需要额外创建一个独立的 Firebase 项目,以免影响生产环境。
  • 认证功能依赖将 Next.js 应用部署到指定域名(auth.profound.academy)才能正常工作。
  • 认证、存储、数据库与后端逻辑均依赖 Firebase 服务,需自行开通并承担相应费用。
  • 分析、会话回放、异常捕获与日志依赖 PostHog 外部服务,需配置密钥并可能产生费用。
  • 邮件发送依赖 Resend 外部服务,需配置 RESEND_API_KEY 并可能产生费用。
  • AI 功能依赖 Vercel AI SDK 及第三方模型提供商,需自行接入并承担调用费用。
  • 前端部署依赖 Vercel,后端依赖 Google Cloud/Firebase,均属外部托管服务并可能收费。
  • README 建议使用 Firestore Enterprise 版 Native 模式,该版本可能涉及额外计费。
  • README 提及 Firebase 集成;启用相关动态功能前需自行配置,并核对 Firebase 的额度与收费。
  • 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
  • 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
查看原文依据

Permission is hereby granted, free of charge

许可证原文

To run the project, you'll need `.env` or `env.local` file with corresponding environment variables.

README 原文

When running tests or deploying firebase functions, you'll need to place the `.env` file in the `functions/` directory.

README 原文

To execute the tests, a separate Firebase project is created to make sure the production project is intact.

README 原文

For Authentication to work properly, we also deploy the Next.js application to `auth.profound.academy` so that Firebase is able to handle authentication without issues.

README 原文

We currently use Firebase for authentication, storage, database (Firestore), and serverless functions to handle custom backend logic.

README 原文

For general analytics and product monitoring, we use [PostHog](https://posthog.com), including analytics, session replay, exception capture, logs, and production sourcemaps.

README 原文

We've recently switched from sending emails with Sendgrid to sending them with [`react-email`](https://github.com/resendlabs/react-email) and [Resend](https://resend.com).

README 原文

We currently use the [AI SDK](https://ai-sdk.dev/) from Vercel to integrate different AI model providers into our application and create our own custom Agents.

README 原文

As the whole backend code sits on Firebase (Google Cloud), the frontend code is deployed to [Vercel](https://vercel.com).

README 原文

I would advise starting the project with Firestore's Enterprise database variant in Native mode.

README 原文
https://github.com/MartinXPN/nextjs-firebase-mui-starter/blob/main/LICENSEhttps://github.com/MartinXPN/nextjs-firebase-mui-starter/blob/main/README.md

DeepSeek 根据仓库许可证和 README 整理 ·2026-10-03。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。

项目核对记录与介绍依据

模板资料

来源平台
GitHub
资料与维护参考分
资料较完整 · 92 / 100
技术栈
Next.js · React
网站类型
启动器
这个分数如何计算

本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。

这个项目需要核对什么

记录的仓库更新时间
2026-08-19
截图检查日期
2026-10-03

已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。

目录记录的主要技术栈是 Next.js。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。

查看具体选型方法 →

介绍的制作与核对状态

介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。

已完成服务器许可规则与 AI 来源核对;未经过人工编辑审核。

查看当时使用的来源资料

SHA-256: b65f397d0c993fb84a1be766a303e899d97e2f46726d376a425bf499a963c5fd

2026-10-03T05:54:41.742Z

来源文件 / 仓库
# The Teach Stack for Building Full-Stack Apps in the AI-Agentic Era (2026 Edition)

![tech-stack-wallpaper](https://github.com/user-attachments/assets/8acc6999-8f11-4ada-a891-8547e6f6e556)

This repo is a template described in the blog post 
[The Teach Stack for Building Full-Stack Apps in the AI-Agentic Era (2026 Edition)](https://dev.to/martinxpn/the-teach-stack-for-building-web-platforms-in-the-ai-native-era-45ka).

---

Tools like Claude Code and Codex have completely reshaped how software engineering is done. This new tooling allows for much faster development and iteration, but it's important to keep the code maintainable and scalable to make sure the project can continue evolving over the long term.


When working on a startup, the speed of iteration is key. The requirements change quickly, features are added daily, and code gets modified rapidly. In those conditions, picking technologies that enable fast iteration, while ensuring your users get the best experience possible, is crucial.


During the last four years or so, we have experimented with many modern technologies while building [Profound Academy](https://profound.academy). So, in this blog post, I'd like to present the whole tech stack that enables building quickly, while having a highly maintainable codebase, scalable infrastructure, and a great user experience. We'll cover everything from Authentication to UI, we'll talk about the backend, hosting, testing, and much more!


## AI Agents, Skills, and MCP servers
AI Agents enable quick iteration and rapid improvement, including bug fixes, the addition of new features, and performance improvements. Yet, it's important to keep the code maintainable for the long run. AI tools make it really easy to overengineer things and add thousands of lines of code to a project. It's important to resist the urge to solve problems that don't exist yet, and keep things simple (both in terms of the code, the infrastructure, and the user experience).

Even in the Agentic Software Development Era, having a small and simple setup helps. Agents coordinate better, features are added faster, bugs are fixed more easily, and the code is maintainable by humans, too.

So, we have chosen to take a balanced/nuanced approach to how we use AI Agents when it comes to working on code that's pushed to production. The setup for AI Agents is pretty simple:
- Keep the `AGENTS.md` or `CLAUDE.md` file as small as possible. It should only contain things that you keep repeating in every conversation with the agent, and some project-specific things that the Agents keep getting wrong.
- Large `AGENTS.md` files can actually hurt the performance of an LLM and make it less useful.
- For skills, it's best to only install the skills relevant to the current conversation and then remove them when the conversation is over.
- Less is more when it comes to the number of skills installed and the size of the `AGENTS.md` file.
- Here are several skills that can be useful (don't keep them installed all the time, as that contaminates the context window):
  - UI/UX skill: https://github.com/nextlevelbuilder/ui-ux-pro-max-skill
  - React/NextJS skills: https://github.com/vercel-labs/agent-skills
  - Firebase skills: https://github.com/firebase/agent-skills
  - PostHog skills: https://github.com/posthog/skills

For MCP Servers, the one from PostHog allows for easy access to Error traces and logs, which helps in debugging and fixing issues.

[Context7](https://github.com/upstash/context7) is an MCP server that provides code documentation for LLMs. That way, the Agents can reference the latest docs of libraries and frameworks.

In most cases, the Agents are smart enough to figure things out without the extra help from the MCP server. So, I find myself rarely needing to install/enable the MCP servers.

## Frontend
As the core frontend technology, [React](https://react.dev) stands out as the top pick for many full-stack projects. While there are other options like Vue or Svelte, React shines because of its vast range of libraries. This big ecosystem makes it easier to add new features and change things fast, which is why it's a favorite for many developers.

However, React, as a frontend library, often doesn't get along well with search engines like Google or Bing. These search engines use bots to look through the HTML of a page and understand its content. Yet, pages built with React usually start with an empty HTML body from the server. This means if you want your website to show up in search results on Google, Bing, or other search engines, you need to make sure the first content from the server includes HTML elements filled with the right information about the page.

That's where [Next.js](https://nextjs.org) shines. It's a React framework that provides server-side rendering and static website generation. So, the pages powered with Next.js get rendered on the server first, after which the HTML is sent to the browser, making sure the initial content of the page has all the necessary information about the page. After the page is rendered, only the necessary JavaScript is sent to the client, making sure that the bundle sent to the user's browser is minimal. This improves both the user experience and how well search engine bots understand the page.

The latest standard in NextJS projects is the `app router`, which makes it easy for developers to use features like incremental static regeneration, partial pre-rendering, and many other features that improve the user experience and make the app feel faster. So, I highly recommend [starting the project](https://nextjs.org/docs/app/getting-started/installation) with the `app router`.

React is moving in the server-side direction (becoming somewhat similar to PHP), and Next.js `app router` provides a great developer experience for developing "server-first" React components. Features like caching, TurboPack, and AI agent-friendly setup in Next.js make it easy to build and iterate quickly.


## UI
When developing web apps, the traditional workflow in companies goes through several stages, which include planning, UI/UX design, implementation, and many iterations of back and forth between designers and developers. Startups require quick iteration, where keeping the development cycle short is crucial.

In our experience, the most efficient way of going about UI/UX was by picking a solid UI framework ([MUI](https://mui.com) in our case) and following a design template instead of asking a designer to create everything in Figma, after which the developers would re-create everything in the React app. We kept a single source of truth - the codebase. This literally saved us months!

MUI has a rich collection of highly customizable components that cover the most common use cases. The great thing is that everything is customizable, but because of the great defaults, in most cases, we would end up using the components with all their default behaviors and appearances.

One bonus of using MUI is that it also provides a [wide collection of icons](https://mui.com/material-ui/material-icons) that can be used as React components. This makes including icons in the app very straightforward.

There are several alternatives to MUI:
- [shadcn/ui](https://ui.shadcn.com) is a modern alternative that is very popular. Although I can't convince myself that copy-pasting the library code (through CLI) into your codebase is a good idea.
- [Ant Design](https://ant.design) is also a great alternative.
- [Chakra UI](https://chakra-ui.com) can also be used as a UI Framework.
- [HeroUI](https://heroui.com/), previously known as NextUI, is also great.

Some people suggest just using [styled components](https://styled-components.com). Some use [Tailwind CSS](https://tailwindcss.com). Yet, for both styled components and Tailwind CSS, one still writes a lot of CSS. This might not provide the best developer experience compared to using a UI Framework, especially if we aim to avoid designing all the pages on the website.

One can look for inspiration in different Template stores:
- MUI Store is great and contains many stunning UI templates: https://mui.com/store
- Dribble also has some nice templates - https://dribbble.com/tags/react_template

Alternatively, you can just ask the AI Agent to design several prototypes and pick the best one from those. To improve the UI generated, you can add skills like the UI/UX skill: https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.


## Forms
Forms are a big part of full-stack projects. In our experience, [Zod](https://zod.dev) and [React Hook Form](https://react-hook-form.com) work great together and provide all the functionality one might need to create forms. In this combo, Zod provides schema validation (types, min/max bounds, lengths, enums, etc.) while React Hook Form gives a flexible API to interact with the form. With these two libraries, one can nest components that interact with the same form, perform different complex validations, and update the data on the fly. They make working with forms seem too easy.

## Backend, Authentication, and Database
Platforms like [Firebase](https://firebase.google.com) and [Supabase](https://supabase.com) provide backend as a service, helping you scale to millions of users without maintaining your own infrastructure. We currently use Firebase for authentication, storage, database (Firestore), and serverless functions to handle custom backend logic.

#### Authentication
One great product that can be used for authentication is [Clerk](https://clerk.com), but we currently use the default Firebase authentication system as it works pretty well. Firebase even has a separate package called [`firebaseui-web`](https://github.com/firebase/firebaseui-web) that helps one set up Firebase authentication without writing any UI code.

For Authentication to work properly, we also deploy the Next.js application to `auth.profound.academy` so that Firebase is able to handle authentication without issues.

#### Database
When developing large projects in a traditional way (separate frontend + separate backend with a database), one usually ends up having many API calls, triggered from the frontend, that modify the database entries. For many projects, 80% of those calls are simple CRUD (Create, Read, Update, Delete) operations. The other 20% involve more complex operations (like updating several entries or reading and aggregating data from several sources). One thing that Firebase does that's really smart is optimize for the 80%, making it very easy to manipulate data from the frontend without redundant API endpoints (the other 20%, which require more complex logic, can be handled with Firebase Functions).

This is achieved with 2 components:
1. **Firestore Rules**: Everything related to access management and permissions is isolated into a single file: `firestore.rules`. This makes sure that API Endpoints don't need to check for user permissions in every function, as Firebase does that automatically - it checks if the user is allowed to read the given piece of data or create/update/delete it. This isolation is invaluable when writing code, as it helps drastically reduce redundant boilerplate code.
2. **Firestore Client SDK**: Creating, reading, updating, or deleting data is handled through the Firebase SDK. It provides many useful features like listening for real-time updates, incrementing counters, and batching updates together. All of which gets checked against `firestore.rules` automatically!

One caveat of using Firestore is the mental model for storing the data. As Firestore is optimized for read operations (which are usually the majority), it encourages keeping the data denormalized. This can be counterintuitive, especially for people coming from an SQL background. Here is a great talk explaining the details of data modeling in Firestore: [link](https://youtu.be/lW7DWV2jST0).

Overall, Firestore provides a great user experience (especially through real-time change listeners) and developer experience, making it easy to move fast and adapt the whole application to changing needs.

I would advise starting the project with Firestore's Enterprise database variant in Native mode. That supports many more features that might not be available in the prior (standard) versions of Firestore, like pipeline queries, built-in full-text search, etc. This gives the full flexibility of a MongoDB-like database, with the ease of use that comes with Firestore.

#### Serverless Functions
We usually like to keep the client code very simple, while isolating the more involved parts into the backend code - inside serverless functions. Keeping the frontend code "dumb", while the backend "smart" has worked pretty well. Firebase provides a service called Functions, which can contain any backend code and is triggered in several ways. They can be invoked with a regular HTTP request, get triggered as soon as an entry is created or updated in Firestore, or run periodically as a cron job with Pub/Sub. This way, we can have all the functionality we need on the "server" implemented in separate serverless functions. The best part is that the serverless functions scale up and down really well. So, big spikes in traffic are handled automatically by Google, and you get charged for only the resources used - idle time is free.

---

In general, BaaS technologies like Firebase save a lot of time. In most cases, they just work! I very rarely find myself debugging an issue caused by some irregularity in a database, a failed migration, or something similar.

## AI Features
AI is a big part of modern web apps, and many applications integrate AI chatbots and Agents into their offering.  We currently use the [AI SDK](https://ai-sdk.dev/) from Vercel to integrate different AI model providers into our application and create our own custom Agents.

The great thing about the AI SDK is that it's easy to integrate different AI models into the application and switch between them when necessary. The developer experience is much cleaner than any of the model-specific SDKs.


## Tests
Testing is probably one of the most controversial topics, especially for startups that have constantly changing requirements. In the early days, we didn't have tests. Yet, as the product grew, it became almost impossible to make changes to the existing codebase, while being confident that everything would work fine after the changes were pushed to production. So, we started introducing tests for the "backend". More specifically, the service layer of Firebase Functions. The frontend is not tested as we keep it "dumb", while the backend code, which is "smart", is tested against edge cases. Most tests are integration tests. We very rarely do unit tests. As most services touch several other parts, it's more reasonable to perform integration tests to make sure all the parts work fine together, without mocking too much.

To test the backend, we use [jest](https://jestjs.io). One library that helps a lot in automatically generating fake data inside tests is [faker.js](https://fakerjs.dev).

To execute the tests, a separate Firebase project is created to make sure the production project is intact. Having a separate "test" Firebase project helps in iterating quickly and not worrying about affecting the users. After all the tests are passed, the new version of Firebase Functions can be pushed to production.


## Refactoring
As the project grows, features are added or modified, requirements change, and things get "old", **refactoring** becomes inevitable. The two largest contributors to a confident code modification process are [TypeScript](https://www.typescriptlang.org) and robust Integration tests. TypeScript takes care of the type safety after changes, while the integration tests make sure that the logic hasn't been broken during those changes.

Project refactoring actually happens more often than expected. For instance, we haven't had a 6-month period where we haven't done any major refactoring in the project. As the platform constantly changes, the addition of some technologies requires some major code modifications. Two of our largest refactoring milestones were switching from pure React to Next.js and switching from Next.js `pages router` to the `app router`.


## Hosting
As the whole backend code sits on Firebase (Google Cloud), the frontend code is deployed to [Vercel](https://vercel.com). It provides the most convenient infrastructure to ship Next.js projects. Vercel makes it very straightforward to deploy Next.js applications. It has a GitHub integration, which works really well with branches (without any manual setup):
* As soon as something gets pushed to the `main` branch, Vercel automatically deploys it to production.
* As soon as something gets pushed to some other branch, Vercel automatically creates a "Preview" deployment and generates a separate link for that deployment. After which, the link contains the deployed version of that branch. So, iterating is very convenient and fast.


## Analytics and Monitoring
Knowing your users and how they use your product is invaluable. It can save weeks or sometimes even months of development time, helping prioritize the right things. The right monitoring can help improve the user experience by fixing common bugs and issues.

For general analytics and product monitoring, we use [PostHog](https://posthog.com), including analytics, session replay, exception capture, logs, and production sourcemaps.

Alternatively, you can use [Google Analytics for Firebase](https://firebase.google.com/docs/analytics) (with more setup, but free of charge) or [Sentry](https://sentry.io) (which is a bit more expensive).

All of these help a lot in improving the product and really knowing your users. However, there is nothing like [directly talking to them](https://youtu.be/z1iF1c8w5Lg).


## Emails
Emails are one of the most reliable ways of staying in touch with users, sending updates, and engaging them. We've recently switched from sending emails with Sendgrid to sending them with [`react-email`](https://github.com/resendlabs/react-email) and [Resend](https://resend.com).

`react-email` makes it very easy to have highly customizable emails - it basically turns writing an email into writing a React component. Resend, on the other hand, integrates well with `react-email` and has great pricing. The good part about having emails as React components is that they get checked in with the rest of the code to the version control, and one is able to keep track of all the changes in one place.

---


## Prerequisites
To run the project, you'll need `.env` or `env.local` file with corresponding environment variables.
When running tests or deploying firebase functions, you'll need to place the `.env` file in the `functions/` directory.
Below are presented the environment variables required to successfully run the project:

<details>
<summary>.env or .env.local for local development</summary>

```markdown
[email protected]
NEXT_PUBLIC_FIREBASE_PUBLIC_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_DATABASE_URL=
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=
NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID=
NEXT_PUBLIC_RECAPTCHA_KEY=

# https://github.com/vercel/vercel/issues/749#issuecomment-707515089
PRIVATE_FIREBASE_PRIVATE_KEY_ID=
PRIVATE_FIREBASE_PRIVATE_KEY='"-----BEGIN PRIVATE KEY-----\n.....==\n-----END PRIVATE KEY-----\n"'

# Secrets used to sign cookies (2 random strings of your choice)
COOKIE_SECRET_CURRENT=
COOKIE_SECRET_PREVIOUS=
NEXT_PUBLIC_COOKIE_SECURE=false # set to true in HTTPS environment

# PostHog (analytics, product monitoring, and sourcemaps)
NEXT_PUBLIC_POSTHOG_KEY=phc_
POSTHOG_API_KEY=phx_
POSTHOG_PROJECT_ID=123456

# Firebase Functions
RESEND_API_KEY=

# Local development
HOST=local
GOOGLE_APPLICATION_CREDENTIALS=/absolute/path/to/firebase-test-key.json
```

</details>


## Running the project
Available scripts include:
* `pnpm dev` Runs the app in the development mode
* `pnpm build` Builds the app for production
* `pnpm start` Starts the app in production mode
* `pnpm emulate` Emulates the whole Firebase stack locally. On first run, it exports emulator data to `./test_data`; on later runs, it imports from that directory.
* `pnpm --dir functions test` Runs the Firebase Functions test suite
* `firebase deploy` Deploys the Firebase project to production (Functions, Firestore, and rules)
* `firebase deploy --only functions` Deploys the Firebase Functions to production
* `lsof -t -i tcp:5000 | xargs kill &&  lsof -t -i tcp:5001 | xargs kill &&  lsof -t -i tcp:9099 | xargs kill &&  lsof -t -i tcp:8080 | xargs kill &&  lsof -t -i tcp:9199 | xargs kill &&  lsof -t -i tcp:8087 | xargs kill # firebase kill all emulators` Kills all firebase emulators and frees up ports

## Project structure
The project is organized as a mono-repo that includes both the front-end (Next.js app) and the backend-end (Firebase serverless functions)
in one repository. Therefore, some things like models (schemas) are shared between those two major components to avoid replication.

```markdown
project
├── firebase        (includes Firebase-specific files like Storage and Firestore rules and Firestore indexes)
├── functions       (firebase serverless functions)
│   ├── emails      (react-email templates)
│   ├── generators  (generators for models to speed up testing)
│   ├── models      (all the models for both the front-end and the backend)
│   ├── services    (the main functionality of each endpoint)
│   ├── shared      (shared code between the whole app, including Firebase Functions and the Next.js app)
│   ├── test        (includes tests for the serverless functions)
│   └── index.ts    (all the Firebase functions endpoints)
├── public          (static assets, etc.)
└── src             (the main Next.js app source code)
    ├── app         (Next.js app router)
    ├── auth        (Everything related to authentication)
    ├── components  (React components)
    ├── hooks       (React hooks. Note that we don't create hooks for all the services (like useUser). We only have global hooks like `useAsyncEffect` or `useStickyState`.)
    ├── server      (Next.js layer that works on the server side)
    └── services    (includes client-side logic for reading/writing to firestore, connecting to firebase functions, uploading files, etc.)
```
反馈内容错误

看看同类模板

对比同技术栈与用途的模板,找到更适合的视觉与内容结构。