UNPKG

3.81 kBMarkdownView Raw
1# @compas/insight
2
3[![install size insight](https://packagephobia.com/badge?p=@compas/insight)](https://packagephobia.com/result?p=@compas/insight)
4![lint-build-test](https://github.com/compasjs/compas/workflows/lint-build-test/badge.svg)
5
6Unified backend tooling
7
8---
9
10## Features
11
12- Minimal project boilerplate
13- Script runner, can watch & reload almost anything
14- Test and benchmark runner
15- Flexible code generators supporting routers, validators, api clients, CRUD
16 queries and more in the future.
17- Opinionated structured logging
18- Common Koa middleware wrapped in a single function
19- Various utilities like loading .env files, executing other processes and a
20 basic string templating system
21
22## Requirements
23
24- Node.js >= 14
25- Yarn 1.x.x
26
27## Why
28
29My work involved doing many small projects. I had a hard time backporting
30incremental fixes to existing projects. To facilitate my needs more and to stop
31copying and pasting things around, this project was born.
32
33## Features breakdown
34
35**@compas/cli**:
36
37- Run user scripts (in watch mode)
38- Run the linter
39- A Compas based boilerplate
40- Test runner
41- Benchmark runner
42- Necessary Docker container management
43- Visualise the known database structure of @compas/code-gen
44
45**@compas/lint-config**:
46
47- All necessary ESLint and Prettier dependencies
48- Default configuration for ESLint and Prettier
49
50**@compas/insight**:
51
52- A structured logger
53 - Writing newline delimited JSON in production
54 - Pretty printing for development
55- Various utilities to get insight in the running process
56- A manual event system
57
58**@compas/stdlib**:
59
60- Various lodash inspired utilities (isNil, isPlainObject, ...)
61- Wrappers for child_process execution and spawning
62- A `mainFn` wrapper that reads `.env` and calls the provided function if the
63 file is the process entrypoint
64- Replacements for CommonJS `__dirname` and `__filename`
65
66**@compas/server**:
67
68- Wrapper around Koa instance creation
69- 404 en error handling
70- Handle CORS
71- Send file helper
72- Session support with safe, browser readable cookies
73
74**@compas/store**:
75
76- Wrapper around the Minio S3 client
77- Wrapper around Postgres connection
78- Utilities for providing temporary databases in a test environment
79- Postgres migrations
80- Postgres and S3 combined for file storage
81- Caching files from S3 in memory or on local disk
82- Postgres powered queue implementation
83 - Supports priority, scheduling, multiple async workers and recurring jobs
84- koa-session compatible SessionStore backed by Postgres
85
86**@compas/code-gen**:
87
88- Code generators for the following:
89 - router, with wildcard and path parameter support
90 - validators, pure JavaScript implementation
91 - sql, CRUD Postgres queries and nested result support
92 - Axios based api client
93 - TypeScript or JSDoc types
94 - react-query hooks
95- An extendable set of types:
96 - boolean, number, string;
97 - object, array, any;
98 - date, uuid;
99 - generic, anyOf, reference;
100- Remote structure loader
101- OpenAPI to Compas structure converter
102
103## Docs and development
104
105See [the website](https://compasjs.com) for the changelog, all available APIs
106and various guides.
107
108For contributing see [contributing.md](https://compasjs.com/contributing.html).
109
110## New features
111
112New features added should fall under the following categories:
113
114- It improves the interface between api and client in some way. An example may
115 be to support websockets in @compas/code-gen
116- It improves the developer experience one way or another while developing an
117 api For example the `compas docker` commands or various utilities provided by
118 @compas/stdlib
119
120Although some parts heavily rely on conventions set by the packages, we
121currently aim not to be a framework. We aim to provide a good developer
122experience, useful abstractions around the basics, and a stable backend <->
123client interface.