1.0.246 • Published 1 day ago

microvolt-lib v1.0.246

Weekly downloads
-
License
MIT
Repository
github
Last release
1 day ago

microvolt-lib

NPM library for MicroVolt webservice architecture

Building web applications can be hard. No longer can an application survive in creating a monolithe to perform everything. They are not suited for quick development, expanding features easily and for multiple teams to easily collaborate and test on a single code base. Additionally, every web application require very similar basic functionality, including, but not limited to: database, database schema evolution, web requests, intra-service communication, cache, session management (register, login, tokens, SSO, etc.). To higher level services that are found common in web applications, including: Email, SMS, reporting, activity, in/outjest from/to external services, e-commerce and more.

The concept is to have a common set of capabilities that work out of the box and that can be easily extended to meeting the business needs of the web application.

This is a project to create a microservice framework based on Node.js. It is currently being tested on Google Cloud but other hosting environments are planned.

The code base is entirely TypeScript. No Kubernetes required.

Status:

Complete: 1. Base microservice class 2. Sample microservice 3. Database and query abstraction for Postgres 4. Dynamic database table setup and seeding 5. Session microservice implementation (register, login, auth)

In Work: 1. Hub microservice implementation 2. Web service implementation 3. Actions/events registration and notification 4. Email microservice implementation

Planned: 1. Data cache layer 2. AI microservice implementation 3. Activity microservice implementation 4. Database abstraction for MySQL 5. Database abstraction for NoSQL (e.g. MongoDB) 6. ZIMM implementation

Goals:

  1. Object Oriented Typescript with good design patterns
  2. Ease of adding new services
  3. Fast horizontal scaling
  4. Easy deployment and versioning

It shall include:

  1. Easy to create new sertvices
  2. Includes "hub" service to manage:
    1. Service registration and lifecycle
    2. Service configuration
    3. Events/actions between services
    4. Service discovery
  3. Includes "webserver" to host static files and act as a gatway
  4. The hosting environment(s) selected will manage horizontal scaling of services
  5. Other canned services shall included
    1. Session management (login, registration, authentication, throttle limits)
    2. ETL to reporting database
    3. Activity Service
    4. Email Service
    5. Input/Output (web hook) Service
    6. File/CDN Service
    7. Report Service
    8. Import Service
    9. Zapier Service
    10. Commerce Service (cart, multi-currency, payment, zipcode/address verification; factory:stripe)
    11. SMS service (factory: twilio)
    12. Product Service
    13. Order Service
    14. Customer Service

Notes:

Google Deployment Notes: 1. For each project this is being deployed to, you will need to: 1. Add IAM Role to include Secrets Manager + Secrets Accessor or you will not be able to access saved secrets in the app. You will get a permissions denied even though the project has Edit access to do everything.

CONFIGURATION:

=================== For configurations that contains sensitive information (e.g. passwords) should never be stored in code (hard coded) or in coniguration files that would get checked-in to GIT. This is a major security violation.

Configuration variables being used for secrets or environment variables are case sensitive and should only include letters and underscoress (_). Google Cloud does not allow periods (.) and environment variables do not allow for hypans (-). This will be enforced to avoid needless errors in the different environments.

In Google Cloud, those kinds of configuration variables shold be stored in the Secrets Manager. In the service configuration file, you may set:

"secrets" : { "root" : "projects/<PROJECTID>/secrets" }

Where <PROJECTID> is the project id for the project of the app engine. Each environment (e.g. development, staging, product) have unique projects so each environment will have a unique configuration file (e.g. local.json, development.json, production.json).

In the configuration file, all will need to do is set that variable to indicate that it is a secret. For example:

"database" : { "host" : "secret:hub_db_host/versions/latest", "port" : "secret:hub_db_port/versions/latest", "name" : "hub", "username" : "secret:hub_db_username/versions/latest", "password" : "secret:hub_db_password/versions/latest" }

