2023-09-14 05:58:13 +03:00
|
|
|
This document explains how to start server (@affine/server) locally with Docker
|
|
|
|
|
2024-05-06 05:03:14 +03:00
|
|
|
> **Warning**:
|
|
|
|
>
|
|
|
|
> This document is not guaranteed to be up-to-date.
|
|
|
|
> If you find any outdated information, please feel free to open an issue or submit a PR.
|
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
## Run required dev services in docker compose
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 14:04:08 +03:00
|
|
|
```sh
|
2024-12-13 09:27:15 +03:00
|
|
|
cp ./.docker/dev/compose.yml.example ./.docker/dev/compose.yml
|
|
|
|
cp ./.docker/dev/.env.example ./.docker/dev/.env
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
docker compose -f ./.docker/dev/compose.yml up -d
|
2023-09-14 05:58:13 +03:00
|
|
|
```
|
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
## Build native packages (you need to setup rust toolchain first)
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 14:04:08 +03:00
|
|
|
```sh
|
2024-12-13 09:27:15 +03:00
|
|
|
# build native
|
|
|
|
yarn workspace @affine/server-native build
|
2023-09-14 05:58:13 +03:00
|
|
|
```
|
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
## Prepare dev environment
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 14:04:08 +03:00
|
|
|
```sh
|
2024-12-13 09:27:15 +03:00
|
|
|
cd packages/backend/server
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 14:04:08 +03:00
|
|
|
# uncomment all env variables here
|
2024-12-13 09:27:15 +03:00
|
|
|
cp .env.example .env
|
|
|
|
yarn prisma db push
|
|
|
|
yarn data-migration run
|
2023-09-14 05:58:13 +03:00
|
|
|
```
|
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
## Start server
|
2023-10-18 09:00:44 +03:00
|
|
|
|
2024-12-13 14:04:08 +03:00
|
|
|
```sh
|
2024-12-13 09:27:15 +03:00
|
|
|
yarn dev
|
2023-09-14 05:58:13 +03:00
|
|
|
```
|
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
when server started, it will created a default user for testing:
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
- email: dev@affine.pro
|
|
|
|
- name: Dev User
|
|
|
|
- password: dev
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
## Start frontend
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 14:04:08 +03:00
|
|
|
```sh
|
2024-12-13 09:27:15 +03:00
|
|
|
# at project root
|
|
|
|
yarn dev
|
2023-09-14 05:58:13 +03:00
|
|
|
```
|
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
## Done
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
Now you should be able to start developing affine with server enabled.
|
2024-10-14 13:18:59 +03:00
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
## Bonus
|
2024-10-14 13:18:59 +03:00
|
|
|
|
2024-12-13 09:27:15 +03:00
|
|
|
### Enable prisma studio (Database GUI)
|
2023-09-14 05:58:13 +03:00
|
|
|
|
2024-12-13 14:04:08 +03:00
|
|
|
```sh
|
2024-12-13 09:27:15 +03:00
|
|
|
# available at http://localhost:5555
|
|
|
|
yarn prisma studio
|
2023-09-14 05:58:13 +03:00
|
|
|
```
|