Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fullstack with Oauth example for Monday code #135

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions apps/monday-code-fullstack-example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Build files
build/
code.tar.gz
# ignore builds in the format of build.zip and build <number>.zip
build*.zip

# Git ignore

# Node modules
node_modules
node_modules/*
node_modules/

# Build files
dist

# IDE files
.vscode
.idea

# Logs
logs

# OS files
.DS_Store
Thumbs.db

# Environment files
.env

# package-lock.json
package-lock.json
1 change: 1 addition & 0 deletions apps/monday-code-fullstack-example/.mappsignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
client/node_modules
5 changes: 5 additions & 0 deletions apps/monday-code-fullstack-example/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"semi": true,
"singleQuote": true,
"trailingComma": "es5"
}
91 changes: 91 additions & 0 deletions apps/monday-code-fullstack-example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# MondayBaseAppTS

MondayBaseAppTS is a TypeScript-based back end application designed to jumpstart a fullstack applicartion with OAuth. The front end is fully unopinionated.
Note: Deploy to Monday code first to get your live URL.
The live URL is returned from the BE, where it looks it up in the env manager.

Make sure the following environment variables are added to Monday:

1. `CLIENT_ID`
2. `LIVE_URL`

Make sure these secrets are added to Monday:

1. `CLIENT_SECRET`
2. `MONDAY_SIGNING_SECRET`

The OAuth URL is the same as the LIVE_URL and is the live URL you will find after pushing to monday code. EX:
`https://live1-service-222423429-b13e332373.us.monday.app`

Redirect URL to put in OAuth
`https://live1-service-222423429-b13e332373.us.monday.app/oauth/callback`

## Installation

To install the app, follow these steps:

1. Clone the repository

2. Navigate to the project directory:
```bash
cd MondayBaseAppTS
```
3. Install dependencies:

```bash
npm install
```

4. Install FE dependencies:
```bash
cd client npm install
```

## Usage

To start the application, run:

```bash
npm start
```

To deploy the code from the <b>root</b> run:

```bash
npm run deploy
```

First run will take 10-20 minutes.

Then go to the Monday code tab -- and enter the mentioned env varaibles and secrets.

The Live URL will need the app to be promoted to live 1x and then it takes a minute to show up.

Add oauth live url:
Redirect URL to put in OAuth
`https://live1-service-222423429-b13e332373.us.monday.app/oauth/callback`

Make a new version of the app in the dashboard.

Then to add your FE go to features, add a board view using the nothing template. Change the name. Click add build change the route to /view. Save it.

Promote to live.

Go to install under manage -- click install app.

Then add your board view into a board to test and you now have a base app!

## Notes

Anything run from the FE client should go through the clientAuth middleware and have the accountId, userId, etc take from the token.
Anything coming from a monday board should be run through the authorizationMiddleware and things should be taken from the token.
Passing in accountIds, userIds and not having them go through auth middleware is extremely dangerous.

When the app is uninstalled, the secure storage token is deleted. You need to delete all stored user data when it is removed.

Since the app needs to compile the BE and FE to be updated when you run npm run dev:backend it compiles the BE and FE before serving the URL.

Reasons for failures -- your mapps version is out of date!
The api version has updated and you need to move to the newest version.

If you set an env variable like `ENVIRONMENT` to "development" to expose additional endpoints, you will need to make a new version in Monday Code annd push a build to remove the variable.
14 changes: 14 additions & 0 deletions apps/monday-code-fullstack-example/app-manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '1.0.0'
app:
name: Fullstack Node App Template
features:
- type: AppFeatureBoardView
name: Hello Board
build:
source: customUrl
suffix: "/view"
- type: AppFeatureIntegration
name: Hello Integration
build:
source: customUrl
suffix: "/api/monday"
23 changes: 23 additions & 0 deletions apps/monday-code-fullstack-example/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Overview
This is the "Quickstart React" example Monday app.
<br>It can be used as a board view, item view or any other view, connected to a board and render data from the board using settings.



## Run the project

In the project directory, you should run:


```bash
npm install
```

And then to run an application with the monday tunnel, run:


```bash
npm run dev
```

Open [http://localhost:8301](http://localhost:8301) to view it in the browser.
42 changes: 42 additions & 0 deletions apps/monday-code-fullstack-example/client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"name": "monday-react-quickstart-app",
"version": "0.0.1",
"private": true,
"scripts": {
"prebuild": "npm install",
"build": "react-scripts build",
"start": "react-scripts start",
"dev": "react-scripts build && react-scripts start",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"dependencies": {
"monday-sdk-js": "^0.5.0",
"monday-ui-react-core": "^1.134.1",
"vibe": "^0.9.4"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"concurrently": "^5.2.0",
"cross-port-killer": "^1.2.1",
"eslint-config-react-app": "^7.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "^5.0.1",
"sass": "^1.54.8"
}
}
Binary file not shown.
43 changes: 43 additions & 0 deletions apps/monday-code-fullstack-example/client/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/monday.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/monday.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.

Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React Monday App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.

You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.

To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
15 changes: 15 additions & 0 deletions apps/monday-code-fullstack-example/client/public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "monday.png",
"type": "image/png",
"sizes": "600x600"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions apps/monday-code-fullstack-example/client/public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
44 changes: 44 additions & 0 deletions apps/monday-code-fullstack-example/client/src/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
body {
margin: 0;
font-family: "Roboto", sans-serif;
}

.App {
height: 100vh;
width: 100vw;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;

}

.groupSortForm {
background-color: #F5F5F5;
padding: 16px;
border-radius: 8px;
height: fit-content;
width: 250px;
display: flex;
flex-direction: column;
gap: 10px;
}

.errorDisplayForm {
width: 400px;
max-height: 250px;
overflow-y: scroll;
}

.errorDisplayToast {
width: 250px;
}

.fullWidth {
width: 100%;
}

.flexHorizontal {
display: flex;
gap: 10px;
}
Loading