compasjs / compas

Unified backend tooling
https://compasjs.com
MIT License
12 stars 8 forks source link

Compas framework #2774

Closed dirkdev98 closed 5 months ago

dirkdev98 commented 1 year ago

Tracking issue to make a Compas framework. For the why and how, check out https://github.com/compasjs/compas/issues/2774#issuecomment-1666451372

dirkdev98 commented 1 year ago

Why

The time has come, we are going full steam ahead in to framework mode. Starting a new Compas project from scratch currently involves a lot of boilerplate. Looking at the with-auth template, 7 folders and many more files just to run code generation, an api, a queue worker and of course tests. Most of it is just wiring things up in one of the few ways possible. We can do that automatically as well.

What

What if you could just run compas in your terminal and get all manual labor done automatically. It will do the correct thing for libraries, backends and even in frontend projects. Managing the required docker containers. Automatically generating, without busting lint and build caches. Keeping track of which order of tests fail when running compas test --randomize-rounds 3 so you can debug that flaky situation.

How

Not every backend is the same of course. Some require a different Postgres version. Others connect to external api's and would prefer to use code-gen compatible with OpenAPI specs. And we understand that you don't want to rewrite your existing backends to folder based routing. This means that we are slowly going move things in to the compas package and keep a lot of things configurable with sensible defaults.

The first change in this direction has already been started. We are going to purpose the compas package for the new CLI. It will contain a new (temporary) CLI called zakmes, which will directly showcase the new terminal user interface (TUI) of the dev server. We will slowly expand its functionality, either by using the existing CLI or taking over it's functionality.

A peek ahead

We are aiming for the following behaviour...

... in development


> compas

Loaded config...
Generating...
Launching prerequisites...
Starting watcher...
Waiting on syntax error in `src/foo/bar.js`...
Files are waiting to be linted...

# Input: L

Running the linter for 5 files...
All files are up-to-date.

... in CI

> compas

Loaded config...
Generating...
Launching prerequisites...
Running linter...
Running tets...

Done!

... in production


> compas prod

Loaded config...
Generating...
Starting api...
Starting queue...

# Or

> compas prod api

Loaded config...
Generating...
Starting api...

Conclusion

The road up ahead is exciting! There will be some bumps and breaking changes for sure. But the result should be faster, better integrated and most importantly more stable to build on.