Skip to content

Commit

Permalink
0.2.4 Readme, some tooling for lower level of abstraction - tauri, sq…
Browse files Browse the repository at this point in the history
…lite wasm module itself
  • Loading branch information
Сидоркин Олег Валентинович authored and Сидоркин Олег Валентинович committed Sep 26, 2024
1 parent 22dece2 commit 2a77bf7
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 413 deletions.
6 changes: 6 additions & 0 deletions .sauced.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
attribution:
contact_email:
- [email protected]
workmail:
- [email protected]
attribution-fallback: []
42 changes: 38 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
# Electron app for audio memos and privately typed thoughts storage
# Architecture Overview of Wordly-X

OPFS, @sqlite.org/sqlite-wasm
Wordly-X is an Electron-based application designed for recording audio memos and storing typed thoughts privately. It leverages modern web and desktop technologies to provide a seamless user experience for daily journaling and audio recording. The application is built using Vite for bundling, TailwindCSS for styling, and it integrates SQLite for data persistence through WebAssembly.

1-Day - 500 words
### Key Components

contribute with issues, please.
1. **Electron Integration (`vite.config.js` and `electron/main.mjs`)**:
- The Electron integration is configured in `vite.config.js` using the `vite-plugin-electron/simple`. This setup specifies the entry point for the Electron main process.
- The main Electron process script (`electron/main.mjs`) is responsible for initializing the Electron app, creating windows, and handling inter-process communication.

2. **Frontend (`index.html` and `src/main.mjs`)**:
- `index.html` serves as the entry point for the UI, setting up the basic HTML structure and including references to the main JavaScript module.
- `src/main.mjs` is the central module for UI logic, handling interactions, and rendering dynamic content based on user actions and data updates.

3. **Database Management (`src/DB.mjs`)**:
- This module abstracts all interactions with the SQLite database. It initializes the database, defines schema, and provides methods for CRUD operations on diary entries and audio files.
- It uses `@sqlite.org/sqlite-wasm` for SQLite interactions, allowing the database operations to be performed within a browser environment through WebAssembly.

4. **Utility Modules**:
- `src/date-utils.mjs`: Contains helper functions for date manipulation and formatting specific to the application's needs.
- `src/getWordCount.mjs`: Provides a utility to count words in a given text, used for tracking the length of diary entries.

5. **Audio Recording (`src/Recorder.mjs`)**:
- Handles audio recording functionality using the MediaRecorder API.
- Manages audio data, saving recordings as files, and updating the UI to reflect new audio clips.

6. **Styling (`src/style.css`, `tailwind.config.js`, and `postcss.config.js`)**:
- `src/style.css` contains custom styles and utilities that extend the TailwindCSS framework.
- Configuration for TailwindCSS is defined in `tailwind.config.js`, specifying the content sources for Tailwind's JIT engine.
- `postcss.config.js` sets up PostCSS plugins used in the build process, including TailwindCSS and autoprefixer for CSS compatibility.

### Architectural Invariants

- **Client-Side Database**: The application's data is managed client-side using SQLite compiled to WebAssembly, ensuring all data remains local and private.
- **Separation of Concerns**: UI rendering, business logic, and database management are distinctly separated into different modules, promoting maintainability and scalability.
- **No External API Dependencies**: All functionalities are implemented using local resources and libraries without reliance on external APIs, enhancing privacy and offline capabilities.

### Boundaries and Interfaces

- **Electron and Renderer Process**: The communication between Electron's main process and renderer process is minimal, constrained to essential window management and IPC.
- **UI and Database**: The UI components interact with the database strictly through the `DB` class interface, ensuring any database schema changes do not directly impact UI components.
1 change: 1 addition & 0 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function createWindow() {
shell.openExternal(`x-apple.systempreferences:com.apple.preference.security?Privacy_microphone`);
}

// @ts-ignore
win.webContents.session.webRequest.onHeadersReceived((details, callback) => {
details.responseHeaders!['Cross-Origin-Opener-Policy'] = ['same-origin'];
details.responseHeaders!['Cross-Origin-Embedder-Policy'] = ['require-corp'];
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wordly-x",
"private": true,
"version": "0.1.3",
"version": "0.2.4",
"type": "module",
"scripts": {
"dev": "vite",
Expand All @@ -22,6 +22,9 @@
"packageManager": "[email protected]+sha512.91d93b445d9284e7ed52931369bc89a663414e5582d00eea45c67ddc459a2582919eece27c412d6ffd1bd0793ff35399381cb229326b961798ce4f4cc60ddfdb",
"dependencies": {
"@js-temporal/polyfill": "^0.4.4",
"sqlocal": "^0.11.1"
"@sqlite.org/sqlite-wasm": "3.46.1-build1",
"date-fns": "^3.6.0",
"sqlocal": "^0.11.1",
"vite-plugin-tauri": "^3.3.0"
}
}
8 changes: 6 additions & 2 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@
"identifier": "com.wordly-x.dev",
"longDescription": "",
"macOS": {
"entitlements": null,
"entitlements": "build/entitlements.mac.plist",
"exceptionDomain": "",
"frameworks": [],
"providerShortName": null,
"signingIdentity": null
"signingIdentity": null,
"extendInfo": {
"NSMicrophoneUsageDescription": "Wordly-X requires microphone access to record audio.",
"com.apple.security.device.audio-input": true,
}
},
"resources": [],
"shortDescription": "",
Expand Down
Loading

0 comments on commit 2a77bf7

Please sign in to comment.