FAQ
- What is Project Forge?
- What modules are available?
- What CLI commands are available?
- What actions are available for my project from the UI?
- What build options are available?
- What git actions are available?
- How do I make a new HTTP action?
- What is provided in the TypeScript application?
- How do I use custom modules?
- How do I manage more than one Project Forge project at once?
- How are static assets served?
- How do I work with SVG icons?
- What’s this PF_SECTION crap?
- What administrative functions are available?
- How can I secure my application?
- What options are available for the HTML menu and breadcrumbs?
- What search facilities are available?
- What utility methods are available for my app?
- How do I add a new model to the “export” facilities?
What is Project Forge?
Project Forge helps you build and maintain feature-rich applications written in the Go programming language.
It’s a code-generation platform that uses modules, which are self-contained features for your app. All managed projects expose a web and CLI interface, and additional modules are available for everything from OAuth to database access.
What modules are available?
android
: Webview-based application and Android buildaudit
: Audit framework for tracking changes in the systembrands
: Provides thousands of SVG icons fromsimple-icons
for representing common logoscore
: Common utilities for a Go applicationdatabase
: API for accessing relational databasesdatabaseui
: UI for registered databases, allows auditing and tracingdesktop
: Desktop application for all major operating systems, using the system’s webviewdocbrowse
: UI for browsing the Markdown documentation as HTMLexport
: Generates code based on the project’s schemaexpression
: CEL engine for evaluating arbitrary expressionsfilesystem
: An abstraction around local and remote filesystemsgit
: Helper classes for performing operations on git repositoriesgraphql
: Supports GraphQL APIs within your applicationhar
: Utilities for working with HTTP Archive fileshelp
: Markdown-backed help files that integrate into the UIios
: Webview-based application and iOS buildjsx
: A custom JSX engine for reactive UIs without Reactmarketing
: Serves a website for downloads, tutorials, and marketingmigration
: Database migrations and a common database poolmysql
: API for accessing MySQL databasesnotarize
: Sends files to Apple for notarizationnotebook
: Provides an Observable Framework notebooknumeric
: TypeScript and Golang implementations for managing large numbersoauth
: Login and session management for many OAuth providersopenapi
: Embeds the Swagger UI, using your OpenAPI specificationplaywright
: Adds a project for testing the UI using playwright.devpostgres
: API for accessing PostgreSQL databasesprocess
: Framework and UI for managing system processes.proxy
: Provides an HTTP proxy while still enforcing this app’s securityqueue
: Provides a simple message queue based on SQLitereadonlydb
: Read-only database connectionrichedit
: Provides a rich editing experience with a decent fallback when scripting is disabledsandbox
: Useful playgrounds for testing custom functionsschedule
: Provides a scheduled job engine and UI based on gocronscripting
: Allows the execution of JavaScript files using a built-in interpretersearch
: Adds search facilities to the top-level navigation barsqlite
: Provides an API for accessing SQLite databasessystem
: Provides logic and a UI for getting the status of the system the app is running onthemecatalog
: A dozen default themes, and facilities to create additionaltypes
: Classes for representing common data typesupgrade
: In-place version upgrades using GitHub Releasesuser
: Classes for representing persistent user records, application usagewasmclient
: WASM library and HTML host for a custom WASM applicationwasmserver
: Runs your unmodified HTTP server as a Service Workerwebsocket
: API for hosting WebSocket connections
What CLI commands are available?
all
: (default action) Starts the main http server on port 40000 and the marketing site on port 40001audit
: Audits the project files, detecting invalid files and configurationbuild
: Builds the project, many options available, see belowcompletion
: Generate the autocompletion script for the specified shellcreate
: Creates a new projectdebug
: Dumps information about the projectdoctor
: Makes sure your machine has the required dependenciesgenerate
: Applies pending changes to files as requiredgit
: Handles git operations, many options available, see belowhelp
: Help about any commandpreview
: Shows what would happen if you generateserver
: Starts the http server on port 40000 (by default)site
: Starts the marketing site on port 40000 (by default)svg
: Builds the project’s SVG filesupdate
: Refreshes downloaded assets such as modulesupgrade
: Upgrades projectforge to the latest published versionvalidate
: Validates the project configversion
: Displays the version and exits
What actions are available for my project from the UI?
preview
: Shows what would happen if you generategenerate
: Applies pending changes to files as requiredaudit
: Audits the project files, detecting invalid files and configurationbuild
: Builds the project, many options available, see belowfiles
: Browse your project’s filesystemsvg
: Options for managing the SVG icons in the systemgit
: Handles git operations, many options available, see below
What build options are available?
build
: Runs [make build]clean
: Runs [make clean]cleanup
: Cleans up file permissionsclientBuild
: Runs [bin/build/client.sh]clientInstall
: Installs dependencies for the TypeScript clientdeployments
: Manages deploymentsdeps
: Manages Go dependenciesformat
: Runs [bin/format.sh]imports
: Organizes the imports in source files and templateslint
: Runs [bin/check.sh]lint-client
: Runs [bin/check-client.sh]packages
: Visualize your application’s packagestest
: Does a testtidy
: Runs [go mod tidy]
What git actions are available?
Common git actions like status
, fetch
, pull
and commit
do exactly what you’d expect.
There’s also a magic
action, which is a little crazy:
- If there are uncommitted changes, it will stash them
- If there are pending upstream commits, it will pull them
- If a stash was previously created, it will pop and commit it
- If commits exist that haven’t been pushed, it will push them
How do I make a new HTTP action?
Create a new file in app/controller
or a child directory, then add your method.
The usual form is:
1 |
|
Add your action to ./app/controller/routes/routes.go
like so:
makeRoute(r, http.MethodGet, "/time", controller.CurrentTime)
Then create a menu item in ./app/controller/cmenu/menu.go
like so:
1 |
|
Templates are written in quicktemplate, and generally take this form:
1 |
|
The layout.Basic
renders menu and navigation, and is swappable for custom response types.
What is provided in the TypeScript application?
The TypeScript project (available at ./client
) is dependency-free, lightweight, and is built with ESBuild.
Most code is wired in automatically when the build’s .js
output is requested.
See the code in ./client/src
for details.
CSS is also built by ESBuild, see ./client/src/client.css
and the files in ./client/src/style
.
How do I use custom modules?
If you want to make your own module, you can load it in Project Forge by adding the following section to the “info” object in ./.projectforge/project.json
:
1 |
|
How do I manage more than one Project Forge project at once?
Create the file ./projectforge/additional-projects.json
, containing a JSON array of string paths to other projects.
How are static assets served?
Assets are embedded into the servier binary at build time using Go’s embed
package.
This brings a lot of advantages, but you’ll need to rebuild before you see changes to your assets.
The script ./bin/dev.sh
handles the rebuild/restart automatically.
How do I work with SVG icons?
To see available icons, click the SVG
button on your project’s page.
To add a new icon, enter the name of the icon from Line Awesome or paste a URL.
When added, the icon is rewritten to support themes/styling and references.
To reference an icon, add {%= components.SVG("star") %}
in your template.
Other helper methods available, see ./views/compnents/SVG.html
What’s this PF_SECTION crap?
Most files are either fully-generated by Project Forge, or completely custom to your application. Rarely, files are managed but also support custom code. The text you place inside a PF_SECTION will be preserved when your project is updated.
To exclude a file from code generation entirely, add it to the ignoredFiles
array in your project’s configuration.
What administrative functions are available?
Assuming you’ve got access, going to /admin
will show you the available actions:
- CPU/memory profiling and visualization, runtime heap dumps
- Garbage collection management and metrics
- View your projects Go modules, internal and external
- Theme management, with theme catalogs and live preview
- Lots of HTTP tools, for investigating sessions or request
How can I secure my application?
TODO
What options are available for the HTML menu and breadcrumbs?
TODO
What search facilities are available?
TODO
What utility methods are available for my app?
So many. See the files in ./app/util
, there’s a ton of juicy stuff.
How do I add a new model to the “export” facilities?
Export configuration is stored in ./.projectforge/export
.
A rudimentary UI is provided in the “Export” section of your project’s page.
To be honest, the easiest way to do this is to copy/paste and modify an existing model definition.
There’s some good examples at rituals.dev.