This is a tinacms self-host project base on next.js. It supports local media manager, document search and some git provider (local, gitlab and github).
We have 3 environment in this project:
- local: env for developer
- ssr: env for content editor
- ssg: static export for deploy
First, run the development server:
npm i
npm run devOpen http://localhost:3000 with your browser to see the result. open http://localhost:3000/admin/index.html#/graphql for graphql debug.
cp .env.example .env
# Change NEXTAUTH_SECRET in .env file
# deploy with docker
docker-compose up -d
# deploy without docker
npm i
npm run build:ssr
npm run startOpen http://localhost:3080/admin/index.html with your browser to edit content.
SSG( Static Site Generator ) is feature of Next.js. Follow the steps below to create:
- Merge latest
GIT_COMMIT_BRANCHbranch intomainbranch - Run
cp .env.example .envif.envfile not exist in project. Remember to changeNEXTAUTH_SECRETin .env file - Run
npm run build:ssgand you will getoutfolder which include static file
The variables take effect only when SSR or SSG.
| Variable | Default | Description |
|---|---|---|
| GIT_COMMIT_BRANCH | tina |
The branch for cms commit |
| GIT_COMMIT_MESSAGE | content: Edited with TinaCMS |
Commit message whe cms commit |
| GIT_TYPE | local |
Required, local, gitlab or github |
| GIT_LOCAL_COMMITTER_NAME | Required, when GIT_TYPE=local |
|
| GIT_LOCAL_COMMITTER_EMAIL | Required, when GIT_TYPE=local |
|
| GITLAB_HOST | Required, when GIT_TYPE=gitlab |
|
| GITLAB_PROJECT_ID | Required, when GIT_TYPE=gitlab |
|
| GITLAB_PERSONAL_ACCESS_TOKEN | Required, when GIT_TYPE=gitlab |
|
| GITHUB_OWNER | Required, when GIT_TYPE=github |
|
| GITHUB_REPO | Required, when GIT_TYPE=github |
|
| GITHUB_PERSONAL_ACCESS_TOKEN | Required, when GIT_TYPE=github |
|
| DATABASE_TYPE | sqlite |
Required, sqlite, mongodb or redis |
| SQLITE_DB_PATH | sqliteDB/tinacms.db |
Optional |
| MONGODB_URI | Required when DATABASE_TYPE=mongodb |
|
| MONGODB_COLLECTION_NAME | tinacms |
Optional when DATABASE_TYPE=mongodb |
| MONGODB_DB_NAME | tinacms |
Optional when DATABASE_TYPE=mongodb |
| REDIS_URL | Required when DATABASE_TYPE=redis |
|
| REDIS_NAMESPACE | tinacms |
Optional when DATABASE_TYPE=redis |
| REDIS_DEBUG | false |
Optional |
| TINA_PUBLIC_MEDIA_TYPE | localMedia |
Required, localMedia or cloudinary |
| CLOUDINARY_URL | Required when TINA_PUBLIC_MEDIA_TYPE=cloudinary, format: cloudinary://<API_KEY>:<API_SECRET>@<CLOUD_NAME> |
|
| NEXTAUTH_SECRET | Required,secret for tinacms-auth |
Try to rebuild better_sqlite3 and copy it to project directory. You can run npm run postinstall manually.