kaiyuanshe / KYS-service

https://service.kaiyuanshe.cn/docs/
4 stars 1 forks source link

KaiYuanShe service

RESTful API service of KaiYuanShe

Deploy to Production environment

Technology stack

  1. HTTP server: Koa
  2. Controller framework: Routing Controllers
  3. Model framework: Class Transformer & Class Validator
  4. ORM framework: TypeORM
  5. API document: Swagger
  6. Mock API: OpenAPI backend

API Usage

Production environment

Type package

Sign in GitHub packages with NPM

  1. Generate a PAT with read:packages authorization
  2. Run Sign-in command in your terminal, and use PAT as password:
npm login --scope=@kaiyuanshe --registry=https://npm.pkg.github.com

Installation

npm i pnpm -g

pnpm i @kaiyuanshe/kys-service -D

Environment variables

Name Usage
DATABASE_URL PostgreSQL connection string
AZURE_BLOB_CONNECTION Azure Blob Storage service
WEB_HOOK_TOKEN Authorization token of Custom Web hooks
AUTHING_APP_SECRET encrypt Password & Token
LARK_APP_ID App ID of Lark API
LARK_APP_SECRET App Secret of Lark API

Development

Installation

npm i pnpm -g
pnpm i

Start Development environment

pnpm dev

or just press F5 key in VS Code.

Migration

pnpm upgrade:dev

Deployment

Start Production environment

npm start

Migration

pnpm upgrade:pro

Docker

pnpm pack-image
pnpm container

Releasing

Deploy Application

git checkout master
git tag v0.6.0  # this version tag comes from ./package.json
git push origin master --tags

Publish Type Package

git checkout master
git tag type-v0.6.0  # this version tag comes from ./type/package.json
git push origin master --tags