Anything prefiexed by "secret:" will assume that it is to be accessed in the Secrets Manager. Note for Google, you can have different versions of the variable to not to break currently deployed versions of your microservce.

For Local developent, you can store sensitive information as an environment variable. So a local.json file may look like:

"database" : { "host" : "env:hub_db_host", "port" : "env:hub_db_port", "name" : "hub", "username" : "env:hub_db_username", "password" : "env:hub_db_password" }

The prefix of "env:" will look for the locally set environment variable.

For Windows, you can set the environment varialbe(s) from the Windows GUI or from the terminal prompt by:

$env:hub_db_password = 'passwsord1'

To verify that it is set:

dir env:hub_db_password

Unless set locally, you may need to restart your Windows computer to see the environment variables.

This is a work in progress...

1.0.241

1 day ago

1.0.244

1 day ago

1.0.243

1 day ago

1.0.240

1 day ago

1.0.246

1 day ago

1.0.245

1 day ago

1.0.239

1 day ago

1.0.238

1 day ago

1.0.235

1 day ago

1.0.234

1 day ago

1.0.237

1 day ago

1.0.236

1 day ago

1.0.229

2 days ago

1.0.231

2 days ago

1.0.230

2 days ago

1.0.233

2 days ago

1.0.232

2 days ago

1.0.228

3 days ago

1.0.227

3 days ago

1.0.226

4 days ago

1.0.225

5 days ago

1.0.220

5 days ago

1.0.222

5 days ago

1.0.221

5 days ago

1.0.224

5 days ago

1.0.223

5 days ago

1.0.217

6 days ago

1.0.216

6 days ago

1.0.219

6 days ago

1.0.218

6 days ago

1.0.215

6 days ago

1.0.213

7 days ago

1.0.214

7 days ago

1.0.200

9 days ago

1.0.206

8 days ago

1.0.205

8 days ago

1.0.208

8 days ago

1.0.207

8 days ago

1.0.202

9 days ago

1.0.201

9 days ago

1.0.204

9 days ago

1.0.203

9 days ago

1.0.198

9 days ago

1.0.197

9 days ago

1.0.194

9 days ago

1.0.193

9 days ago

1.0.196

9 days ago

1.0.195

9 days ago

1.0.192

9 days ago

1.0.191

9 days ago

1.0.211

8 days ago

1.0.210

8 days ago

1.0.212

7 days ago

1.0.190

10 days ago

1.0.187

12 days ago

1.0.186

12 days ago

1.0.189

12 days ago

1.0.188

12 days ago

1.0.183

19 days ago

1.0.185

18 days ago

1.0.184

19 days ago

1.0.182

20 days ago

1.0.181

21 days ago

1.0.180

21 days ago

1.0.179

23 days ago

1.0.178

24 days ago

1.0.176

26 days ago

1.0.175

26 days ago

1.0.177

26 days ago

1.0.174

26 days ago

1.0.173

26 days ago

1.0.172

1 month ago

1.0.171

1 month ago

1.0.165

1 month ago

1.0.167

1 month ago

1.0.166

1 month ago

1.0.169

1 month ago

1.0.168

1 month ago

1.0.170

1 month ago

1.0.164

1 month ago

1.0.163

1 month ago

1.0.161

1 month ago

1.0.162

1 month ago

1.0.160

1 month ago

1.0.158

1 month ago

1.0.154

2 months ago

1.0.156

2 months ago

1.0.155

2 months ago

1.0.157

2 months ago

1.0.153

2 months ago

1.0.152

2 months ago

1.0.151

2 months ago

1.0.149

2 months ago

1.0.148

2 months ago

1.0.150

2 months ago

1.0.143

2 months ago

1.0.145

2 months ago

1.0.144

2 months ago

1.0.147

2 months ago

1.0.146

2 months ago

1.0.142

2 months ago

1.0.141

2 months ago

