Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:25:40 +08:00
commit 69df674920
25 changed files with 4327 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
# TinaCloud Credentials
# Get these from https://app.tina.io after creating a project
# Client ID (public, safe to expose)
NEXT_PUBLIC_TINA_CLIENT_ID=your_client_id_here
# Read-only token (keep secret, never commit)
TINA_TOKEN=your_read_only_token_here
# Git branch (auto-detected on Vercel/Netlify, set manually for local dev)
# GITHUB_BRANCH=main
# For self-hosted backend with Auth.js
# NEXTAUTH_SECRET=generate_a_secret_key_here
# TINA_PUBLIC_IS_LOCAL=false
# For self-hosted with OAuth providers (example: Discord)
# DISCORD_CLIENT_ID=your_discord_client_id
# DISCORD_CLIENT_SECRET=your_discord_client_secret

View File

@@ -0,0 +1,24 @@
{
"name": "nextjs-tinacms-app",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "tinacms dev -c \"next dev\"",
"build": "tinacms build && next build",
"start": "tinacms build && next start",
"lint": "next lint"
},
"dependencies": {
"next": "^16.0.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tinacms": "^2.9.0"
},
"devDependencies": {
"@tinacms/cli": "^1.11.0",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"typescript": "^5"
}
}

View File

@@ -0,0 +1,88 @@
import { defineConfig } from 'tinacms'
import { blogPostCollection } from './collections/blog-post'
import { docPageCollection } from './collections/doc-page'
import { authorCollection } from './collections/author'
/**
* TinaCMS Configuration for Next.js App Router
*
* This config file:
* - Sets up TinaCloud connection (or self-hosted)
* - Defines content collections and their schemas
* - Configures media handling
* - Sets up build output
*
* Usage:
* 1. Copy this file to: tina/config.ts
* 2. Copy collection files to: tina/collections/
* 3. Set environment variables in .env.local
* 4. Run: npm run dev
* 5. Access admin: http://localhost:3000/admin/index.html
*/
// Get Git branch from environment
const branch =
process.env.GITHUB_BRANCH ||
process.env.VERCEL_GIT_COMMIT_REF ||
process.env.HEAD ||
'main'
export default defineConfig({
// Git branch to use
branch,
// TinaCloud credentials (get from https://app.tina.io)
clientId: process.env.NEXT_PUBLIC_TINA_CLIENT_ID,
token: process.env.TINA_TOKEN,
// Build configuration
build: {
outputFolder: 'admin', // Where admin UI is built
publicFolder: 'public', // Your public assets folder
},
// Media configuration
media: {
tina: {
mediaRoot: 'uploads', // Subfolder for uploads
publicFolder: 'public', // Where files are stored
},
},
// Content schema
schema: {
collections: [
// Import your collections here
blogPostCollection,
authorCollection,
docPageCollection,
// Or define collections inline:
// {
// name: 'post',
// label: 'Blog Posts',
// path: 'content/posts',
// format: 'mdx',
// fields: [
// {
// type: 'string',
// name: 'title',
// label: 'Title',
// isTitle: true,
// required: true,
// },
// {
// type: 'rich-text',
// name: 'body',
// label: 'Body',
// isBody: true,
// },
// ],
// },
],
},
// Optional: Self-hosted backend configuration
// Uncomment if using self-hosted backend
// contentApiUrlOverride: '/api/tina/gql',
})

View File

@@ -0,0 +1,64 @@
import { defineConfig } from 'tinacms'
import { blogPostCollection } from './collections/blog-post'
import { docPageCollection } from './collections/doc-page'
import { authorCollection } from './collections/author'
/**
* TinaCMS Configuration for Next.js Pages Router
*
* This config file works with Next.js 12 and Pages Router setup.
*
* Differences from App Router:
* - Admin route: pages/admin/[[...index]].tsx (not app/)
* - Data fetching: getStaticProps + getStaticPaths
* - Client hook: useTina for visual editing
*
* Usage:
* 1. Copy this file to: tina/config.ts
* 2. Copy collection files to: tina/collections/
* 3. Set environment variables in .env.local
* 4. Run: npm run dev
* 5. Access admin: http://localhost:3000/admin/index.html
*/
// Get Git branch from environment
const branch =
process.env.GITHUB_BRANCH ||
process.env.VERCEL_GIT_COMMIT_REF ||
process.env.HEAD ||
'main'
export default defineConfig({
// Git branch to use
branch,
// TinaCloud credentials (get from https://app.tina.io)
clientId: process.env.NEXT_PUBLIC_TINA_CLIENT_ID,
token: process.env.TINA_TOKEN,
// Build configuration
build: {
outputFolder: 'admin',
publicFolder: 'public',
},
// Media configuration
media: {
tina: {
mediaRoot: 'uploads',
publicFolder: 'public',
},
},
// Content schema
schema: {
collections: [
blogPostCollection,
authorCollection,
docPageCollection,
],
},
// Optional: Self-hosted backend configuration
// contentApiUrlOverride: '/api/tina/gql',
})