Skip to content

Small frontend to help business owners calculate their break even point

Notifications You must be signed in to change notification settings

USSBA/sba-gov-break-even-calculator

Repository files navigation

Install Break Even Calculator

  1. Make sure you have Xcode installed Install Xcode Command Line Tools: Open your Terminal. Install Xcode Command line tools by running: Copycopy code to clipboard xcode-select --install 💡 If that fails, download it directly from Apple’s site, after signing-in with an Apple developer account.

  2. ***install node version 12 *** brew install node

  3. run pnpm install

  4. Start developing.

    Navigate into your new site’s directory and start it up.

    cd sba-gov-break-even-calculator/solutions/ui
    pnpm start
  5. Open the source code and start editing!

    Your site is now running at http://localhost:8000!

    Open the sba-gov-break-even-calculator directory in your code editor of choice and edit src/pages/index.js. Save your changes and the browser will update in real time!

Easy Mode to log in to AWS with MFA:

All instructions assume you use an MFA token and have credentials set appropriately as described above. Install the AWS CLI Helpers per the instructions to make your life easier.

$ export AWS_PROFILE=default
$ aws-iam-start-mfa-session 
$ unset AWS_PROFILE

Install dependencies

$ brew install pnpm
$ pnpm install
$ sudo pnpm i -g hygen

Generate a settings file

$ cd solution
$ hygen settings new

Each input has instructions on how it will be used. Make sure to name it your github username. These values can be changed at a later date.

when complete 2 files will be created. Environment and stage will be used interchangably going forward.

Deploy the infrastructure

$ scripts/environment-deploy.sh <stage>

or

$ scripts/environment-deploy.sh <stage>

Where is the name you gave your environment in hygen settings

This will create and deploy all of the necessary infrastructure and code for the specified stage

a Website URL will be part of the final output. You can visit your deployed code there.

Deploy new front end code

After you have made some changes to your front end app you may want to redeploy it. To do so you have to first run gatsby build.

$ solution/ui/gatsby build 

To deploy the app you can do 1 of the following:

solution/ui $ sls publish-ui --stage <stage>

or, the slightly more verbose version:

solution/ui $ sls package-ui --stage <stage>
solution/ui $ sls deploy-ui --stage <stage>

When finished you should see new code deployed at your Website URL value.

If you have forgotten your Website URL you can always run the following command to get the values

$ scripts/get-info.ssh <stage>

Delete your environment

Once your environment has served its purpose it can be easily destroyed by running

$ scripts/environment-delete.sh <stage>

Summary

In this repository you are able to create a serverless environment for a single page web app (React in this case, but could be anything), deploy code to it, and, when finished, delete the infrastructure. All commands should be idempotent so running them extra times will not cause problems. Going forward, this repo can be expanded to include a backend api either by default, or as a hygen template, similar to how the settings file was created. Any existing react type project could even be brought into this paradigm by replacing src and package.json in the solution/ui folder. In addition, additional tooling, such as cypress, storybook, an sba master stylesheet, or semantic ui could be added by default or with a hygen script based on the developer's choices.

Project Details

License

The SBA.gov UI (Break Even Calculator) is licensed permissively under the Apache License v2.0. A copy of that license is distributed with this software.

Contributing

We welcome contributions. Please read CONTRIBUTING for how to contribute.

Code Of Conduct

We strive for a welcoming and inclusive environment for the SBA.gov UI (Katana) project.

Please follow this guidelines in all interactions:

  1. Be Respectful: use welcoming and inclusive language.
  2. Assume best intentions: seek to understand other's opinions.

Security Issues

Please do not submit an issue on GitHub for a security vulnerability. Please contact the development team through SBA Website Support.

Be sure to include all the pertinent information.

The agency reserves the right to change this policy at any time.

About

Small frontend to help business owners calculate their break even point

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published