Cordium documentation · Latest
Full-Stack Development
This example sets up a complete, ready-to-code development environment for a full-stack application: a Go API and a React frontend built with Vite in the same repository, backed by the team's staging PostgreSQL database. Every developer gets their own persistent Workspace in which both dev servers are already running when it starts, the frontend and the API are available over HTTPS in the browser, and the staging database is accessible without any password.
The Template
The Template uses the official Go image and adds Node.js via a devcontainer feature. The repository is cloned with each developer's own GitHub account via the github GitProvider of the storefront Space (read more here):
Here are a few notes about this Template:
The
apitask waits until the name of thepg-staging.paymentsOctelium Service resolves, since the Workspace connects to the Cluster at the beginning of thePOST_STARTphase (read more here). The database password is injected by Octelium, which is whyDATABASE_URLcontains none (read more here).Both dev servers run as background tasks, which means that the Workspace becomes
RUNNINGwithout waiting for them, and that they keep running for as long as the Workspace runs. Their output is available in the Workspace's logs.The dev servers listen on
0.0.0.0so that they can be reached through the portal (read more here).
Since the repository is cloned with each developer's own account, this Template is not pre-built. Instead, each developer's Workspace is persistent, which means that the dependencies are only installed on its first run.
Creating a Workspace
Applications are specific to each Workspace. Create a persistent Workspace with the frontend as its default application and the API as a named one:
Then, open the Workspace's page in the web portal, click Sign in to Git provider to authorize GitHub, and start it. Once it is running, the frontend is available at https://<WORKSPACE>.cordium.<DOMAIN> and the API at https://api_<WORKSPACE>.cordium.<DOMAIN>, both authenticated with your Octelium identity.
Developing
You can work from a browser terminal, or connect VS Code, Cursor, Zed or a JetBrains IDE over SSH (read more here):
Since Vite's dev server reloads on file changes, your edits are immediately visible in the browser. git pull and git push use your GitHub account through the GitProvider, while the gh CLI, which is installed by its devcontainer feature, can be authenticated separately via gh auth login.
Sharing a Preview
When your branch is ready for review, share the frontend with the other Members of the storefront Space from the Applications panel of the Workspace's page in the web portal, or via the SDKs. Your teammates can then open https://web_<WORKSPACE>.cordium.<DOMAIN> with their own identities while your Workspace is running (read more here):
To share a preview with people who are not Users of your Cluster, such as a customer or a designer, serve it as a public Octelium Service instead (read more here).