Update documentation, add GraphiQL to docs (#175)
* Update docusaurus and fix security vulnerabilities * Begin cleanup docs * Remove redocusaurus * Add graphiql in doc * Add architecture schema * New tableIcons and cleanup docs
This commit is contained in:
11
.vscode/settings.json
vendored
11
.vscode/settings.json
vendored
@ -22,5 +22,14 @@
|
|||||||
"editor.formatOnSave": true
|
"editor.formatOnSave": true
|
||||||
},
|
},
|
||||||
"javascript.format.enable": false,
|
"javascript.format.enable": false,
|
||||||
"typescript.format.enable": false
|
"typescript.format.enable": false,
|
||||||
|
"cSpell.enableFiletypes": [
|
||||||
|
"!javascript",
|
||||||
|
"!json",
|
||||||
|
"md",
|
||||||
|
"mdx"
|
||||||
|
],
|
||||||
|
"cSpell.words": [
|
||||||
|
"twentyhq"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@ -1 +0,0 @@
|
|||||||
# Data layer
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"label": "Data layer",
|
|
||||||
"position": 3
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# Connecting to data sources
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# Mapping entities
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# Caching and optimization
|
|
||||||
@ -1 +1,19 @@
|
|||||||
|
---
|
||||||
|
sidebar_custom_props:
|
||||||
|
icon: TbApps
|
||||||
|
---
|
||||||
|
|
||||||
# Architecture
|
# Architecture
|
||||||
|
|
||||||
|
|
||||||
|
import ThemedImage from '@theme/ThemedImage';
|
||||||
|
|
||||||
|
<ThemedImage
|
||||||
|
alt="Docusaurus themed image"
|
||||||
|
sources={{
|
||||||
|
light: '/img/architecture.png',
|
||||||
|
dark: '/img/architecture-dark.png',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
# Core entities
|
|
||||||
21
docs/docs/dev-docs/development/workflows.mdx
Normal file
21
docs/docs/dev-docs/development/workflows.mdx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
sidebar_custom_props:
|
||||||
|
icon: TbTopologyStar
|
||||||
|
---
|
||||||
|
# Workflows
|
||||||
|
|
||||||
|
The following steps assume that you have installed and configure the project with Docker.
|
||||||
|
|
||||||
|
## IDE Setup
|
||||||
|
|
||||||
|
If you are using VSCode, please use the `Dev Containers` extension to open the project in a container. This will allow you to run Visual Studio on top of the docker container. This will allow you to run the project without having to install node on your machine.
|
||||||
|
|
||||||
|
## Front tests
|
||||||
|
|
||||||
|
Run tests: `make front-test`
|
||||||
|
Run coverage: `make front-coverage`
|
||||||
|
Run storybook: `make front-storybook`
|
||||||
|
|
||||||
|
## Note
|
||||||
|
|
||||||
|
If you are using Docker install, make sure to ssh in the docker container during development to execute commands. You can also use `Makefile` to help you
|
||||||
@ -1 +1,9 @@
|
|||||||
|
---
|
||||||
|
sidebar_custom_props:
|
||||||
|
icon: TbCloud
|
||||||
|
---
|
||||||
|
|
||||||
# Cloud setup
|
# Cloud setup
|
||||||
|
|
||||||
|
The easiest way to quickly try the app is to signup on [app.twenty.com](https://app.twenty.com).
|
||||||
|
Signup is free
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
# Documentation
|
||||||
|
|
||||||
|
The stack is composed of 3 different layers:
|
||||||
|
|
||||||
|
import ThemedImage from '@theme/ThemedImage';
|
||||||
|
|
||||||
|
<ThemedImage
|
||||||
|
alt="Docusaurus themed image"
|
||||||
|
sources={{
|
||||||
|
light: '/img/architecture.png',
|
||||||
|
dark: '/img/architecture-dark.png',
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
|
||||||
|
|||||||
@ -1,44 +1,54 @@
|
|||||||
---
|
---
|
||||||
sidebar_position: 0
|
sidebar_position: 0
|
||||||
slug: '/'
|
slug: '/'
|
||||||
|
sidebar_custom_props:
|
||||||
|
icon: TbBolt
|
||||||
---
|
---
|
||||||
|
|
||||||
# Twenty
|
# Local Setup
|
||||||
|
|
||||||
Welcome to Twenty documentation!
|
## Quickstart CLI
|
||||||
|
|
||||||
## High Level Overview
|
We built a CLI to guide you through the different options.
|
||||||
|
|
||||||
Twenty development stack is composed of 3 different layers
|
If you prefer to have more control and do things manually, go through the Docker section below.
|
||||||
|
Otherwise run the following command to get started:
|
||||||
|
```
|
||||||
|
npx twenty-cli
|
||||||
|
```
|
||||||
|
|
||||||
- front: our frontend React app
|
|
||||||
- server: our backend that contain endpoint, crm logic, scripts, jobs...
|
|
||||||
- storages: postgres
|
|
||||||
|
|
||||||
## Setup env variables
|
## Docker
|
||||||
|
|
||||||
|
### 1. Pre-requisites
|
||||||
|
|
||||||
|
Make sure to have the latest Docker and Docker-compose versions installed on your computer.
|
||||||
|
|
||||||
|
You can run `docker-compose --version` and `docker --version` to check they are installed.
|
||||||
|
|
||||||
|
### 2. Git clone
|
||||||
|
`git clone git@github.com:twentyhq/twenty.git`
|
||||||
|
|
||||||
|
### 3. Setup env variables
|
||||||
|
|
||||||
`cp ./infra/dev/.env.example ./infra/dev/.env` and fill with values
|
`cp ./infra/dev/.env.example ./infra/dev/.env` and fill with values
|
||||||
|
|
||||||
## Development environment setup with docker-compose (Recommended)
|
### 4. Build
|
||||||
|
|
||||||
We also provide a containerized environment with Docker and orchestrated with docker-compose in case it is easier for you. This install will also provision a postgres container out of the box.
|
We provide a containerized environment with Docker and orchestrated with docker-compose.
|
||||||
|
This install will also provision a postgres container out of the box.
|
||||||
|
|
||||||
### Step 1: pre-requesites
|
The configuration is stored `infra/dev` folder.
|
||||||
|
|
||||||
Make sure to have the latest Docker and Docker-compose versions installed on your computer. You can run `docker-compose --version` to check if you have docker-compose installed and `docker --version` to check if you have docker installed.
|
|
||||||
|
|
||||||
### Step 2: docker build
|
|
||||||
|
|
||||||
Build docker containers.
|
|
||||||
|
|
||||||
The whole setup experience is happening in `infra/dev` folder. Make sure to be in this folder:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cd infra/dev
|
cd infra/dev
|
||||||
|
make build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 5. Start
|
||||||
|
|
||||||
|
Always in the `infra/dev` folder:
|
||||||
```
|
```
|
||||||
make build
|
|
||||||
make up
|
make up
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -48,18 +58,35 @@ Once this is completed you should have:
|
|||||||
- server available on: http://localhost:3000/health
|
- server available on: http://localhost:3000/health
|
||||||
- postgres: available on http://localhost:5432 that should contain `twenty` database
|
- postgres: available on http://localhost:5432 that should contain `twenty` database
|
||||||
|
|
||||||
### Step 3: IDE setup
|
|
||||||
|
|
||||||
If you are using VSCode, please use the `Dev Containers` extension to open the project in a container. This will allow you to run Visual Studio on top of the docker container. This will allow you to run the project without having to install node on your machine.
|
## 6. Development
|
||||||
|
|
||||||
### Note
|
Documented [here](/development/workflows.md)
|
||||||
|
|
||||||
If you are using Docker install, make sure to ssh in the docker container during development to execute commands. You can also use `Makefile` to help you
|
## Without Docker (Not recommended)
|
||||||
|
|
||||||
## Development workflow
|
While Docker is the recommended way to run Twenty, you might want to keep a light install.
|
||||||
|
|
||||||
### Front tests
|
### 1. Pre-requisites
|
||||||
|
You need to have git, node and npm install on your computer.
|
||||||
|
You also need to bring your own Postgres database.
|
||||||
|
|
||||||
Run tests: `make front-test`
|
### 2. Git clone
|
||||||
Run coverage: `make front-coverage`
|
`git clone git@github.com:twentyhq/twenty.git`
|
||||||
Run storybook: `make front-storybook`
|
|
||||||
|
### 3. Setup env variables
|
||||||
|
|
||||||
|
`cp ./infra/dev/.env.example ./infra/dev/.env` and fill with values
|
||||||
|
|
||||||
|
### 4. Build
|
||||||
|
```
|
||||||
|
cd front
|
||||||
|
npm run
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. Start
|
||||||
|
|
||||||
|
```
|
||||||
|
cd front
|
||||||
|
npm run
|
||||||
|
```
|
||||||
|
|||||||
@ -1 +1,8 @@
|
|||||||
|
---
|
||||||
|
sidebar_custom_props:
|
||||||
|
icon: TbServer
|
||||||
|
---
|
||||||
# Self hosting
|
# Self hosting
|
||||||
|
|
||||||
|
We will soon be working on options to make it easy to self host the app (click-to-deploy buttons for Heroku, Railway...).
|
||||||
|
Contributions are welcome!
|
||||||
@ -1 +0,0 @@
|
|||||||
# Modules
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"label": "Modules",
|
|
||||||
"position": 4
|
|
||||||
}
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# Analytics
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# Sales
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# Third party
|
|
||||||
@ -1 +0,0 @@
|
|||||||
# Upcoming
|
|
||||||
@ -1,5 +1,6 @@
|
|||||||
---
|
---
|
||||||
sidebar_class_name: coming-soon
|
sidebar_class_name: coming-soon
|
||||||
sidebar_custom_props:
|
sidebar_custom_props:
|
||||||
icon: terminal
|
icon: TbTerminal2
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_class_name: coming-soon
|
|
||||||
---
|
|
||||||
|
|
||||||
# SDKs
|
|
||||||
@ -1,8 +1,11 @@
|
|||||||
---
|
---
|
||||||
sidebar_class_name: coming-soon
|
sidebar_class_name: coming-soon
|
||||||
|
sidebar_custom_props:
|
||||||
|
icon: TbChartDots
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Data collected
|
# Data collected
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
# Troubleshotting
|
---
|
||||||
|
sidebar_custom_props:
|
||||||
## Common issues and solutions
|
icon: TbBug
|
||||||
...
|
---
|
||||||
|
# Troubleshooting
|
||||||
|
|
||||||
## Reporting bugs
|
## Reporting bugs
|
||||||
...
|
Please create an issue on Github: [https://github.com/twentyhq/twenty/issues/new](https://github.com/twentyhq/twenty/issues/new)
|
||||||
@ -1,5 +0,0 @@
|
|||||||
---
|
|
||||||
sidebar_class_name: coming-soon
|
|
||||||
---
|
|
||||||
|
|
||||||
# Upgrade guide
|
|
||||||
@ -20,16 +20,7 @@ const config = {
|
|||||||
onBrokenLinks: 'throw',
|
onBrokenLinks: 'throw',
|
||||||
onBrokenMarkdownLinks: 'warn',
|
onBrokenMarkdownLinks: 'warn',
|
||||||
|
|
||||||
headTags: [
|
headTags: [],
|
||||||
{
|
|
||||||
tagName: 'link',
|
|
||||||
attributes: {
|
|
||||||
rel: 'stylesheet',
|
|
||||||
href: 'https://kit.fontawesome.com/c4eca3d765.css',
|
|
||||||
crossorigin: 'anonymous'
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
// Even if you don't use internalization, you can use this field to set useful
|
// Even if you don't use internalization, you can use this field to set useful
|
||||||
// metadata like html lang. For example, if your site is Chinese, you may want
|
// metadata like html lang. For example, if your site is Chinese, you may want
|
||||||
@ -56,23 +47,6 @@ const config = {
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'redocusaurus',
|
|
||||||
{
|
|
||||||
// Plugin Options for loading OpenAPI files
|
|
||||||
specs: [
|
|
||||||
{
|
|
||||||
spec: 'docs/open-api/openapi.yaml',
|
|
||||||
route: '/api/',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
// Theme Options for modifying how redoc renders them
|
|
||||||
theme: {
|
|
||||||
// Change with your site colors
|
|
||||||
primaryColor: '#1890ff',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -106,8 +80,8 @@ const config = {
|
|||||||
label: 'User guide',
|
label: 'User guide',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
to: '/api/',
|
to: '/graphql/',
|
||||||
label: 'API',
|
label: 'GraphQL Playground',
|
||||||
position: 'right'
|
position: 'right'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
2471
docs/package-lock.json
generated
2471
docs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -15,20 +15,26 @@
|
|||||||
"typecheck": "tsc"
|
"typecheck": "tsc"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@docusaurus/core": "2.4.0",
|
"@docusaurus/core": "^2.4.1",
|
||||||
"@docusaurus/preset-classic": "2.4.0",
|
"@docusaurus/preset-classic": "^2.4.1",
|
||||||
"@mdx-js/react": "^1.6.22",
|
"@mdx-js/react": "^1.6.22",
|
||||||
"clsx": "^1.2.1",
|
"clsx": "^1.2.1",
|
||||||
|
"graphiql": "^2.4.7",
|
||||||
|
"graphql": "^16.6.0",
|
||||||
"prism-react-renderer": "^1.3.5",
|
"prism-react-renderer": "^1.3.5",
|
||||||
"react": "^17.0.2",
|
"react": "^17.0.2",
|
||||||
"react-dom": "^17.0.2",
|
"react-dom": "^17.0.2",
|
||||||
"redocusaurus": "^1.6.2"
|
"react-icons": "^4.9.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@docusaurus/module-type-aliases": "2.4.0",
|
"@docusaurus/module-type-aliases": "^2.4.1",
|
||||||
"@tsconfig/docusaurus": "^1.0.5",
|
"@tsconfig/docusaurus": "^1.0.5",
|
||||||
"typescript": "^4.7.4"
|
"typescript": "^4.7.4"
|
||||||
},
|
},
|
||||||
|
"overrides": {
|
||||||
|
"trim": "^0.0.3",
|
||||||
|
"got": "^11.8.5"
|
||||||
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [
|
||||||
">0.5%",
|
">0.5%",
|
||||||
|
|||||||
@ -97,9 +97,9 @@ li.coming-soon {
|
|||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
li.coming-soon a {
|
li.coming-soon a {
|
||||||
display: inline-block;
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
@ -127,5 +127,16 @@ li.coming-soon a::after {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-item-icon {
|
.sidebar-item-icon {
|
||||||
|
display: flex;
|
||||||
|
vertical-align: center;
|
||||||
padding-right: 0.5rem;
|
padding-right: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-and-text {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.fullHeightPlayground {
|
||||||
|
height: calc(100vh - var(--ifm-navbar-height));
|
||||||
|
}
|
||||||
19
docs/src/pages/graphql.js
Normal file
19
docs/src/pages/graphql.js
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { createGraphiQLFetcher } from '@graphiql/toolkit';
|
||||||
|
import { GraphiQL } from 'graphiql';
|
||||||
|
import React from 'react';
|
||||||
|
import ReactDOM from 'react-dom';
|
||||||
|
import Layout from '@theme/Layout';
|
||||||
|
|
||||||
|
import 'graphiql/graphiql.css';
|
||||||
|
|
||||||
|
const fetcher = createGraphiQLFetcher({ url: 'https://api.twenty.com/graphql' });
|
||||||
|
|
||||||
|
export default function graphQL() {
|
||||||
|
return (
|
||||||
|
<Layout title="Hello" description="Hello React Page">
|
||||||
|
<div class="fullHeightPlayground">
|
||||||
|
<GraphiQL fetcher={fetcher} />
|
||||||
|
</div>
|
||||||
|
</Layout>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -6,6 +6,9 @@ import Link from '@docusaurus/Link';
|
|||||||
import isInternalUrl from '@docusaurus/isInternalUrl';
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
||||||
import IconExternalLink from '@theme/Icon/ExternalLink';
|
import IconExternalLink from '@theme/Icon/ExternalLink';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
import { TbFaceIdError, TbTerminal2, TbCloud, TbServer, TbBolt, TbApps, TbTopologyStar, TbChartDots, TbBug } from "react-icons/tb";
|
||||||
|
|
||||||
|
|
||||||
export default function DocSidebarItemLink({
|
export default function DocSidebarItemLink({
|
||||||
item,
|
item,
|
||||||
onItemClick,
|
onItemClick,
|
||||||
@ -17,6 +20,18 @@ export default function DocSidebarItemLink({
|
|||||||
const {href, label, className, autoAddBaseUrl, customProps = {}} = item;
|
const {href, label, className, autoAddBaseUrl, customProps = {}} = item;
|
||||||
const isActive = isActiveSidebarItem(item, activePath);
|
const isActive = isActiveSidebarItem(item, activePath);
|
||||||
const isInternalLink = isInternalUrl(href);
|
const isInternalLink = isInternalUrl(href);
|
||||||
|
let icons = {
|
||||||
|
'TbTerminal2': TbTerminal2,
|
||||||
|
'TbCloud': TbCloud,
|
||||||
|
'TbServer': TbServer,
|
||||||
|
'TbBolt': TbBolt,
|
||||||
|
'TbApps': TbApps,
|
||||||
|
'TbTopologyStar': TbTopologyStar,
|
||||||
|
'TbChartDots': TbChartDots,
|
||||||
|
'TbBug': TbBug,
|
||||||
|
};
|
||||||
|
|
||||||
|
let IconComponent = customProps && customProps.icon ? icons[customProps.icon] : TbFaceIdError;
|
||||||
return (
|
return (
|
||||||
<li
|
<li
|
||||||
className={clsx(
|
className={clsx(
|
||||||
@ -41,8 +56,12 @@ export default function DocSidebarItemLink({
|
|||||||
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
onClick: onItemClick ? () => onItemClick(item) : undefined,
|
||||||
})}
|
})}
|
||||||
{...props}>
|
{...props}>
|
||||||
<i className={"sidebar-item-icon fa-light " + (customProps && customProps.icon ? ("fa-"+customProps.icon) : "fa-notdef")}></i>
|
<span className="icon-and-text">
|
||||||
|
<i className="sidebar-item-icon">
|
||||||
|
<IconComponent />
|
||||||
|
</i>
|
||||||
{label}
|
{label}
|
||||||
|
</span>
|
||||||
{!isInternalLink && <IconExternalLink />}
|
{!isInternalLink && <IconExternalLink />}
|
||||||
</Link>
|
</Link>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
BIN
docs/static/img/architecture-dark.png
vendored
Normal file
BIN
docs/static/img/architecture-dark.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 137 KiB |
BIN
docs/static/img/architecture.png
vendored
Normal file
BIN
docs/static/img/architecture.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 128 KiB |
Reference in New Issue
Block a user