Hello r/golang,
This is an update post on Frizzante, we’ve recently released v1.45.
For those who don’t know, Frizzante is an opinionated web server framework written in Go that uses Svelte to render web pages, it supports both SSR and CSR.
Our most recent update, v1.45, includes bug fixes, more tests, quality of life additions and most importantly new cli features.
It’s been a while since our last update, so this post will span more than one version.
For that reason I won’t cover everything in this post. For more details you can check the release posts and the full change logs [here](https://github….
Hello r/golang,
This is an update post on Frizzante, we’ve recently released v1.45.
For those who don’t know, Frizzante is an opinionated web server framework written in Go that uses Svelte to render web pages, it supports both SSR and CSR.
Our most recent update, v1.45, includes bug fixes, more tests, quality of life additions and most importantly new cli features.
It’s been a while since our last update, so this post will span more than one version.
For that reason I won’t cover everything in this post. For more details you can check the release posts and the full change logs here.
Types Generation
You can now generate .d.ts files from your go structs.
frizzante -gtypes
This feature is not dependent on your route handlers signature.
From the beginning we’ve made the decision that route handlers should not dictate the shape of the request and response bodies statically because that would require the framework to hide behavior and “automagically” interpret things in, some would say, unexpected ways.
Types generation is instead achieved simply by calling types.Generate[T]() in your application.
You can read more about types generation here.
Note that when building for production, types.Generate[T]() becomes a noop and vanishes from your code.
Migrations
You can now generate and execute migrations.
frizzante -gmigration
We had already introduced a SQL solution using SQLC, but we were still missing a way to bootstrap and update the actual database schema.
When generating the database library with frizzante -gdatabase, you will be prompted to also create your first migration file.
If you refuse, you can use frizzante -gmigration to create your migration at a later time.
The first migration you create will simply copy your schema.sql file, subsequent migrations will create a template file at lib/sqlite/databases/migrations/(current date and time).sql.
Migations can be executed directly inline with
frizzante --migrate="<start migration>,<end migration>"
The end migration is optional.
The cli will detect the order of the migrations based on their name.
If the start migration (left side of the comma) is older than the end migration (right side of the comma), then it will execute the “up” sections of the migration files, otherwise if the start migrations is newer than the end migration, the cli will execute the “down” sections of the migration files.
This allows you to rollback database updates as long as you properly define your “up” and “down” migration sections, which are identified with -- migration: down and -- migration: up.
-- migration: down
drop table if exists user;
-- migration: up
create table user(
id varchar(36) primary key
);
Migrations as a whole require more work and polishing, for example the migration system does not have a state and thus it cannot automatically apply the correct migrations, you must always specify which migrations to apply.
Note that migration execution is currently supported only for SQLite, other implementations will come in the future, including executing migrations remotely.
Lock Packages
You can now forcefully lock your javascript packages.
frizzante --lock-packages
This will remove all modifiers from your versions in your package.json.
In light of recent incidents in the NPM community, this is a feature some teams might like to adopt as an additional measure of precaution on top of the usuale package manager lock file.
Assembly Explorer
You can now interactively explore the assembly output of your program using frizzante --assembly-explorer.
This helps you inspect which function is being inlined rather than called and understand how much instruction data some function is generating.
It can be useful to attempt improving cpu caching. It’s also a good resource for learning.
The whole assembly code is currently dumped in a .gen/bin/app.s file in your project.
Qjs
We’re also adding experimental support for qjs.
This can be enabled with the experimental_qjs_runtime build tag.
frizzante --build --tags="experimental_qjs_runtime"
Final Notes
For more details on the project see our documentation and the source code.
I don’t use reddit for instant messaging, so please don’t contact me here. If you want to keep in touch with us, you can come hang out on discord or send me an email.
Finally, if you like the project give it a try, give us some feedback.
Thank you for your time!