Skip to content

Commit

Permalink
Merge pull request #4 from ssennettau/rename
Browse files Browse the repository at this point in the history
Rename PartySmith to GenStack
  • Loading branch information
ssennettau authored Feb 19, 2024
2 parents d29c9c2 + 9d4c14b commit 8cb557e
Show file tree
Hide file tree
Showing 23 changed files with 159 additions and 49 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy-partysmith-dev.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Deploy PartySmith (Dev)
name: Deploy GenStack (Dev)
on:
push:
pull_request:
branches:
- '!main'
- main
concurrency:
group: merge-${{ github.ref }}
permissions:
Expand All @@ -20,6 +20,6 @@ jobs:
role-to-assume: arn:aws:iam::672107698272:role/GitHubActionsRole
role-duration-seconds: 3600
aws-region: us-east-1
- name: Deploy PartySmith with SST
- name: Deploy GenStack with SST
run: |
npm i && npx sst deploy --stage dev
4 changes: 2 additions & 2 deletions .github/workflows/deploy-partysmith-prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy PartySmith (Prod)
name: Deploy GenStack (Prod)
on:
push:
branches:
Expand All @@ -20,6 +20,6 @@ jobs:
role-to-assume: arn:aws:iam::672107698272:role/GitHubActionsRole
role-duration-seconds: 3600
aws-region: us-east-1
- name: Deploy PartySmith with SST
- name: Deploy GenStack with SST
run: |
npm i && npx sst deploy --stage prod
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# PartySmith
# GenStack

PartySmith transforms your AWS PartyRock apps into deployable full-stack SvelteKit applications.
GenStack transforms your AWS PartyRock apps into deployable full-stack SvelteKit applications.

Users can enter the URL of a publicly published PartyRock app, select the desired settings, and PartySmith will forge an application into a ZIP archive which will be downloaded to your machine, and ready for use.
Users can enter the URL of a publicly published PartyRock app, select the desired settings, and GenStack will forge an application into a ZIP archive which will be downloaded to your machine, and ready for use.

This is an unofficial community project, and not directly affiliated with Amazon Web Services.

## Usage

