Files
immich/docs/docs/developer/setup.md

186 lines
6.6 KiB
Markdown
Raw Normal View History

---
sidebar_position: 2
---
# Setup
2022-11-03 22:26:09 -05:00
Edit and update of FAQ+new database GUI guide (#5958) * Update added and re -arrangement of FAQ * Erasure of addition mistakes * Erasure of addition mistakes * Fix broken links * Correcting spelling errors + adding more questions * New required fixes * More FAQ * Adding questions + adding a note about a directory and an explanation about adding a path in a Windows environment * Update docs/docs/FAQ/Albums-FAQ.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Update docs/docs/FAQ/Assets-FAQ.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Update docs/docs/FAQ/Machine-Learning-FAQ.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Update docs/docs/FAQ/Machine-Learning-FAQ.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Update docs/docs/features/libraries.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Corrections * chore: updates * import TOCinlines from all FAQ pages to one page + Corrections * Removing privacy information + adding required Flutter version information * Removing privacy information + adding required Flutter version information * Revert "Removing privacy information + adding required Flutter version information" This reverts commit da63439fd212b2ddd578fb6ca860f1a8bcd0bb45. * All in one page * Guide - Remove Offline Files * Guide - Remove Offline Files * doc: updates * chore: fix broken link * docs: clean up database gui guide --------- Co-authored-by: Alex <alex.tran1502@gmail.com> Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
2024-01-12 21:45:41 +02:00
:::note
If there's a feature you're planning to work on, just give us a heads up in [#contributing](https://discord.com/channels/979116623879368755/1071165397228855327) on [our Discord](https://discord.immich.app) so we can:
Edit and update of FAQ+new database GUI guide (#5958) * Update added and re -arrangement of FAQ * Erasure of addition mistakes * Erasure of addition mistakes * Fix broken links * Correcting spelling errors + adding more questions * New required fixes * More FAQ * Adding questions + adding a note about a directory and an explanation about adding a path in a Windows environment * Update docs/docs/FAQ/Albums-FAQ.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Update docs/docs/FAQ/Assets-FAQ.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Update docs/docs/FAQ/Machine-Learning-FAQ.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Update docs/docs/FAQ/Machine-Learning-FAQ.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Update docs/docs/features/libraries.md Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> * Corrections * chore: updates * import TOCinlines from all FAQ pages to one page + Corrections * Removing privacy information + adding required Flutter version information * Removing privacy information + adding required Flutter version information * Revert "Removing privacy information + adding required Flutter version information" This reverts commit da63439fd212b2ddd578fb6ca860f1a8bcd0bb45. * All in one page * Guide - Remove Offline Files * Guide - Remove Offline Files * doc: updates * chore: fix broken link * docs: clean up database gui guide --------- Co-authored-by: Alex <alex.tran1502@gmail.com> Co-authored-by: Mert <101130780+mertalev@users.noreply.github.com> Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
2024-01-12 21:45:41 +02:00
1. Let you know if it's something we would accept into Immich
2. Provide any guidance on how something like that would ideally be implemented
3. Ensure nobody is already working on that issue/feature so we don't duplicate effort
Thanks for being interested in contributing 😊
:::
## Environment
2022-11-03 22:26:09 -05:00
### Services
2022-11-03 22:26:09 -05:00
This environment includes the services below. Additional details are available in each service's README.
2022-11-03 22:26:09 -05:00
- Server - [`/server`](https://github.com/immich-app/immich/tree/main/server)
- Web app - [`/web`](https://github.com/immich-app/immich/tree/main/web)
- Machine learning - [`/machine-learning`](https://github.com/immich-app/immich/tree/main/machine-learning)
2022-11-03 22:26:09 -05:00
- Redis
- PostgreSQL development database with exposed port `5432` so you can use any database client to access it
2022-11-03 22:26:09 -05:00
All the services are packaged to run as with single Docker Compose command.
### Server and web apps
1. Clone the project repo.
2. Run `cp docker/example.env docker/.env`.
3. Edit `docker/.env` to provide values for the required variable `UPLOAD_LOCATION`.
4. From the root directory, run:
2022-11-03 22:26:09 -05:00
```bash title="Start development server"
make dev # required Makefile installed on the system.
```
2024-11-20 14:44:19 -05:00
5. Access the dev instance in your browser at http://localhost:3000, or connect via the mobile app.
2022-11-03 22:26:09 -05:00
All the services will be started with hot-reloading enabled for a quick feedback loop.
2024-11-20 14:44:19 -05:00
You can access the web from `http://your-machine-ip:3000` or `http://localhost:3000` and access the server from the mobile app at `http://your-machine-ip:3000/api`
2022-11-16 23:15:26 -06:00
**Notes:**
- The "web" development container runs with uid 1000. If that uid does not have read/write permissions on the mounted volumes, you may encounter errors
2024-01-21 14:32:01 -08:00
#### Connect web to a remote backend
If you only want to do web development connected to an existing, remote backend, follow these steps:
1. Build the Immich SDK - `cd open-api/typescript-sdk && pnpm i && pnpm run build && cd -`
2. Enter the web directory - `cd web/`
3. Install web dependencies - `pnpm i`
4. Start the web development server
```bash
IMMICH_SERVER_URL=https://demo.immich.app/ pnpm run dev
```
If you're using PowerShell on Windows you may need to set the env var separately like so:
```powershell
$env:IMMICH_SERVER_URL = "https://demo.immich.app/"
pnpm run dev
```
#### `@immich/ui`
To see local changes to `@immich/ui` in Immich, do the following:
1. Install `@immich/ui` as a sibling to `immich/`, for example `/home/user/immich` and `/home/user/ui`
2. Build the `@immich/ui` project via `pnpm run build`
3. Uncomment the corresponding volume in web service of the `docker/docker-compose.dev.yaml` file (`../../ui:/usr/ui`)
4. Uncomment the corresponding alias in the `web/vite.config.js` file (`'@immich/ui': path.resolve(\_\_dirname, '../../ui')`)
5. Uncomment the import statement in `web/src/app.css` file `@import '/usr/ui/dist/theme/default.css';` and comment out `@import '@immich/ui/theme/default.css';`
6. Start up the stack via `make dev`
7. After making changes in `@immich/ui`, rebuild it (`pnpm run build`)
### Mobile app
#### Setup
1. Setup Flutter toolchain using FVM.
2. Run `flutter pub get` to install the dependencies.
3. Run `make translation` to generate the translation file.
4. Run `fvm flutter run` to start the app.
#### Translation
To add a new translation text, enter the key-value pair in the `i18n/en.json` in the root of the immich project. Then, from the `mobile/` directory, run
```bash
make translation
```
The mobile app asks you what backend to connect to. You can utilize the demo backend (https://demo.immich.app/) if you don't need to change server code or upload photos. Alternatively, you can run the server yourself per the instructions above.
2022-11-03 22:26:09 -05:00
## IDE setup
### Lint / format extensions
Setting these in the IDE give a better developer experience, auto-formatting code on save, and providing instant feedback on lint issues.
2022-11-03 22:26:09 -05:00
2024-04-11 00:29:46 -07:00
### Dart Code Metrics
The mobile app uses DCM (Dart Code Metrics) for linting and metrics calculation. Please refer to the [Getting Started](https://dcm.dev/docs/) page for more information on setting up DCM
Note: Activating the license is not required.
2022-11-03 22:26:09 -05:00
### VSCode
Install `Flutter`, `DCM`, `Prettier`, `ESLint` and `Svelte` extensions. These extensions are listed in the `extensions.json` file under `.vscode/` and should appear as workspace recommendations.
2022-11-03 22:26:09 -05:00
Here are the settings we use, they should be active as workspace settings (`settings.json`):
2022-11-03 22:26:09 -05:00
```json title="settings.json"
{
"[css]": {
2022-11-03 22:26:09 -05:00
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
2022-11-03 22:26:09 -05:00
"editor.tabSize": 2
},
"[dart]": {
"editor.defaultFormatter": "Dart-Code.dart-code",
2022-11-03 22:26:09 -05:00
"editor.formatOnSave": true,
"editor.selectionHighlight": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.suggestSelection": "first",
"editor.tabCompletion": "onlySnippets",
"editor.wordBasedSuggestions": "off"
},
"[javascript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.removeUnusedImports": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2
},
"[jsonc]": {
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2
},
"[svelte]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.removeUnusedImports": "explicit"
},
"editor.defaultFormatter": "svelte.svelte-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2
},
"[typescript]": {
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.removeUnusedImports": "explicit"
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"editor.tabSize": 2
},
"cSpell.words": ["immich"],
"editor.formatOnSave": true,
"eslint.validate": ["javascript", "svelte"],
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.patterns": {
"*.dart": "${capture}.g.dart,${capture}.gr.dart,${capture}.drift.dart",
"*.ts": "${capture}.spec.ts,${capture}.mock.ts"
},
"svelte.enable-ts-plugin": true,
"typescript.preferences.importModuleSpecifier": "non-relative"
2022-11-03 22:26:09 -05:00
}
```