https://github.com/jovijovi/pedro.js
Pedro.js is a microservice toolkit written in TypeScript.
Go home early from work, spend more time with family and friends, enjoy your life.
-
HTTP/HTTPS 1.1
-
Based on express
-
Task Handler
-
API authorization based on 2FA
-
Health check
Get health and version info
-
Metrics check
Get simple metrics info
-
RequestId
-
-
-
JSON-RPC
-
WebSocket
-
Heartbeat
Based on ws
-
-
Cache
-
Memory Cache Set
Based on lru-cache
-
-
Message Queue
- AWS SQS
-
Database Helper
-
Dgraph
- HTTP client helper
-
LevelDB
-
MongoDB
- Based on Mongoose
-
MySQL
-
PostgreSQL
-
Redis
- Based on Node Redis
-
SQLite
-
-
Logger
-
Asynchronous logging
-
Advanced logger
-
-
Certificate
-
Configuration
- Custom config items
-
Security Suite
-
Crypto
-
Sign/Verify message by ECDSA
-
Encrypt/Decrypt message by AES
-
Get the digest by specified hash function
-
Get fingerprint by specified algorithm
-
Generate random salt
-
Encrypt/Verify password by pbkdf2
-
-
-
System
- System signals handler
-
Utilities
-
Converter
-
Stream to Buffer
-
Stream to String
-
-
File
- Read dedupe line from file to map
-
NanoID
-
Queue
- A queue (FIFO), not async safe
-
Random
- Random int
- Random boolean
- Random case
- Random seed
-
Retry
- Retry running the function m times with n seconds interval
-
Stack
- A stack (LIFO), not async safe
-
Time
-
UUID
-
-
Simple Event
-
Sign/Verify signature
-
Marshal/Unmarshal
-
-
Expend Types
-
FSM
- Simple FSM (sync)
-
Object Storage
- S3 Client helper
-
Auditor
- Simple assert
-
Tracing
- Based on OpenTelemetry
-
Context
- Context chain (parent/child)
-
Options
- An easy-to-use options
-
IPFS
- IPFS helper based on ipfs-http-client
Node version manager nvm
will helpful.
- node
v18.12.1
- yarn
v1.22.19
- ts-node
v10.9.1
- typescript
4.9.3
-
Install dependency
yarn
-
Build
yarn build
-
Run
yarn dist-run --config ./conf/app.config.yaml
-
Clean
yarn clean
- Build
make build
- Make docker images
make docker
- Step 1: install packages
yarn add --dev jest typescript ts-jest @types/jest
- Step 2: Init ts-jest config
yarn ts-jest config:init
- Step 3: Config package.json
Add below to package.json
"scripts": {
"test": "jest"
},
- Step 4: Run test
yarn test
- Step 5: You will get response like this
yarn run v1.22.18
$ jest
PASS test/common/common.log.test.ts
● Console
console.log
logger closed
at test/common/common.log.test.ts:39:11
......
Test Suites: 39 passed, 39 total
Tests: 104 passed, 104 total
Snapshots: 0 total
Time: 25.455 s, estimated 30 s
Ran all test suites.
Done in 26.21s.
-
Documents
-
Task Handler
-
Support CORS by config
-
Real remote IP
-
-
WebSocket
-
GRPC
-
TLS
- Mutual TLS
-
Message Queue
-
RabbitMQ
-
Aliyun MNS
-
NSQ
-
-
Database Helper
- Elasticsearch
-
Certificate
-
Service Discovery
-
Security Suite
-
Crypto
-
Encrypt/Decrypt message by RSA
-
Encrypt/Decrypt message by SM4
-
-
Simple dongle
-
Desensitization
- Desensitize by rules
-
-
Utilities
-
Execute command
-
Path
-
Smart String
-
-
Job Scheduler
-
Workflow-based job scheduler
-
Storage adapter
-
-
Distributed Lock
- etcd
-
Object Storage
-
OSS Helper
-
S3 Helper
-