Skip to content

Commit

Permalink
Merge pull request #54 from Dushyantbha012/update-docs
Browse files Browse the repository at this point in the history
Closes #51 : Tauri App Build Documentation and Configuration
  • Loading branch information
Pranav0-0Aggarwal authored Nov 14, 2024
2 parents 9d784a8 + 6f53d98 commit 71144a0
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 40 deletions.
74 changes: 45 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ PictoPy is an advanced desktop gallery application that combines the power of Ta
## Architecture

### Frontend

- **Tauri**: Enables building the desktop application
- **React**: Used for creating the user interface
- **Rust**: Powers the backend, which the frontend communicates with through Tauri's API

### Backend (Python)

- **FastAPI**: Serves as the API framework
- **SQLite**: Database for storing metadata and embeddings
- **YOLO**: Used for object detection
Expand All @@ -18,6 +20,7 @@ PictoPy is an advanced desktop gallery application that combines the power of Ta
- **DBSCAN**: Performs clustering for face embeddings

### Backend (Rust via Tauri)

Handles file system operations and provides a secure bridge between the frontend and local system.

## Features
Expand All @@ -32,35 +35,37 @@ Handles file system operations and provides a secure bridge between the frontend

## Technical Stack

| Component | Technology |
| --------- | ---------- |
| Frontend | React |
| Desktop Framework | Tauri |
| Rust Backend | Rust |
| Python Backend | Python |
| Database | SQLite |
| Image Processing | OpenCV, ONNX Runtime |
| Object Detection | YOLOv8 |
| Face Recognition | FaceNet |
| API Framework | FastAPI |
| State Management | React Hooks |
| Styling | Tailwind CSS |
| Routing | React Router |
| UI Components | Radix UI |
| Build Tool | Vite |
| Type Checking | TypeScript |
| Component | Technology |
| ----------------- | -------------------- |
| Frontend | React |
| Desktop Framework | Tauri |
| Rust Backend | Rust |
| Python Backend | Python |
| Database | SQLite |
| Image Processing | OpenCV, ONNX Runtime |
| Object Detection | YOLOv8 |
| Face Recognition | FaceNet |
| API Framework | FastAPI |
| State Management | React Hooks |
| Styling | Tailwind CSS |
| Routing | React Router |
| UI Components | Radix UI |
| Build Tool | Vite |
| Type Checking | TypeScript |

## Setup

### Frontend Setup

#### Prerequisites

- Node.js (LTS version recommended)
- npm (comes with Node.js)
- Rust (latest stable version)
- Tauri CLI

#### Installation

1. Navigate to the frontend directory:
```bash
cd frontend
Expand All @@ -71,19 +76,39 @@ Handles file system operations and provides a secure bridge between the frontend
```

#### Running the Application

```bash
npm run tauri dev
```

#### Building for Production

Create Signing Keys for tauri using the command:

```bash
npm run tauri signer generate
```

Set the public key in tauri.conf.json as pubkey and private key and password in Enviroment Variables as TAURI_SIGNING_PRIVATE_KEY and TAURI_SIGNING_PRIVATE_KEY_PASSWORD

There is a preset pubkey in tauri.conf.json ; private key and password for it is:

```bash
TAURI_SIGNING_PRIVATE_KEY=dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg==
```

```bash
TAURI_SIGNING_PRIVATE_KEY_PASSWORD=pass
```

```bash
npm run tauri build
```

### Python Backend Setup

#### Installation Steps


1. **Navigate to the Backend Directory:** Open your terminal and use `cd` to change directories:

Bash
Expand All @@ -93,7 +118,6 @@ npm run tauri build

```


2. **Set Up a Virtual Environment (Highly Recommended):** Virtual environments isolate project dependencies. Create one using:

Bash
Expand All @@ -103,7 +127,6 @@ npm run tauri build

```


Activate it for Linux/macOS:

Bash
Expand All @@ -113,8 +136,6 @@ npm run tauri build

```



Activate it for Windows:

Bash
Expand All @@ -133,8 +154,6 @@ npm run tauri build

```



4. **Missing System Dependencies:** Some dependencies might need system-level libraries like `libGL.so.1` (often needed by OpenCV). Install the appropriate packages based on your distribution:

**Debian/Ubuntu:**
Expand All @@ -147,8 +166,6 @@ npm run tauri build

