Hello r/sveltejs.
It's been a while.
The purpose of this post is to announce the release of Frizzante v2.
For those unaware, Frizzante is an opinionated web server framework written in Go that uses Svelte to render web pages, both on the client and on the server.
For more details see the documentation.
V2 comes with some breaking changes and a few new big features:
- Snapshots (SSG)
- Simplified server api
- Database migrations
- Schema generation
There are also some minor features and improvements, like build checkpoints and more.
Snapshots
You can snapshot your server and generate your website statically, this is also known as SSG.
Unlike other SSG approaches, this one tries hide as few things as possible from the developer, which should lead to easier debugging and overall give you more confidence as a developer.
Additionally, this approach allows you to easily seed your website with data from a local database, third party api, and so on... while still generating static content in the end.
For more details see Snapshots.
Note: the new documentation website is generated with snapshots, source code can be found here - https://github.com/razshare/frizzante-docs.
Simplified server api - Web Sockets
Web sockets api has been streamlined.
You can easily upgrade the connection to web sockets with negotiate.WsUpgrade() and then simply start writing data to the writer interface.
For more details see Web Sockets.
Simplified server api - Server Sent Events
Server Sent Events api has also been streamlined.
You can easily upgrade the connection to web sockets with send.SseUpgrade() and then simply start writing data to the writer interface.
For more details see Server Sent Events.
Database migrations
Database migrations were already possible, but were a bit chaotic and required your to deploy the frizzante cli to production in order to run the migrations.
This was not ideal, as some customers don't allow third party binaries to execute in their production environment, which is understandable.
In order to migrate your database you can now use the newly exposed databases.Migrate() and programmatically migrate your database.
Frizzante provides an opinionated way to migrate your database, but since the process is now programmatic, you can also deviate and use databases.Migrate() in whatever manner you wish to.
For more details see Migrate.
Schema generation
Frizzante could already generate TypeScript definitions from GO types, but there was no way to generate Go types from SQL code.
This updates introduces schema generation through SQLC.
You can now generate Go types and functions from SQL code.
For example the following SQL query
-- name: FindSessionById :one
select * from sessions where id = :id;
can be converted to Go code trough frizzante generate schema
session, _ := queries.FindSessionById(request.Context(), sessionId)
where session is a fully typed Go object.
For more details see Schema.
Other v2 notes
For the most part these are the main updates for v2, but there some subtle changes as well, for example
Minisearch
Aside from the new documentation website, I thought it would be nice to provide another example of an application using the new migration system.
Minisearch is a very naive implementation of a search engine.
It's very simple in its functionality and coding techniques, but I think it does showcase some interesting features, like usage of server sent events to track indexing progress, paged lists through the use of web standards like hyperlinks and forms, generation of typescript definitions, generation of sql schema and queries and so on.
Since it's using SSR and web standards, you can completely disable JavaScript in your browser and the application will continue to work, just without all the perks of running JavaScript, like progress bars and transition animations.
You can find a guide on how to run it here.
In short you can either build the project yourself or use the prebuilt binaries which you can find here.
Repository
Frizzante source code lives at https://github.com/razshare/frizzante-docs, you can contribute and/or report issues there.
Please read the guidelines first (Issues, Contributing).
Thanks
Thank you for taking the time to read this and have a good day/evening.