localcloud-studio 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Joe Sabbagh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,76 @@
1
- # Temporary Holding Version
1
+ # LocalCloud Studio
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Design AWS infrastructure on a 2D canvas, compile it to Terraform for four environments at once, and deploy it to [AWS Emulator](https://github.com/aws/aws-emulator) running locally. When it works locally, export Terraform for your real AWS accounts and deploy it with your usual pipeline. LocalCloud itself only ever runs against the emulator.
4
+
5
+ ## Quick start
6
+
7
+ In the folder that should hold your project:
8
+
9
+ ```bash
10
+ npx localcloud-studio # opens on http://127.0.0.1:5173
11
+ npx localcloud-studio ./infra --port 8080 --open
12
+ ```
13
+
14
+ The canvas is saved to `localcloud.json` in that folder, Terraform for the emulator goes to `terraform-out/`, and **Export for AWS** writes `terraform-aws/`. Needs Node 18+. The live features (emulators, plan, apply) also need Docker, Terraform 1.10+ and `zip`.
15
+
16
+ ### From a clone
17
+
18
+ ```bash
19
+ npm install
20
+ npm run dev # http://127.0.0.1:5173, saves to this folder
21
+ npm run build && npm start -- path/to/project
22
+ ```
23
+
24
+ ## What you can do
25
+
26
+ - **Canvas**: drag services from the catalog, wire them together, and configure every field in the inspector. Drop resources into **VPC** and **Subnet** containers to place them in that network. The compiler fills in `vpc_id` / `subnet_ids` from the nesting.
27
+ - **Environments**: `dev`, `testing`, `staging` and `prod` share one canvas. Any field can be overridden per environment, and any resource can be switched off for one environment.
28
+ - **Lambda code**: inline (one file, no dependencies) or a **folder** in the project, zipped as-is with its `node_modules` or vendored packages. Build or install first; the handler is a path inside the folder.
29
+ - **Extra HCL**: every resource has an **Extra HCL** field for arguments the form doesn't cover. It is written inside the resource block as typed and can be overridden per environment like any other field.
30
+ - **Terraform**: **Sync** writes `terraform-out/environments/<env>/` (main, provider, variables, tfvars, outputs) and zips Lambda handler code into `artifacts/`. `terraform-out/` is generated and git-ignored.
31
+ - **Run**: start or stop an emulator container per environment (ports 9297–9300), then run `init / validate / plan / apply / destroy` with live output. Everything the app runs goes to the local emulator.
32
+ - **Status**: whether a resource is applied comes from each environment's Terraform state (`terraform-out/environments/<env>/terraform.tfstate`), read on load and after every apply or destroy, along with its outputs.
33
+ - **Emulator support**: each service shows whether it applied and destroyed cleanly in the last `npm run test:emulator`, failed, or was never tested. Failures also appear in the Audit tab.
34
+ - **Export for AWS**: writes `terraform-aws/environments/<env>/` for real accounts: no emulator endpoints or credentials, S3 remote state (`backend.tf`, with settings in `backend.tfbackend`), the latest Amazon Linux 2023 image instead of a placeholder AMI, and `vpc_id` / `subnet_ids` inputs for resources that have no VPC or Subnet on the canvas. The export lists anything to fix first, such as a subnet whose availability zone is in another region. `backend.tfbackend` is written once and never overwritten, so fill it in and commit the folder. The Terraform tab can preview either output.
35
+ - **Plan before apply**: **Apply** first runs `terraform plan`. The canvas marks each resource as create, change, replace or destroy, and a bar shows the totals. Nothing is applied until you press **Apply** on that bar, which applies exactly the saved plan. Editing the design discards the plan, and so does changing a Lambda's code folder: the server refuses a saved plan whose Terraform files or Lambda zips changed since it was made.
36
+ - **Destroy preview**: **destroy** in the Run tab shows a destroy plan the same way, with its own red confirm button. The top bar's Apply never applies a pending destroy plan.
37
+ - **Connections**: the canvas only accepts connections that mean something (a queue triggering a Lambda, a Lambda reading a table, a load balancer in front of a service). Anything else, like a database "calling" a Lambda or an edge into a VPC, is refused with a short reason.
38
+ - **Data**: browse and poke the deployed resources (S3 objects, DynamoDB items, SQS messages, Lambda invokes).
39
+ - **Audit**: architecture checks per environment and an estimated monthly AWS cost per environment.
40
+ - **Project file**: the canvas saves to `./localcloud.json` as you edit, so it can be committed and diffed. It holds the design only (no selection or provisioning state). Reload the page after pulling changes to it.
41
+ - **Import**: import existing `.tf` files onto the canvas, or download / load a project file by hand. Arguments the form models become fields; the rest are kept as each resource's Extra HCL. Anything that can't be kept (arguments LocalCloud generates itself, `count` / `for_each`, resource types with no canvas service) is listed after the import.
42
+
43
+ ## Shortcuts
44
+
45
+ | Keys | Action |
46
+ | --- | --- |
47
+ | ⌘Z / ⌘⇧Z | Undo / redo |
48
+ | ⌫ / Delete | Delete selection |
49
+ | ⌘D | Duplicate selected resource |
50
+ | Esc | Clear selection |
51
+
52
+ ## Layout
53
+
54
+ - `src/data`: AWS service catalog and blueprints
55
+ - `src/utils/terraformCompiler.ts`: canvas → Terraform
56
+ - `src/utils/hclImporter.ts`: Terraform → canvas
57
+ - `src/utils/canvasLayout.ts`: container nesting and auto-layout
58
+ - `server/api.ts`: local API used by the UI (project file, emulator control, Terraform runner, data explorer). It only answers requests from the local page.
59
+ - `server/cli.ts`: standalone server for the built UI and the API (`npm start`)
60
+
61
+ ## Tests
62
+
63
+ ```bash
64
+ npm test # compiler golden files, AWS export, plan summary, extra HCL, project file
65
+ npm run validate:golden # terraform validate on every golden root (needs terraform)
66
+ npm run test:e2e # browser tests against the built app (run npm run build first; terraform is mocked)
67
+ npm run test:emulator # apply + destroy every blueprint on a fresh emulator (needs docker + terraform)
68
+ ```
69
+
70
+ `tests/golden/<target>/<blueprint>/<env>/` holds the Terraform each blueprint compiles to, for the emulator and as the AWS export (plus a small fixture that covers the export's network inputs and AMI lookup). After an intended compiler change, refresh it with `npm test -- -u` and review the diff. CI runs the first three.
71
+
72
+ `test:emulator` applies each blueprint, plus a canvas with every other catalog service, to a fresh emulator on port 9397 (in dev and prod), then destroys it. It records which resource types work in `src/data/emulatorSupport.json`, which the UI reads. It takes a while and needs Docker, so it is run by hand and the results are committed. Pass a filter (`npm run test:emulator -- serverless --env dev`) to rerun part of it.
73
+
74
+ ## License
75
+
76
+ [MIT](LICENSE)