Skip to content

kaiyuanshe/KYS-service

Repository files navigation

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
APP_SECRET encrypt Password & Token
WEB_HOOK_TOKEN Authorization token of Custom Web hooks
AZURE_BLOB_CONNECTION Azure Blob Storage service
LEANCLOUD_API_HOST API domain of LeanCloud
LEANCLOUD_APP_ID App ID of LeanCloud
LEANCLOUD_APP_KEY App Key of LeanCloud
LARK_APP_ID App ID of Lark API
LARK_APP_SECRET App Secret of Lark API
HR_BASE_ID BI Table ID of HR data in Lark
PERSON_TABLE_ID BI Data Table ID of Person data in Lark

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 v1.0.0  # this version tag comes from ./package.json
git push origin master --tags

Publish Type Package

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