Pedro.js
https://github.com/jovijovi/pedro.js
Pedro.js is a microservice toolkit written in TypeScript.
Philosophy
Go home early from work, spend more time with family and friends, enjoy your life.
Features
-
HTTP/HTTPS 1.1
-
JSON-RPC
-
WebSocket
-
Cache
-
Message Queue
-
Database Helper
-
Dgraph
-
LevelDB
-
MongoDB
-
MySQL
-
PostgreSQL
-
Redis
-
SQLite
-
Logger
-
Asynchronous logging
-
Advanced logger
-
Certificate
-
Configuration
-
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
-
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
-
Object Storage
-
Auditor
-
Tracing
-
Context
- Context chain (parent/child)
-
Options
-
IPFS
Development
Env
Node version manager nvm
will helpful.
- node
v18.12.1
- yarn
v1.22.19
- ts-node
v10.9.1
- typescript
4.9.3
Quick Guide
Makefile
make build
make docker
UnitTest with ts-jest
Install ts-jest
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"
},
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.
Roadmap
-
Documents
-
Task Handler
-
Support CORS by config
-
Real remote IP
-
WebSocket
-
GRPC
-
TLS
-
Message Queue
-
Database Helper
-
Certificate
-
Service Discovery
-
Security Suite
-
Crypto
-
Simple dongle
-
Desensitization
-
Utilities
-
Execute command
-
Path
-
Smart String
-
Job Scheduler
-
Distributed Lock
-
Object Storage
Contributors
jovijovi
License
MIT