Перейти к файлу
dependabot[bot] 5c138e6176
Bump json5 from 1.0.1 to 1.0.2 in /react-app
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-07 12:23:55 +00:00
deploy cleaning up ARM template 2021-10-26 14:41:44 -05:00
graphql Merge pull request #17 from microsoft/dependabot/npm_and_yarn/graphql/node-fetch-2.6.7 2022-02-11 11:23:37 -06:00
react-app Bump json5 from 1.0.1 to 1.0.2 in /react-app 2023-01-07 12:23:55 +00:00
CODE_OF_CONDUCT.md CODE_OF_CONDUCT.md committed 2021-10-19 08:33:30 -07:00
LICENSE LICENSE committed 2021-10-19 08:33:31 -07:00
README.md updating url 2021-10-25 12:04:38 -05:00
SECURITY.md SECURITY.md committed 2021-10-19 08:33:31 -07:00
SUPPORT.md SUPPORT.md committed 2021-10-19 08:33:33 -07:00
staticwebapp.config.json Initial push 2021-10-19 10:58:34 -05:00

README.md

React / GraphQL / NoSQL Starter-Kit

Create a modern web app with modern middle ware, and a modern backend. For less than $1 / month you can run this app with:

  • A Custom Domain
  • SSL
  • Authentication

Jump to < 2 step quickstart>

Quickstart

Prereqs

Start Local

  1. Fork this repo
  2. Clone the repo
  3. Start the react app:
cd react-app
npm start
  1. Start the GraphQL Service
cd graphql
func start
  1. edit away! ([see detailed explanation of app](detailed description))

Transition to the Cloud

Run front end and graphql in the cloud (Free)

  1. Create a GitHub Personal Access Token
  2. Click: Deploy to Azure
  3. After completing the above, whenever you push to main your code will be auto-deployed to the cloud!

Run backend (nosql) in the cloud

  1. Follow this quickstart to create a Cosmos DB For low use, or just getting started a "serverless" Cosmos will be adequate and cost pennies per month.
  2. Once done copy the connection string for this Azure Cosmos DB
  3. Set up to use Cosmos DB from local dev: add connection string to graphql\local.settings.json ex:
{
  "IsEncrypted": false,
  "Values": {
    "cosmos":"<your connection string",
    "FUNCTIONS_WORKER_RUNTIME": "node",
    "AzureWebJobsStorage": "UseDevelopmentStorage=true"
  }
}
  1. Set up to use Cosmos DB from cloud: open your Azure Static Website in the Azure Portal and click on Configuration. Add an app setting named cosmos with a value of the connection string.

Scale up in the Cloud

  1. Add a custom domain to your static site
  2. Increase throughput of Azure Cosmos DB:
  3. Add additional indexes to Azure Cosmos DB:

Maturity Model

How It Starts

  • Develop 100% locally
  • Customize your front-end
  • Use a file "JSON backend"
  • Customize your GraphQL schema

How it matures

  • Setup Continuous Deployment
  • Host for free in the cloud (with SSL)
  • Continue using a file-based backend OR
  • Transition to a No-SQL backend

How it Ends

(optional)

  • Use a custom domain name
  • Scale cloud hosting to meet demand
  • Scale nosql to scale backend

Your app can then be scaled up to support

  • Thousands of users
  • Global distribution
  • Scaled up security
  • Additional backeds

This is a starter kit. It shows you how to create and deploy the basic platform. You'll need to adapt the a] to include your won code to solve your specific task. Depending on the complexity of your app, or use of other Azure service it might cost you more than $1 to run this app.

How to Use

You can run this app locally or in Azure. Typically you will need to do the following:

  1. Develop your own GraphQL Schmea
  2. Modify the React APP buisness logic.
  3. Modify the React APP UI/UX.
  4. Modify NoSQL index properties
  5. Modify NoSQL queries to reduce operations

What is this?

Detailed Description

React App

This is a Create React App with only Functional components. It uses:

  • Apollo Client: to execute graphql queiries and mutations
  • React Router: to select which component to render
  • React Bootsrap: as a UI Library

URL: http://localhost:3000

GraphQL

This app uses Apollo GraphQL server. Schmea from graphql/schema.js Datasources/HardcodedAPI.js or datasources/CosmosAPI.js. It selects Cosmos is local.settings.json or an app setting contains cosmos. Resolvers: are coded into index.js

CORS: by default the app also sends cors headers in non prod environments (so that localhost:3000 can access data)

Playground: Prod: DISABLED. Local: http://localhost:7071/api/graphql

NoSQL

If you have not setup CosmosDB yet then graphql\datasources\HardCodedAPI.js is used as a datasrouce At the top of the file is the const that defines the data.

Notes

  1. You'll need to index the 'posted' field in order to use the ORDER DESC
  2. How do I pull changes from the original repo into my repo?
git remote add upstream https://github.com/microsoft/react-graphql-nosql-starter-kit
git fetch upstream
git merge upstream/main main
git push

What do I do now?

Following all of the first two quick starts will get you a cloud based REACT a] with a graphql backend. Some suggestions on modifying the a]:

  1. Change to enother UI library or customize the bootstrap file
  2. Add new data and new queries to GraphQL
  3. Share your thoughts and what you create with the repo owners.
  4. Make suggestions on how to change this repo for the future.

Refernce Links

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.