2023-01-27 14:12:04 +03:00
# Twenty
2022-12-01 17:58:08 +03:00
2023-01-27 14:12:04 +03:00
Welcome to Twenty documentation!
2022-12-01 17:58:08 +03:00
2023-01-27 14:12:04 +03:00
## High Level Overview
2022-12-01 17:58:08 +03:00
2023-03-06 18:15:46 +03:00
Twenty development stack is composed of 3 different layers
2023-04-18 16:37:05 +03:00
2023-03-06 18:15:46 +03:00
- front: our frontend React app
2023-04-13 19:12:33 +03:00
- hasura: our graphql engine exposing our database and server
2023-03-06 18:15:46 +03:00
- server: our backend that contain endpoint, crm logic, scripts, jobs...
- storages: postgres
2023-01-27 14:12:04 +03:00
2023-04-18 16:34:08 +03:00
## Setup env variables and npmrc variables
2023-04-05 16:01:20 +03:00
2023-04-18 16:34:08 +03:00
1. `cp ./front/.env.example ./front/.env` and fill with values
2. `cp ./front/.npmrc.example ./front/.npmrc` and fill with values
2023-04-05 16:01:20 +03:00
## Development environment setup with docker-compose (Recommended)
2023-03-06 18:15:46 +03:00
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.
2023-01-27 14:12:04 +03:00
### Step 1: pre-requesites
2023-04-18 16:37:05 +03:00
2023-04-05 16:01:20 +03:00
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.
2023-01-27 14:12:04 +03:00
### Step 2: docker build
2023-04-18 16:37:05 +03:00
2023-01-27 14:12:04 +03:00
Build docker containers.
2023-01-31 21:20:59 +03:00
The whole setup experience is happening in `infra/dev` folder. Make sure to be in this folder:
2023-04-18 16:37:05 +03:00
2023-01-27 14:12:04 +03:00
```
cd infra/dev
```
```
2023-04-13 19:12:33 +03:00
make build
2023-01-27 14:12:04 +03:00
```
Once this is completed you should have:
2023-04-18 16:37:05 +03:00
2023-03-06 18:15:46 +03:00
- front available on: http://localhost:3001
2023-04-12 16:08:27 +03:00
- hasura available on: http://localhost:8080
2023-03-06 18:15:46 +03:00
- server available on: http://localhost:3000/health
- postgres: available on http://localhost:5432 that should contain `twenty` database
2023-01-27 14:12:04 +03:00
2023-04-09 17:43:43 +03:00
### Step 3: IDE setup
2023-04-18 16:37:05 +03:00
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.
2023-04-09 17:43:43 +03:00
2023-03-06 18:15:46 +03:00
### Note
2022-12-01 17:58:08 +03:00
2023-03-06 18:15:46 +03:00
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
2022-12-28 23:19:12 +03:00
2023-04-13 19:12:33 +03:00
## Development workflow
2022-12-01 17:58:08 +03:00
2023-04-13 19:12:33 +03:00
### Front tests
2023-01-27 14:12:04 +03:00
2023-04-13 19:12:33 +03:00
Run tests: `make front-test`
Run coverage: `make front-coverage`
Run storybook: `make front-storybook`
2023-03-06 18:15:46 +03:00
2023-04-13 19:12:33 +03:00
### Hasura development
2023-01-27 14:12:04 +03:00
2023-04-13 19:12:33 +03:00
Open hasura console: `make hasura-console`
Do your changes in hasura console on http://localhost:9695
Commit your changes in git