{"id":17757811,"url":"https://github.com/codeware-sthlm/codeware","last_synced_at":"2026-01-03T00:20:18.307Z","repository":{"id":259300518,"uuid":"869615153","full_name":"codeware-sthlm/codeware","owner":"codeware-sthlm","description":"Codeware multi stack and architecture playground","archived":false,"fork":false,"pushed_at":"2025-05-04T22:21:48.000Z","size":6162,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-05-04T23:28:13.231Z","etag":null,"topics":["github-action","hono","infisical","mongodb","monorepo","nx","nx-plugin","payloadcms","postgres","react","remix","tailwindcss","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codeware-sthlm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-10-08T15:38:49.000Z","updated_at":"2025-04-28T19:38:20.000Z","dependencies_parsed_at":"2024-10-28T04:35:05.360Z","dependency_job_id":"0964420c-911f-41f6-a0cb-fdf1332c4b20","html_url":"https://github.com/codeware-sthlm/codeware","commit_stats":{"total_commits":141,"total_committers":7,"mean_commits":"20.142857142857142","dds":0.4964539007092199,"last_synced_commit":"736a88e5066e3b20c862a167bdce503cf5d9bddc"},"previous_names":["codeware-sthlm/codeware"],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeware-sthlm%2Fcodeware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeware-sthlm%2Fcodeware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeware-sthlm%2Fcodeware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codeware-sthlm%2Fcodeware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codeware-sthlm","download_url":"https://codeload.github.com/codeware-sthlm/codeware/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253481058,"owners_count":21915259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-action","hono","infisical","mongodb","monorepo","nx","nx-plugin","payloadcms","postgres","react","remix","tailwindcss","typescript"],"created_at":"2024-10-26T17:08:51.194Z","updated_at":"2026-01-03T00:20:18.301Z","avatar_url":"https://github.com/codeware-sthlm.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cbr /\u003e\n  \u003cimg width=\"200\" src=\"./assets/cdwr-cloud.png\" alt=\"codeware sthlm logo\"\u003e\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n\u003c/p\u003e\n\n\u003ch1 align='center'\u003eCodeware Playground\u003c/h1\u003e\n\n\u003cp align='center'\u003e\n  A playground for multi stack and architecture powered by Codeware Sthlm.\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n  \u003ca href='https://opensource.org/licenses/MIT'\u003e\u003cimg src='https://img.shields.io/badge/License-MIT-green.svg' alt='MIT'\u003e\u003c/a\u003e\n  \u003cbr /\u003e\n  \u003cbr /\u003e\n\u003c/p\u003e\n\n## Contents \u003c!-- omit in toc --\u003e\n\n- [Packages](#packages)\n  - [Nx Plugins](#nx-plugins)\n  - [GitHub Actions](#github-actions)\n  - [Node Libraries](#node-libraries)\n  - [Utilities](#utilities)\n- [Startup Payload multi-tenant in dev mode](#startup-payload-multi-tenant-in-dev-mode)\n  - [Terminal 1: Start Postgres and admin UI](#terminal-1-start-postgres-and-admin-ui)\n  - [Terminal 2: Start web client](#terminal-2-start-web-client)\n  - [Terminal 3: Start reverse proxy to simulate multi-tenancy](#terminal-3-start-reverse-proxy-to-simulate-multi-tenancy)\n- [Development Tools \\\u0026 Services](#development-tools--services)\n  - [Infisical Secrets Management](#infisical-secrets-management)\n  - [Fly.io Deployment](#flyio-deployment)\n  - [Release Management](#release-management)\n- [Deployment](#deployment)\n\n## Packages\n\n### Nx Plugins\n\n#### [`nx-payload`](packages/nx-payload) \u003c!-- omit in toc --\u003e\n\nAdd support for [Payload](https://payloadcms.com) in your existing [Nx](https://nx.dev) workspace.\n\n```sh\nnpx add @cdwr/nx-payload\n```\n\n##### [`create-nx-payload`](packages/create-nx-payload) \u003c!-- omit in toc --\u003e\n\nQuickly create a new [Nx](https://nx.dev) workspace with a [Payload](https://payloadcms.com) application, using the plugin as a preset.\n\n```sh\nnpx create-nx-payload\n```\n\n### GitHub Actions\n\n#### [`deploy-env-action`](packages/deploy-env-action) \u003c!-- omit in toc --\u003e\n\nGitHub action that analyzes the environment to deploy to based on the event details.\n\n#### [`nx-fly-deployment-action`](packages/nx-fly-deployment-action) \u003c!-- omit in toc --\u003e\n\nGitHub action that brings automatic [Fly.io](https://fly.io) deployments to your [Nx](https://nx.dev) workspace.\n\n#### [`nx-migrate-action`](packages/nx-migrate-action) \u003c!-- omit in toc --\u003e\n\nGitHub action that brings automatic [Nx](https://nx.dev) migrations to your workspace.\n\n#### [`nx-pre-deploy-action`](packages/nx-pre-deploy-action) \u003c!-- omit in toc --\u003e\n\nGitHub action that brings pre-deployment analysis of environment, multi-tenancy and secrets to your workspace.\n\n### Node Libraries\n\n#### [`fly-node`](packages/fly-node) \u003c!-- omit in toc --\u003e\n\nFly CLI node wrapper for programmatic deployments to [Fly.io](https://fly.io).\n\n### Utilities\n\n#### [`core`](packages/core) \u003c!-- omit in toc --\u003e\n\nA set of core utilities for the [Codeware](https://codeware.se) ecosystem.\n\n## Startup Payload multi-tenant in dev mode\n\nThe Payload suite consists of\n\n- Payload Admin UI (`cms`)\n- Web Client (`web`)\n- Docker Postgres Database\n- Nginx Reverse Proxy to simulate multi-tenancy\n\n\u003e [!IMPORTANT]\n\u003e For a better DX you should not connect to Infisical in dev mode, since the development seed has much more data.\n\u003e\n\u003e Make sure the credentials in the `.env.local` file are not set.\n\n### Terminal 1: Start Postgres and admin UI\n\n#### Start Postgres in Docker \u003c!-- omit in toc --\u003e\n\n```sh\nnx dx:postgres cms\n```\n\n#### Serve admin UI \u003c!-- omit in toc --\u003e\n\n```sh\nnx serve cms\n```\n\n\u003e [!NOTE]\n\u003e Database is auto-seeded with static data when the admin UI is started.\n\n#### Optional \u003c!-- omit in toc --\u003e\n\n##### Clear database and run migrations \u003c!-- omit in toc --\u003e\n\n```sh\nnx payload cms migrate:fresh\n```\n\n##### Generate seed data \u003c!-- omit in toc --\u003e\n\nSeed data is stored in environment-specific TypeScript files in\n\n- `libs/shared/util/seed/src/lib/static-data`.\n\nYou can remove the existing seed data and keep just an empty object to force the generation of new seed data.\n\n```sh\nnx seed cms\n```\n\n### Terminal 2: Start web client\n\n\u003e [!NOTE]\n\u003e Live-reload is not fully operational.\n\n```sh\nnx start web\n```\n\n### Terminal 3: Start reverse proxy to simulate multi-tenancy\n\n```sh\nnx payload-proxy:up\n```\n\n\u003e [!NOTE]\n\u003e You can now access the different web sites as different tenants:\n\u003e\n\u003e 🌐 `cms.localhost`\n\u003e\n\u003e :pouting_face: `system@local.dev` @ `dev`\n\n**Optional**\n\nStop the proxy\n\n```sh\nnx payload-proxy:down\n```\n\nCommunicate with the proxy\n\n```sh\nnx payload-proxy [docker compose options]\n```\n\n## Development Tools \u0026 Services\n\n### Infisical Secrets Management\n\nThe [Infisical](https://infisical.com) secret management tool is used to manage secrets for the Codeware ecosystem.\n\n\u003e [!NOTE] Deployment and multi-tenant configuration\n\u003e **See:** [DEPLOYMENT.md](DEPLOYMENT.md) and the [multi-tenant setup guide](packages/nx-pre-deploy-action/README.md#multi-tenant-setup)\n\n1. [Install Infisical CLI](https://infisical.com/docs/cli/overview#installation)\n\n2. Login to access the secrets\n\n   ```sh\n   infisical login\n   ```\n\n3. List the development secrets\n\n   ```sh\n   # all secrets\n   infisical secrets --recursive\n\n   # cms application (all secrets and some by tag)\n   infisical secrets --recursive --path /cms\n   infisical secrets --tag cms\n\n   # web application (all secrets and some by tag)\n   infisical secrets --recursive --path /web\n   infisical secrets --tag web\n\n   # 'demo' tenant using web application\n   infisical secrets --path /web/tenants/demo\n   ```\n\n#### Using the secrets \u003c!-- omit in toc --\u003e\n\nAdd Infisical creadentials to you local environment.\n\n`apps/cms/.env.local`\n\n```env\n# Alt 1: Client credentials\nINFISICAL_CLIENT_ID=\nINFISICAL_CLIENT_SECRET=\n\n# Alt 2: Service token\nINFISICAL_SERVICE_TOKEN=\n```\n\n\u003e [!NOTE]\n\u003e Secrets can also be injected into `process.env` for any command, but this is not how we normally do it.\n\u003e\n\u003e ```sh\n\u003e infisical run --path [path] -- [command]\n\u003e ```\n\n### Fly.io Deployment\n\nThe [Fly.io](https://fly.io) platform is used to host the deployed applications and the required services.\n\n\u003e [!NOTE] Configuration, multi-tenant setup, and workflow details\n\u003e **See:** [DEPLOYMENT.md](DEPLOYMENT.md)\n\nDeployments are automatic on push events, detected by the [nx-fly-deployment-action](packages/nx-fly-deployment-action).\n\nFor local development and troubleshooting, install the Fly CLI:\n\n1. [Install Fly CLI](https://github.com/superfly/flyctl?tab=readme-ov-file#installation)\n\n2. Login to your Fly account\n\n   ```sh\n   fly auth login\n   ```\n\n3. List the applications (for example)\n\n   ```sh\n   fly apps list\n   ```\n\n#### Database setup for preview deployments \u003c!-- omit in toc --\u003e\n\nApplications affected by a pull request are deployed to a temporary preview environment. A Fly Postgres cluster `pg-preview` is used to store the temporary databases, with automatic attachment/detachment managed by the deployment workflow.\n\n\u003e [!NOTE] How to configure Postgres attachment in github.json\n\u003e **See:** [DEPLOYMENT.md](DEPLOYMENT.md#per-app-configuration-githubjson)\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eAdvanced: Postgres cluster commands\u003c/strong\u003e\u003c/summary\u003e\n\n```sh\n# Create a Postgres cluster (use only one node to prevent HA issues for unmananged cluser)\nfly pg create --name pg-preview --org codeware --region arn --vm-size shared-cpu-2x --volume-size 1 --initial-cluster-size 1\n\n# Detach application from the Postgres cluster\nfly pg detach pg-preview -a cdwr-cms-pr-{pr-number}\n\n# Delete application\nfly apps destroy cdwr-cms-pr-{pr-number}\n\n# List all Postgres databases\nfly pg db list -a pg-preview\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eDatabase Maintenance \u0026 Troubleshooting\u003c/strong\u003e\u003c/summary\u003e\n\n**Cleanup dangling database** (after PR is closed):\n\n```sh\nsh scripts/cleanup-db.sh {pr-number} {cluster-password}\n```\n\n**Drop database** (to start fresh):\n\n```sh\nsh scripts/drop-db.sh {pr-number} {cluster-password}\nfly machine stop {machine-id}\nfly machine restart {machine-id}\n```\n\n**Connect to preview database locally**:\n\n```sh\n# Forward port (5433 to avoid conflicts with local Docker Postgres)\nfly proxy 5433:5432 -a pg-preview\n\n# Connection string\npostgres://postgres:\u003cpassword\u003e@localhost:5433\n```\n\n\u003c/details\u003e\n\n### Release Management\n\nThe release process is semi-automatic which means:\n\n- Releases are generated from a local machine by a developer\n- GitHub action trigger on the tags and publish to NPM\n\nSimply run the following command to start the release process:\n\n```sh\nnx release-cli\n```\n\n## Deployment\n\nThis workspace uses automated GitHub Actions to deploy applications to Fly.io with support for both single-tenant and multi-tenant architectures. The deployment system:\n\n- Automatically detects affected applications using Nx\n- Fetches tenant configuration from Infisical\n- Deploys to the appropriate environment (preview/production)\n- Supports per-app tenant lists for flexible multi-tenancy\n\nFor comprehensive deployment documentation, including configuration, multi-tenant setup, and troubleshooting, see [DEPLOYMENT.md](DEPLOYMENT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeware-sthlm%2Fcodeware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodeware-sthlm%2Fcodeware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodeware-sthlm%2Fcodeware/lists"}