1 Star 0 Fork 0

BruceLuo / my-threads

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open 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 to automatically optimize and load Inter, a custom Google Font.

Learn More

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

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

create project step

  1. 提交双仓库
git remote -v 查看当前仓库源
git remote set-url --add origin https://gitee.com/BruceLluo/my-threads.git
  1. 创建项目
npx create-next-app@latest ./

npm install @clerk/nextjs @uploadthing/react mongoose svix uploadthing tailwindcss-animate @clerk/theme
  1. clerk登录注册校验模块
使用next router 路由组,这允许您将路线段和项目文件组织到逻辑组中,而不影响 URL 路径结构。还可以嵌套路由,多个layout
(auth)->sign-in->sign-out
  1. topbar顶部导航栏
[https://app.logo.com/dashboard/logo_4a0f393c-f0be-42c7-93f0-169ba515c728/your-logo-files]设置自己logo
[https://favicon.io/favicon-converter/] 生成icon
引入clerk组件
   {/* clerk退出登录组件 */}
        <div className='block md:hidden'>
          <SignedIn>
            <SignOutButton>
              <div className='flex cursor-pointer'>
                <Image
                  src='/assets/logout.svg'
                  alt='logout'
                  width={24}
                  height={24}
                />
              </div>
            </SignOutButton>
          </SignedIn>
        </div>

        {/* clerk组织组件 */}
        <OrganizationSwitcher
          appearance={{
            baseTheme: dark,
            elements: {
              organizationSwitcherTrigger: "py-2 px-4",
            },
          }}
        />
  1. 左边导航栏
import { usePathname, useRouter } from "next/navigation";

useRouter,usePathname获取路由信息
  1. 移动端底部导航栏
  2. 完善登录信息流程onboarding
AccountProfile.tsx
引入shadcn ui 创建表单
npx shadcn-ui@latest init
npx shadcn-ui@latest add form input textarea

引入react-hook-form进行表单校验
引入zod 进行ts声明数据类型校验
引入uploadthing进行头像等资源上传,免费2g

使用nextjs中的server action 实验版
函数在服务器运行,但是可以在客户端调用
user.actions.ts中连接mongoose数据库,mongoosedb network access 设置允许所有ip 0.0.0.0./0
使用next的revalidatePath重新验证数据,并更新页面内容

提交表单上传头像,数据插入数据库
onboarding 同步数据库数据
  1. 创建帖子,配置表单校验, 数据库model创建, thread action创建

  2. 首页展示帖子, 创建ThreadCard

  3. 帖子进行评论,展示回复贴子

  4. 个人资料页,资料tabs,帖子

npx shadcn-ui@latest add tabs 
ThreadsTab
还有replies,tagged
  1. 搜索用户页
  2. activity 被回复的帖子页
  3. 使用webhook svix监听clerk的Organization 各种事件,数据共享给数据库
api/webhook/clerk/route
  1. 完善社区部分功能

空文件

简介

个人社区threads平台 使用Nextjs 13.4 搭建 使用tailwindcss处理样式 使用clerk进行身份验证,和完善的用户管理 使用shadcn-ui组件库 使用react-hook-form zod进行表单处理和ts校验 使用mongoose连接mongodb数据库 使用 uploadthing进行图片上传处理 使用 svix处理clerk webhook 展开 收起
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/BruceLluo/my-threads.git
git@gitee.com:BruceLluo/my-threads.git
BruceLluo
my-threads
my-threads
main

搜索帮助