You can use PartySmith either by going to the production site at [partysmith.ssennett.net](https://partysmith.ssennett.net/), or by cloning this repo and running the application yourself.
You can use GenStack either by going to the production site at [partysmith.ssennett.net](https://partysmith.ssennett.net/), or by cloning this repo and running the application yourself.

![PartySmith Screenshot](docs/screenshot-ps.png)
![GenStack Screenshot](docs/screenshot-ps.png)

After opening the web app, you simply input the desired settings, and the ZIP archive will be downloaded to your browser. Details on how to run the generated apps can be found in the [README](templates/primary/README.md) built-in to the app.

Try a [demo](https://demo.partysmith.ssennett.net/) based on the [Costume Theme Designer](https://partyrock.aws/u/nadino/xEljGaHQr/Costume-Theme-Designer/snapshot/VRuSGss6V) PartyRock app by AWS Community Builder [Nadia Reyhani](https://www.linkedin.com/in/ronak-reyhani).

## Deploying PartySmith Itself
## Deploying GenStack Itself

If you'd like to run this app itself, you can clone the repo to your own machine, install the necessary packages, and run it locally in development mode.

Expand All @@ -39,7 +39,7 @@ To deploy it to another hosting platform like Vercel, the adaptor in `svelte.con

## How does it work?

PartySmith relies on a number of templated layers which are provided in the downloads, and are made to be highly general-purpose, so it will be compatible with any PartyRock application (intended, no guarantee).
GenStack relies on a number of templated layers which are provided in the downloads, and are made to be highly general-purpose, so it will be compatible with any PartyRock application (intended, no guarantee).

Along with these layers, the app is customized using the definition of the application downloaded from PartyRock itself, which exists in the form of a JSON file. That JSON file is added to the templates, and is used at run-time to render the app, and all of its calls out to Amazon Bedrock.

Expand Down
76 changes: 76 additions & 0 deletions cdk/redirectionsite.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
import * as cloudfrontOrigins from 'aws-cdk-lib/aws-cloudfront-origins';
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import * as route53 from 'aws-cdk-lib/aws-route53';
import * as route53Targets from 'aws-cdk-lib/aws-route53-targets';
import * as s3 from 'aws-cdk-lib/aws-s3';

export interface RedirectionSiteProps {
targetUrl: string;
customDomain?: CustomDomainProps;
}

interface CustomDomainProps {
domainName: string;
hostedZone: string;
}

export class RedirectionSite extends Construct {
public readonly cfDistributionUrl: string;
public readonly url: string;

constructor(scope: Construct, id: string, props: RedirectionSiteProps) {
super(scope, id);

const hostedZone = props.customDomain ? route53.HostedZone.fromLookup(this, "hostedZone", {
domainName: props.customDomain?.hostedZone,
}) : undefined;

const distribution = new cloudfront.Distribution(this, "redirectDistribution", {
defaultBehavior: {
origin: new cloudfrontOrigins.S3Origin(new s3.Bucket(
this, "stubBucket", { removalPolicy: cdk.RemovalPolicy.DESTROY })),
viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
responseHeadersPolicy: cloudfront.ResponseHeadersPolicy.CORS_ALLOW_ALL_ORIGINS,
functionAssociations: [{
function: new cloudfront.Function(this, "redirectFunction", {
code: cloudfront.FunctionCode.fromInline(`
function handler(event) {
var response = {
statusCode: 302,
statusDescription: "Found",
headers: {
'location': { value: "${props.targetUrl}" },
'cloudfront-functions': { value: "redirect" }
}
};
return response;
}
`)
}),
eventType: cloudfront.FunctionEventType.VIEWER_REQUEST,
}]
},
domainNames: props.customDomain ? [props.customDomain?.domainName] : undefined,
certificate: props.customDomain ? new acm.Certificate(this, "redirectCertificate", {
domainName: props.customDomain.domainName,
validation: acm.CertificateValidation.fromDns(hostedZone),
}) : undefined,
minimumProtocolVersion: cloudfront.SecurityPolicyProtocol.TLS_V1_2_2021,
});

if (hostedZone) {
const route53Record = new route53.RecordSet(this, "r53record", {
zone: hostedZone,
recordName: props.customDomain?.domainName,
recordType: route53.RecordType.A,
target: route53.RecordTarget.fromAlias(new route53Targets.CloudFrontTarget(distribution)),
});
}

this.cfDistributionUrl = `https://${distribution.domainName}`;
this.url = props.customDomain ? `https://${props.customDomain.domainName}` : this.cfDistributionUrl;
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "partysmith",
"name": "genstack",
"version": "1.0.0",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<link rel="icon" href="%sveltekit.assets%/favicon.png">
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
Expand Down
21 changes: 13 additions & 8 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@
</script>

<head>
<title>PartySmith</title>
<meta name="description" content="PartySmith transforms your AWS PartyRock apps into deployable full-stack SvelteKit applications.">
<title>GenStack</title>
<meta name="description" content="GenStack transforms your AWS PartyRock apps into deployable full-stack SvelteKit applications.">
<meta name="author" content="Stephen Sennett">
<meta name="og:title" content="PartySmith">
<meta name="og:description" content="PartySmith transforms your AWS PartyRock apps into deployable full-stack SvelteKit applications.">
<meta name="og:title" content="GenStack">
<meta name="og:description" content="GenStack transforms your AWS PartyRock apps into deployable full-stack SvelteKit applications.">
<meta name="og:locale" content="en_AU">
<meta name="og:local:alternate" content="en_US">
<meta name="og:url" content="https://partysmith.ssennett.net/">
<meta name="og:image" content="https://partysmith.ssennett.net/logo.jpg">
</head>

<div class="min-h-screen flex flex-col">
<header class="pt-16 mb-4 text-center">
<h1 class="text-4xl text-yellow-400 font-semibold"><a href="/">PartySmith</a></h1>
<div class="flex flex-col justify-center items-center">
<header class="pt-16 mb-16 text-center">
<h1 class="text-4xl text-yellow-400 font-semibold mb-2">
<a href="/">
<img src="/header.png" alt="GenStack" class="w-4/5 max-w-2xl m-auto rounded-xl border-2 border-gray-900 shadow-xl" />
</a>
</h1>
<p class="text-gray-300 text-lg">Bringing the party to your place.</p>
{#if dev}
<p class="text-sm text-yellow-200">&mdash; &#x26A0; Running in Development Mode &#x26A0; &mdash;</p>
Expand All @@ -34,5 +38,6 @@
<div class="text-sm">
<a href="/about" class="font-semibold hover:text-gray-500">About</a>
|
<a href="https://github.com/ssennettau/partysmith/" class="font-semibold hover:text-gray-500" target="_blank">GitHub</a></div>
<a href="https://github.com/ssennettau/partysmith/" class="font-semibold hover:text-gray-500" target="_blank">GitHub</a>
</div>
</footer>
2 changes: 1 addition & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
let isError: boolean = false;
let errorMessage: string;
console.log("PartySmith Loaded");
console.log("GenStack Loaded");
const regexPattern = new RegExp("^http[s]{0,1}:\/\/partyrock.aws\/u\/.+?\/.*");
$: validUrl = regexPattern.test(textUrl);
Expand Down
6 changes: 3 additions & 3 deletions src/routes/about/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<main class="flex-grow flex items-center justify-center mb-16">
<div class="bg-gray-800 p-6 rounded-lg shadow-md max-w-4xl space-y-3">
<p>PartySmith is an unofficial community project that transforms your <a href="https://partyrock.aws/" class="font-semibold text-yellow-400 hover:text-gray-500" target="_blank">AWS PartyRock</a> apps into deployable full-stack <a href="https://kit.svelte.dev/" class="font-semibold text-yellow-400 hover:text-gray-500" target="_blank">SvelteKit</a> applications.</p>
<p>GenStack is an unofficial community project that transforms your <a href="https://partyrock.aws/" class="font-semibold text-yellow-400 hover:text-gray-500" target="_blank">AWS PartyRock</a> apps into deployable full-stack <a href="https://kit.svelte.dev/" class="font-semibold text-yellow-400 hover:text-gray-500" target="_blank">SvelteKit</a> applications.</p>

<p>Users can enter the URL of a publicly published PartyRock app, select the desired settings, and PartySmith will forge an application into a ZIP archive which will be downloaded to your machine, and ready for use.</p>
<p>Users can enter the URL of a publicly published PartyRock app, select the desired settings, and GenStack will forge an application into a ZIP archive which will be downloaded to your machine, and ready for use.</p>

<p>This is designed to help build rapidly-deployable, and highly-customizable experimental apps using the Generative AI services of <a href="https://aws.amazon.com/bedrock" class="font-semibold text-yellow-400 hover:text-gray-500" target="_blank">Amazon Bedrock</a>, which are suitable for use in personal, customer-facing, or internal enterprise use cases.</p>

<p>You can find out more about how PartySmith works by checking out the article on <a href="https://community.aws/content/2b40sobzGjCjWy9oUjtygY5McjU/partysmith" class="font-semibold text-yellow-400 hover:text-gray-500" target="_blank">Community.AWS</a>, or by visiting the <a href="https://github.com/ssennettau/PartySmith" class="font-semibold text-yellow-400 hover:text-gray-500" target="_blank">PartySmith GitHub Repository</a>.</p>
<p>You can find out more about how GenStack works by checking out the article on <a href="https://community.aws/content/2b40sobzGjCjWy9oUjtygY5McjU/partysmith" class="font-semibold text-yellow-400 hover:text-gray-500" target="_blank">Community.AWS</a>, or by visiting the <a href="https://github.com/ssennettau/GenStack" class="font-semibold text-yellow-400 hover:text-gray-500" target="_blank">GenStack GitHub Repository</a>.</p>
</div>
</main>
2 changes: 1 addition & 1 deletion src/routes/api/build-app/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function POST(requestEvent): Promise<Response> {
};

let response: any;
response = await builder.buildPartySmithApp(appRequest);
response = await builder.buildGenStackApp(appRequest);

if (response.status == true) {
return new Response(JSON.stringify(response.body), {
Expand Down
8 changes: 4 additions & 4 deletions src/routes/api/build-app/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ const checkLambda = !!process.env.LAMBDA_TASK_ROOT;
import { Metrics, MetricUnits } from '@aws-lambda-powertools/metrics';
import { Logger } from '@aws-lambda-powertools/logger';
const metrics = new Metrics({
namespace: "PartySmith-experimental",
namespace: "GenStack-experimental",
serviceName: "builder",
defaultDimensions: {
environment: dev ? "development" : "production"
}
});
const logger = new Logger({
serviceName: "/PartySmith-experimental/builder",
serviceName: "/GenStack-experimental/builder",
})

// SST won't bundle the templates, so in Prod it relies on a Lambda Layer to host the templates.
const baseTemplateDir = checkLambda ? "/opt/templates" : "./src/templateLayer/templates";

export async function buildPartySmithApp(request: AppRequest) {
export async function buildGenStackApp(request: AppRequest) {
console.log("Parsing request...");
const requestId = crypto.randomUUID();
console.debug({
Expand Down Expand Up @@ -247,7 +247,7 @@ async function addSST(tempPath: string, appName: string) {
console.debug("Updating sst.config.ts file");
const sstConfigPath = path.join(tempPath, "sst.config.ts");
const sstConfigContents = await fs.promises.readFile(sstConfigPath, 'utf8');
updatedContents = sstConfigContents.replace(/partysmithapp/g, packageName);
updatedContents = sstConfigContents.replace(/genstackapp/g, packageName);
await fs.promises.writeFile(sstConfigPath, updatedContents);
return true;
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions src/templateLayer/templates/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PartySmith Templates
# GenStack Templates

There are multiple `template` directories which are used to build PartySmith apps, starting with the `primary` directory. Additional directories like `cssTheme` and `sst` are added on as layers, overwriting the contents of the `primary` when the project is being created.
There are multiple `template` directories which are used to build GenStack apps, starting with the `primary` directory. Additional directories like `cssTheme` and `sst` are added on as layers, overwriting the contents of the `primary` when the project is being created.

```
---------------------
Expand Down
12 changes: 6 additions & 6 deletions src/templateLayer/templates/primary/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# PartySmith-App-[APPNAME]
# GenStack-App-[APPNAME]

This app was built based on an [AWS PartyRock](https://partyrock.aws/) app, using the community project [PartySmith](https://partysmith.ssennett.net/).
This app was built based on an [AWS PartyRock](https://partyrock.aws/) app, using the community project [GenStack](https://partysmith.ssennett.net/).

![Generic Sample App Screenshot](docs/screenshot-app.png)

Expand Down Expand Up @@ -38,21 +38,21 @@ npm run build

## Customization

The purpose of PartySmith and apps like this is to enable developers to experiment with Amazon Bedrock in web applications.
The purpose of GenStack and apps like this is to enable developers to experiment with Amazon Bedrock in web applications.

> **Note:** While PartySmith apps can be used and hosted, they're designed as an experimental platform to help the developer experience, and are not intended for production usage.
> **Note:** While GenStack apps can be used and hosted, they're designed as an experimental platform to help the developer experience, and are not intended for production usage.
Below is some information to help you get started customizing your application.

### Definition File

PartyRock applications use a structured JSON object to determine the application's structure, including the widgets provided to the user. When you generate a PartySmith application, it uses a copy of this JSON object.
PartyRock applications use a structured JSON object to determine the application's structure, including the widgets provided to the user. When you generate a GenStack application, it uses a copy of this JSON object.

You can find the object at `./src/lib/stores/definition.json`.

### Themes and Styling

By default, PartySmith applications will use a stylesheet generated with [Tailwind CSS](https://tailwindcss.com/) to style the application in a manner similar to the default PartyRock theme. You may also have disabled this using the generator.
By default, GenStack applications will use a stylesheet generated with [Tailwind CSS](https://tailwindcss.com/) to style the application in a manner similar to the default PartyRock theme. You may also have disabled this using the generator.

This project will attempt to load the contents of `./src/app.css`, which can be modified to meet your needs.

Expand Down
2 changes: 1 addition & 1 deletion src/templateLayer/templates/primary/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "partysmith-app",
"name": "genstack-app",
"version": "0.0.1",
"private": true,
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</div>

<div class="party-footer">
Generated by PartySmith<br />
Generated by GenStack<br />
Originally built with <a href={ appUrl } target="_blank">PartyRock</a>
</div>
</main>
2 changes: 1 addition & 1 deletion src/templateLayer/templates/sst/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SvelteKitSite } from "sst/constructs";
export default {
config(_input) {
return {
name: "partysmithapp",
name: "genstackapp",
region: "us-east-1",
};
},
Expand Down
Loading

0 comments on commit 8cb557e

Please sign in to comment.