1.0.140

2 months ago

1.0.139

2 months ago

1.0.138

2 months ago

1.0.137

2 months ago

1.0.134

2 months ago

1.0.136

2 months ago

1.0.135

2 months ago

1.0.132

2 months ago

1.0.131

2 months ago

1.0.133

2 months ago

1.0.130

2 months ago

1.0.129

2 months ago

1.0.128

2 months ago

1.0.127

2 months ago

1.0.124

2 months ago

1.0.126

2 months ago

1.0.123

2 months ago

1.0.122

2 months ago

1.0.121

2 months ago

1.0.120

2 months ago

1.0.118

2 months ago

1.0.117

2 months ago

1.0.119

2 months ago

1.0.116

2 months ago

1.0.115

2 months ago

1.0.114

3 months ago

1.0.113

3 months ago

1.0.112

3 months ago

1.0.110

3 months ago

1.0.111

3 months ago

1.0.109

3 months ago

1.0.107

3 months ago

1.0.108

3 months ago

1.0.106

3 months ago

1.0.105

3 months ago

1.0.103

3 months ago

1.0.102

3 months ago

1.0.104

3 months ago

1.0.101

3 months ago

1.0.100

3 months ago

1.0.95

3 months ago

1.0.94

3 months ago

1.0.99

3 months ago

1.0.98

3 months ago

1.0.97

3 months ago

1.0.96

3 months ago

1.0.93

3 months ago

1.0.91

3 months ago

1.0.92

3 months ago

1.0.77

3 months ago

1.0.76

3 months ago

1.0.75

3 months ago

1.0.74

4 months ago

1.0.79

3 months ago

1.0.78

3 months ago

1.0.80

3 months ago

1.0.84

3 months ago

1.0.83

3 months ago

1.0.82

3 months ago

1.0.81

3 months ago

1.0.88

3 months ago

1.0.87

3 months ago

1.0.86

3 months ago

1.0.85

3 months ago

1.0.89

3 months ago

1.0.90

3 months ago

1.0.73

4 months ago

1.0.72

4 months ago

1.0.71

4 months ago

1.0.62

4 months ago

1.0.61

4 months ago

1.0.60

4 months ago

1.0.66

4 months ago

1.0.65

4 months ago

1.0.64

4 months ago

1.0.63

4 months ago

1.0.69

4 months ago

1.0.68

4 months ago

1.0.67

4 months ago

1.0.70

4 months ago

1.0.59

4 months ago

1.0.58

4 months ago

1.0.55

4 months ago

1.0.56

4 months ago

1.0.54

4 months ago

1.0.51

4 months ago

1.0.53

4 months ago

1.0.52

4 months ago

1.0.39

4 months ago

1.0.38

4 months ago

1.0.40

4 months ago

1.0.44

4 months ago

1.0.43

4 months ago

1.0.42

4 months ago

1.0.41

4 months ago

1.0.48

4 months ago

1.0.47

4 months ago

1.0.46

4 months ago

1.0.45

4 months ago

1.0.49

4 months ago

1.0.50

4 months ago

1.0.29

4 months ago

1.0.33

4 months ago

1.0.32

4 months ago

1.0.31

4 months ago

1.0.30

4 months ago

1.0.37

4 months ago

1.0.36

4 months ago

1.0.35

4 months ago

1.0.34

4 months ago

1.0.26

4 months ago

1.0.28

4 months ago

1.0.27

4 months ago

1.0.25

4 months ago

1.0.24

4 months ago

1.0.23

4 months ago

1.0.22

4 months ago

1.0.19

5 months ago

1.0.21

4 months ago

1.0.20

5 months ago

1.0.18

5 months ago

1.0.17

5 months ago

1.0.16

5 months ago

1.0.11

5 months ago

1.0.15

5 months ago

1.0.14

5 months ago

1.0.13

5 months ago

1.0.12

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.10

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago