首页
/ Airin 项目使用教程

Airin 项目使用教程

2025-04-19 02:52:03作者:田桥桑Industrious

1. 项目目录结构及介绍

Airin 项目的目录结构如下:

airin/
├── .github/              # GitHub 工作流文件
├── public/              # 公共静态文件
├── src/                 # 源代码目录
│   ├── components/      # 通用组件
│   ├── pages/           # 页面组件
│   ├── styles/          # 样式文件
│   ├── utils/           # 工具函数
│   ├── ...              # 其他源代码文件
├── .dockerignore        # Docker 忽略文件
├── .env.example         # 环境变量示例文件
├── .eslintrc.json       # ESLint 配置文件
├── .gitattributes        # Git 属性文件
├── .gitignore           # Git 忽略文件
├── .yarnrc.yml          # Yarn 配置文件
├── Dockerfile           # Docker 构建文件
├── LICENSE              # 许可证文件
├── README.md            # 项目说明文件
├── bun.lockb            # Bun 包管理器锁文件
├── docker-compose.yml   # Docker Compose 配置文件
├── next.config.js       # Next.js 配置文件
├── package-lock.json    # 包版本锁定文件
├── package.json         # 项目包文件
├── postcss.config.js    # PostCSS 配置文件
├── tailwind.config.js   # Tailwind CSS 配置文件
├── tsconfig.json        # TypeScript 配置文件
└── yarn.lock            # Yarn 包管理器锁文件
  • .github/: 包含 GitHub Actions 工作流文件,用于自动化项目的一些流程,如 CI/CD。
  • public/: 存放公共静态文件,如图片、字体等。
  • src/: 项目源代码目录,包括所有页面组件、样式、工具函数等。
  • .dockerignore: 指定不被 Docker 存档的文件和目录。
  • .env.example: 提供项目需要的环境变量的示例。
  • .eslintrc.json: ESLint 配置文件,用于代码质量和风格检查。
  • .gitattributes: Git 属性文件,用于设置特定的 Git 行为。
  • .gitignore: 指定不被 Git 跟踪的文件和目录。
  • .yarnrc.yml: Yarn 配置文件,用于配置 Yarn 的行为。
  • Dockerfile: 用于构建 Docker 容器的指令文件。
  • LICENSE: 项目使用的许可证文件。
  • README.md: 项目说明文件,提供项目信息和说明。
  • bun.lockb: Bun 包管理器的锁文件。
  • docker-compose.yml: Docker Compose 配置文件,用于定义和运行多容器 Docker 应用。
  • next.config.js: Next.js 配置文件,用于定制 Next.js 的行为。
  • package-lock.json: 包版本锁定文件,用于确保安装的依赖版本一致。
  • package.json: 项目包文件,定义项目的依赖、脚本和元数据。
  • postcss.config.js: PostCSS 配置文件,用于处理 CSS。
  • tailwind.config.js: Tailwind CSS 配置文件,用于定制 Tailwind CSS 的行为。
  • tsconfig.json: TypeScript 配置文件,用于配置 TypeScript 编译选项。
  • yarn.lock: Yarn 包管理器的锁文件,确保依赖的稳定性。

2. 项目的启动文件介绍

Airin 项目的启动主要通过 package.json 中的脚本进行。

package.json 文件中,定义了以下脚本:

{
  "scripts": {
    "dev": "next dev",
    "build": "next build && next export",
    // 其他脚本...
  }
}
  • "dev" 脚本用于启动开发服务器。执行 next dev 命令将启动 Next.js 开发服务器,通常用于本地开发。
  • "build" 脚本用于构建项目。执行 next build 命令将构建项目,然后 next export 命令用于导出静态 HTML 文件。

要在本地启动项目,你可以运行以下命令:

npm run dev

或者在 Yarn 环境中:

yarn dev

这将启动开发服务器,并在浏览器中自动打开一个新标签页,地址通常是 http://localhost:3000

3. 项目的配置文件介绍

Airin 项目的配置主要通过以下几个文件进行:

  • .env.example: 提供了项目所需环境变量的示例。在本地开发或部署时,你需要根据实际情况创建一个 .env 文件,并填入相应的值。

以下是一些基本的环境变量:

REDIS_URL="get redis from upstash, litegix or aiven. They offer free tier."
GRAPHQL_ENDPOINT=https://graphql.anilist.co
ANILIST_CLIENT_ID="get your id from here https://anilist.co/settings/developer"
ANILIST_CLIENT_SECRET="get your secret from here https://anilist.co/settings/developer"
NEXTAUTH_SECRET='run this command in your terminal (openssl rand -base64 32)'
NEXTAUTH_URL="for development use http://localhost:3000/ and for production use your domain url"
NEXT_PUBLIC_PROXY_URI="Use a proxy if u wish, not mandatory"
ZORO_URI="host your own API from this repo https://github.com/ghoshRitesh12/aniwatch-api. Don't put / at the end of the url."
MONGODB_URI="Your Mongodb connection String"
  • next.config.js: Next.js 配置文件,用于定制 Next.js 的行为,如设置环境变量、启用或禁用某些功能等。

  • tailwind.config.js: Tailwind CSS 配置文件,用于定制 Tailwind CSS 的行为,如设置颜色、字体、组件等。

确保正确配置这些文件,以便项目能够正确运行。

登录后查看全文
热门项目推荐