```



**Other Systems:** Consult your distribution's documentation for installation instructions.
5. **Permission Errors with `run.sh`:** If you encounter a "Permission denied" error when running `run.sh`, grant execute permissions:
Expand All @@ -160,8 +177,6 @@ npm run tauri build
```
6. **`gobject-2.0` Not Found Error:** Resolve this error by installing `libglib2.0-dev` (Debian/Ubuntu):
Bash
Expand All @@ -171,7 +186,6 @@ npm run tauri build
```
For other systems, consult your distribution's documentation.

**Running the Backend**
Expand Down Expand Up @@ -219,9 +233,11 @@ The server will start on `http://localhost:8000` by default. In test mode, the s
You can control the number of workers by setting the `WORKERS` environment variable before running the script. If not set, it defaults to 1 worker.
## Additional Resources
- [Tauri Documentation](https://tauri.app/v1/guides/)
- [React Documentation](https://reactjs.org/docs/getting-started.html)
- [FastAPI Documentation](https://fastapi.tiangolo.com/)
## Troubleshooting
If you encounter any issues, please check the respective documentation for Tauri, React, and FastAPI. For persistent problems, feel free to open an issue in the project repository.
31 changes: 25 additions & 6 deletions docs/frontend/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ For a comprehensive guide on prerequisites, refer to the [Tauri Prerequisites](h
## Setup Directory

!!! note "Base Directory"
All commands executed below are with respect to the `frontend/` directory
All commands executed below are with respect to the `frontend/` directory

### Installing Dependencies

1. Navigate to the frontend directory:

```bash
cd frontend
```
Expand All @@ -39,19 +40,38 @@ npm run tauri dev
```

This command will:

- Start the [Vite](https://vitejs.dev/) development server for the frontend
- Compile the Rust backend
- Launch the Tauri application window

For more details on Tauri commands, check the [Tauri CLI documentation](https://tauri.app/v1/api/cli).

!!! note "First Run"
The first run might take longer as it needs to compile the Rust code.
The first run might take longer as it needs to compile the Rust code.

## Building for Production

To create a production build of your Tauri application:

Create Signing Keys for tauri using the command:

```bash
npm run tauri signer generate
```

Set the public key in tauri.conf.json as pubkey and private key and password in Enviroment Variables as TAURI_SIGNING_PRIVATE_KEY and TAURI_SIGNING_PRIVATE_KEY_PASSWORD

There is a preset pubkey in tauri.conf.json ; private key and password for it is:

```bash
TAURI_SIGNING_PRIVATE_KEY=dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg==
```

```bash
TAURI_SIGNING_PRIVATE_KEY_PASSWORD=pass
```

```bash
npm run tauri build
```
Expand All @@ -75,9 +95,8 @@ For more detailed troubleshooting, refer to the [Tauri Troubleshooting Guide](ht
- [Tauri Documentation](https://tauri.app/v1/guides/)
- [Vite Documentation](https://vitejs.dev/guide/)
- [React Documentation](https://reactjs.org/docs/getting-started.html)
- [TypeScript Documentation](https://www.typescriptlang.org/docs/)
- [Rust Book](https://doc.rust-lang.org/book/)
- [React Documentation](https://reactjs.org/docs/getting-started.html)
- [TypeScript Documentation](https://www.typescriptlang.org/docs/)
- [Rust Book](https://doc.rust-lang.org/book/)
By following these steps, you should have your Tauri frontend environment set up and ready for development. Remember to run `npm run tauri dev` to start your development environment.
15 changes: 10 additions & 5 deletions frontend/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@
},
"productName": "tauri-app",
"version": "0.0.0",
"identifier": "com.tauri.dev",
"plugins": {},
"identifier": "com.yourcompany.pictopy",
"plugins": {
"updater": {
"active": true,
"endpoints": ["https://server.com//api/v1/tauri/update"],
"dialog": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEI3ODc5QjNDMERGMzlCMUEKUldRYW0vTU5QSnVIdHplYktOV3hKKzdmSGd6ZVN3eTg4Q2ExbmVTbk4yN0pMWjZLYXl1M1ZzN3AK"
}
},
"app": {
"windows": [
{
Expand All @@ -33,9 +40,7 @@
],
"security": {
"assetProtocol": {
"scope": [
"**"
],
"scope": ["**"],
"enable": true
},
"csp": null
Expand Down

0 comments on commit 71144a0

Please sign in to comment.